configure.in | 16 ++++++++++++++ external_deps.lst | 5 ++++ sal/prj/build.lst | 4 ++- sal/qa/sal/makefile.mk | 32 ++++++++++++++-------------- sal/qa/sal/test_types.cxx | 26 ++++++++-------------- set_soenv.in | 3 +- solenv/inc/_tg_app.mk | 7 ++++++ solenv/inc/libs.mk | 6 ++++- solenv/inc/target.mk | 41 ++++++++++++++++++++++++++++++++++++ solenv/inc/tg_app.mk | 7 ++++++ vcl/aqua/source/gdi/ctlayout.cxx | 14 ++++++------ vcl/aqua/source/gdi/salgdiutils.cxx | 7 ++++-- 12 files changed, 124 insertions(+), 44 deletions(-)
New commits: commit 513225be9cbadee6d8f7fd4e9910e10fc5ff571b Author: Herbert Dürr <[email protected]> Date: Mon Jun 2 11:54:15 2014 +0000 #i125020# allow antialiasing on all update borders for Aqua graphics diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index bf0d9ee..ca120d0 100644 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -243,10 +243,13 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh { // update a little more around the designated rectangle // this helps with antialiased rendering + // Rounding down x and width can accumulate a rounding error of up to 2 + // The decrementing of x, the rounding error and the antialiasing border + // require that the width and the height need to be increased by four const Rectangle aVclRect(Point(static_cast<long int>(lX-1), static_cast<long int>(lY-1) ), - Size( static_cast<long int>(lWidth+3), - static_cast<long int>(lHeight+3) ) ); + Size( static_cast<long int>(lWidth+4), + static_cast<long int>(lHeight+4) ) ); mpFrame->maInvalidRect.Union( aVclRect ); } } commit 073ec69fb970830d39c8700317ee74dbbdfd1fda Author: Herbert Dürr <[email protected]> Date: Mon Jun 2 11:47:23 2014 +0000 #i125020# fix rounding error in AquaSalGraphics::RefreshRect() Rounding left and width down can accumulate a rounding error of almost two in the calculation of right. The existing code compensates for this by increasing the width by two, but since left has been decremented by one to accommodate for antialiasing artifacts this compensation is one to few by itself and two to few when accounting for antialiasing artifacts on the right. Y-pos and height have the same problems and get the matching fix. diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index a219609..bf0d9ee 100644 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -245,8 +245,8 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh // this helps with antialiased rendering const Rectangle aVclRect(Point(static_cast<long int>(lX-1), static_cast<long int>(lY-1) ), - Size( static_cast<long int>(lWidth+2), - static_cast<long int>(lHeight+2) ) ); + Size( static_cast<long int>(lWidth+3), + static_cast<long int>(lHeight+3) ) ); mpFrame->maInvalidRect.Union( aVclRect ); } } commit ee042661b996fd00d5504caf4f4be60f77bf880f Author: Herbert Dürr <[email protected]> Date: Mon Jun 2 11:30:49 2014 +0000 #i125020# fix the calculation of the text-update rectangle in CoreText by doing the calculation before CTLineDraw() updates the text position. Requesting the update early is possible because that update region is not used until AquaSalInstance::Yield(). diff --git a/vcl/aqua/source/gdi/ctlayout.cxx b/vcl/aqua/source/gdi/ctlayout.cxx index 880caae..aac5e77 100644 --- a/vcl/aqua/source/gdi/ctlayout.cxx +++ b/vcl/aqua/source/gdi/ctlayout.cxx @@ -265,13 +265,7 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y ); - // set the text color as fill color (see kCTForegroundColorFromContextAttributeName) - CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() ); - - // draw the text - CTLineDraw( mpCTLine, rAquaGraphics.mrContext ); - - // request an update of the changed window area + // request an update of the to-be-changed window area if( rAquaGraphics.IsWindowGraphics() ) { const CGRect aInkRect = CTLineGetImageBounds( mpCTLine, rAquaGraphics.mrContext ); @@ -279,6 +273,12 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const rAquaGraphics.RefreshRect( aRefreshRect ); } + // set the text color as fill color (see kCTForegroundColorFromContextAttributeName) + CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() ); + + // draw the text + CTLineDraw( mpCTLine, rAquaGraphics.mrContext ); + // restore the original graphic context transformations CGContextRestoreGState( rAquaGraphics.mrContext ); } commit 77e79c411fd1961cbdf0b8e07e85a8019b7d7350 Author: Jürgen Schmidt <[email protected]> Date: Mon Jun 2 10:57:39 2014 +0000 #125003# integrate googletest framework for general use for unit testing diff --git a/configure.in b/configure.in index 0df4cf2..b7d1fc3 100644 --- a/configure.in +++ b/configure.in @@ -58,6 +58,9 @@ AC_ARG_WITH(system-apache-commons, AC_ARG_ENABLE(online-update, [ --disable-online-update Disables the Online Update feature. ],,enable_online_update=yes) +AC_ARG_ENABLE(unit-tests, +[ --disable-unit-tests Disables default unit tests (eg. unit tests using Google test, ...). +],,enable_unit_tests=yes) AC_ARG_ENABLE(ldap, [ --disable-ldap Disables the use of LDAP backend via OpenLDAP ],,) @@ -1446,6 +1449,19 @@ else fi AC_SUBST(ENABLE_ONLINE_UPDATE) +dnl =================================================================== +dnl Unit Tests +dnl =================================================================== +AC_MSG_CHECKING([whether to enable unit tests]) +if test "$enable_unit_tests" = "yes" -o "$enable_unit_tests" = "TRUE"; then + ENABLE_UNIT_TESTS="YES" + BUILD_TYPE="$BUILD_TYPE GTEST" + AC_MSG_RESULT([yes]) +else + ENABLE_UNIT_TESTS="" + AC_MSG_RESULT([no]) +fi +AC_SUBST(ENABLE_UNIT_TESTS) AC_MSG_CHECKING([whether to enable native CUPS support]) if test "$test_cups" = "yes" -a \( "$enable_cups" = "yes" -o "$enable_cups" = "TRUE" \) ; then diff --git a/external_deps.lst b/external_deps.lst index 46e3ab2..1f6b6c4 100644 --- a/external_deps.lst +++ b/external_deps.lst @@ -41,6 +41,11 @@ if ( true ) URL1 = http://ucpp.googlecode.com/files/ucpp-1.3.2.tar.gz URL2 = $(OOO_EXTRAS)$(MD5)-$(name) +if (ENABLE_UNIT_TESTS == YES) + MD5 = 2d6ec8ccdf5c46b05ba54a9fd1d130d7 + name = gtest-1.7.0.zip + URL1 = http://googletest.googlecode.com/files/gtest-1.7.0.zip + if ( true ) MD5 = 067201ea8b126597670b5eff72e1f66c name = mythes-1.2.0.tar.gz diff --git a/sal/prj/build.lst b/sal/prj/build.lst index ddc6b10..2367c9a 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -1,4 +1,4 @@ -sa sal : xml2cmp stlport external BOOST:boost NULL +sa sal : xml2cmp stlport external BOOST:boost GTEST:gtest NULL sa sal usr1 - all sa_mkout NULL sa sal\inc nmake - all sa_inc NULL sa sal\typesconfig nmake - u sa_tc sa_inc NULL @@ -14,6 +14,8 @@ sa sal\qa nmake - all sa_qa sa_util NULL sa sal\osl\unx nmake - u sa_oslu sa_tc.u sa_inc NULL sa sal\osl\all nmake - all sa_oslall sa_tc.u sa_inc NULL sa sal\util nmake - all sa_util sa_tc.u sa_oslall sa_uwinapi.n sa_kill.n sa_onlineupdate.n sa_osln.n sa_oslp.p sa_oslu.u sa_rtl sa_textenc NULL +sa sal\qa\sal nmake - all sa_qa_sal sa_util NULL + sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL diff --git a/sal/qa/sal/makefile.mk b/sal/qa/sal/makefile.mk index f7c5bab..c3ae346 100644 --- a/sal/qa/sal/makefile.mk +++ b/sal/qa/sal/makefile.mk @@ -20,27 +20,27 @@ #************************************************************** +PRJ = ..$/.. +PRJNAME = sal +TARGET = sal_ut_types -PRJ := ..$/.. -PRJNAME := sal -TARGET := qa_sal - -ENABLE_EXCEPTIONS := TRUE +ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk -SHL1TARGET = $(TARGET)_types -SHL1OBJS = $(SLO)$/test_types.obj -SHL1STDLIBS = $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) -SHL1VERSIONMAP = version.map -SHL1IMPLIB = i$(SHL1TARGET) -DEF1NAME = $(SHL1TARGET) +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. -SLOFILES = $(SHL1OBJS) +.ELSE -.INCLUDE: target.mk +APP1OBJS = $(OBJ)/test_types.obj +APP1RPATH = NONE +APP1STDLIBS = $(GTESTLIB) $(SALLIB) +APP1TARGET = sal_ut_test +APP1TEST = enabled +#APP1TEST = disabled -ALLTAR: test +.INCLUDE: target.mk -test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) +.ENDIF diff --git a/sal/qa/sal/test_types.cxx b/sal/qa/sal/test_types.cxx index 4c69e16..7cac015 100644 --- a/sal/qa/sal/test_types.cxx +++ b/sal/qa/sal/test_types.cxx @@ -28,9 +28,10 @@ #include <stdio.h> // C99 snprintf not necessarily in <cstdio> #include <string.h> // wntmsci10 does not know <cstring> std::strcmp -#include "testshl/simpleheader.hxx" #include "sal/types.h" +#include "gtest/gtest.h" + namespace { template< typename T > void testPrintf( @@ -39,20 +40,11 @@ template< typename T > void testPrintf( std::size_t const bufsize = 1000; char buf[bufsize]; int n = snprintf(buf, bufsize, format, argument); - CPPUNIT_ASSERT(n >= 0 && sal::static_int_cast< unsigned int >(n) < bufsize); - CPPUNIT_ASSERT(strcmp(buf, result) == 0); + ASSERT_TRUE(n >= 0 && sal::static_int_cast< unsigned int >(n) < bufsize); + ASSERT_TRUE(strcmp(buf, result) == 0); } -class Test: public CppUnit::TestFixture { -public: - void test(); - - CPPUNIT_TEST_SUITE(Test); - CPPUNIT_TEST(test); - CPPUNIT_TEST_SUITE_END(); -}; - -void Test::test() { +TEST(Sal_Test, Types_Test) { testPrintf("-2147483648", "%" SAL_PRIdINT32, SAL_MIN_INT32); testPrintf("4294967295", "%" SAL_PRIuUINT32, SAL_MAX_UINT32); testPrintf("ffffffff", "%" SAL_PRIxUINT32, SAL_MAX_UINT32); @@ -70,8 +62,10 @@ void Test::test() { testPrintf("ABC", "%" SAL_PRIXUINTPTR, static_cast< sal_uIntPtr >(0xabc)); } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests"); - } -NOADDITIONAL; +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/set_soenv.in b/set_soenv.in index 80fb9d2..53c931d 100644 --- a/set_soenv.in +++ b/set_soenv.in @@ -105,7 +105,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL, $WIN_GNUCOPY, $WIN_TOUCH, $MOZILLABUILD, $PROEXT, $TARFILE_LOCATION, $ENABLE_HUNSPELL, $ENABLE_HYPHEN, - $SYSTEM_PYTHON, $EPM_FLAGS); + $SYSTEM_PYTHON, $EPM_FLAGS, $ENABLE_UNIT_TESTS); # #------------------------------------------- # IId. Declaring the aliases. @@ -1861,6 +1861,7 @@ ToFile( "SYSTEM_CPPUNIT", "@SYSTEM_CPPUNIT@", "e" ); ToFile( "CPPUNIT_CFLAGS", "@CPPUNIT_CFLAGS@", "e" ); ToFile( "CPPUNIT_LIBS", "@CPPUNIT_LIBS@", "e" ); ToFile( "WITH_CPPUNIT", "@WITH_CPPUNIT@", "e" ); +ToFile( "ENABLE_UNIT_TESTS", "@ENABLE_UNIT_TESTS@", "e" ); ToFile( "SYSTEM_LIBXML", "@SYSTEM_LIBXML@", "e" ); ToFile( "USE_FT_EMBOLDEN", "@USE_FT_EMBOLDEN@", "e" ); ToFile( "LIBXML_CFLAGS", "@LIBXML_CFLAGS@", "e" ); diff --git a/solenv/inc/_tg_app.mk b/solenv/inc/_tg_app.mk index fbced22..c9295b8 100644 --- a/solenv/inc/_tg_app.mk +++ b/solenv/inc/_tg_app.mk @@ -279,6 +279,13 @@ $(APP1TARGETN): $(APP1OBJS) $(APP1LIBS) \ .ENDIF # "$(APP1TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP1TEST)" == "enabled" && "$(APP1TARGET)" != "" + +$(APP1TARGET)_run: $(APP1TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH) $(APP1TARGETN) --gtest_output="xml:$(BIN)/$(APP1TARGET)_result.xml" + +.ENDIF # Instruction for linking # unroll begin diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk index 9aa27cf..d8d70a9 100644 --- a/solenv/inc/libs.mk +++ b/solenv/inc/libs.mk @@ -278,6 +278,9 @@ CPPUNITLIB = $(CPPUNIT_LIBS) .ELSE CPPUNITLIB = -lcppunit .ENDIF + +GTESTLIB= -lgtest + .IF "$(SYSTEM_LIBXSLT)"=="YES" XSLTLIB=$(LIBXSLT_LIBS) .ELSE @@ -294,7 +297,6 @@ REDLANDLIB=$(REDLAND_LIBS) REDLANDLIB=-lrdf .ENDIF - # # USED_%NAME%_LIBS # Variablen, in denen in gueltiger Reihenfolge ALLE Libraries, @@ -470,6 +472,8 @@ HELPLINKERLIB=ihelplinker.lib JVMACCESSLIB = ijvmaccess.lib XSLTLIB = libxslt.lib $(LIBXML2LIB) CPPUNITLIB = icppunit_dll.lib +GTESTLIB = igtest.lib + REDLANDLIB = librdf.lib JVMFWKLIB = ijvmfwk.lib diff --git a/solenv/inc/target.mk b/solenv/inc/target.mk index 35da3ad..77a334e 100644 --- a/solenv/inc/target.mk +++ b/solenv/inc/target.mk @@ -150,6 +150,44 @@ APP8TARGET= APP9TARGET= .ENDIF +APP1RUNTEST= +APP2RUNTEST= +APP3RUNTEST= +APP4RUNTEST= +APP5RUNTEST= +APP6RUNTEST= +APP7RUNTEST= +APP8RUNTEST= +APP9RUNTEST= + +.IF "$(APP1TEST)"=="enabled" +APP1RUNTEST=$(APP1TARGET)_run +.ENDIF +.IF "$(APP2TEST)"=="enabled" +APP2RUNTEST=$(APP2TARGET)_run +.ENDIF +.IF "$(APP3TEST)"=="enabled" +APP3RUNTEST=$(APP3TARGET)_run +.ENDIF +.IF "$(APP4TEST)"=="enabled" +APP4RUNTEST=$(APP4TARGET)_run +.ENDIF +.IF "$(APP5TEST)"=="enabled" +APP5RUNTEST=$(APP5TARGET)_run +.ENDIF +.IF "$(APP6TEST)"=="enabled" +APP6RUNTEST=$(APP6TARGET)_run +.ENDIF +.IF "$(APP7TEST)"=="enabled" +APP7RUNTEST=$(APP7TARGET)_run +.ENDIF +.IF "$(APP8TEST)"=="enabled" +APP8RUNTEST=$(APP8TARGET)_run +.ENDIF +.IF "$(APP9TEST)"=="enabled" +APP9RUNTEST=$(APP9TARGET)_run +.ENDIF + .IF "$(IDLFILES)"!="" URDFILES+=$(foreach,i,$(IDLFILES:s/.idl/.urd/:f) $(OUT)/ucr/$(IDLPACKAGE)/$i) @@ -1156,6 +1194,9 @@ ALLTAR: \ $(APP1TARGETN) $(APP2TARGETN) $(APP3TARGETN) \ $(APP4TARGETN) $(APP5TARGETN) $(APP6TARGETN) \ $(APP7TARGETN) $(APP8TARGETN) $(APP9TARGETN) \ + $(APP1RUNTEST) $(APP2RUNTEST) $(APP3RUNTEST) \ + $(APP4RUNTEST) $(APP5RUNTEST) $(APP6RUNTEST) \ + $(APP7RUNTEST) $(APP8RUNTEST) $(APP9RUNTEST) \ $(JARTARGETN) \ $(JARTARGETDEPN) \ $(SRC1TARGET) \ diff --git a/solenv/inc/tg_app.mk b/solenv/inc/tg_app.mk index ad2a50f..7ce4730 100644 --- a/solenv/inc/tg_app.mk +++ b/solenv/inc/tg_app.mk @@ -281,6 +281,13 @@ $(APP$(TNR)TARGETN): $(APP$(TNR)OBJS) $(APP$(TNR)LIBS) \ .ENDIF # "$(APP$(TNR)TARGETN)"!="" +# New rule for automatic run targets of unit test targets +.IF "$(APP$(TNR)TEST)" == "enabled" && "$(APP$(TNR)TARGET)" != "" + +$(APP$(TNR)TARGET)_run: $(APP$(TNR)TARGETN) + $(COMMAND_ECHO) $(AUGMENT_LIBRARY_PATH) $(APP$(TNR)TARGETN) --gtest_output="xml:$(BIN)/$(APP$(TNR)TARGET)_result.xml" + +.ENDIF # Instruction for linking # unroll end
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
