From: tweenk Date: Mon, 29 Dec 2008 22:47:57 +0000 (+0000) Subject: Build a single test executable on Linux to match Windows build system. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9cf82ac568634e779873c4bf6cd6b7bdd465556d;p=inkscape.git Build a single test executable on Linux to match Windows build system. --- diff --git a/src/Makefile.am b/src/Makefile.am index 842c3eb45..200abe1cf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,6 +33,82 @@ INCLUDES = \ CXXTEST_TEMPLATE = $(srcdir)/cxxtest-template.tpl CXXTESTGENFLAGS = --root --have-eh --template=$(CXXTEST_TEMPLATE) CXXTESTGEN = $(top_srcdir)/cxxtest/cxxtestgen.pl $(CXXTESTGENFLAGS) +# Add test cases to this variable +CXXTEST_TESTSUITES = + +# ################################################ +# +# E X T R A +# +# ################################################ + +if PLATFORM_WIN32 +win32_sources = winmain.cpp registrytool.cpp registrytool.h +win32ldflags = -lcomdlg32 +endif + +if INKJAR +inkjar_dir = inkjar +inkjar_libs = inkjar/libinkjar.a +endif + +inkscape_private_libs = \ + libinkpre.a \ + application/libinkapp.a \ + ui/dialog/libuidialog.a \ + dialogs/libspdialogs.a \ + ui/cache/libuicache.a \ + jabber_whiteboard/libjabber_whiteboard.a \ + pedro/libpedro.a \ + trace/libtrace.a \ + svg/libspsvg.a \ + filters/libfilters.a \ + widgets/libspwidgets.a \ + display/libspdisplay.a \ + helper/libspchelp.a \ + libcroco/libcroco.a \ + libnrtype/libnrtype.a \ + libavoid/libavoid.a \ + livarot/libvarot.a \ + live_effects/liblive_effects.a \ + live_effects/parameter/liblpeparam.a \ + ui/view/libuiview.a \ + ui/libui.a \ + ui/widget/libuiwidget.a \ + libgdl/libgdl.a \ + graphlayout/libgraphlayout.a \ + removeoverlap/libremoveoverlap.a \ + libcola/libcola.a \ + libvpsc/libvpsc.a \ + extension/libextension.a \ + extension/implementation/libimplementation.a \ + extension/internal/libinternal.a \ + libnr/libnr.a \ + extension/script/libscript.a \ + bind/libbind.a \ + dom/libdom.a \ + xml/libspxml.a \ + 2geom/lib2geom.a \ + util/libinkutil.a \ + io/libio.a \ + $(inkjar_libs) \ + libinkpost.a \ + debug/libinkdebug.a + +all_libs = \ + $(inkscape_private_libs) \ + $(INKSCAPE_LIBS) \ + $(GNOME_VFS_LIBS) \ + $(XFT_LIBS) \ + $(FREETYPE_LIBS) \ + $(kdeldadd) \ + $(win32ldflags) \ + $(CARBON_LDFLAGS) \ + $(PERL_LIBS) \ + $(PYTHON_LIBS) \ + $(INKBOARD_LIBS) \ + $(LIBWPG_LIBS) \ + $(IMAGEMAGICK_LIBS) # Include all partial makefiles from subdirectories include Makefile_insert @@ -84,48 +160,7 @@ bin_PROGRAMS = inkscape inkview # Libraries which should be compiled by "make" but not installed # Currently we use one library per source directory. -noinst_LIBRARIES = \ - libinkpre.a \ - application/libinkapp.a \ - dialogs/libspdialogs.a \ - pedro/libpedro.a \ - jabber_whiteboard/libjabber_whiteboard.a \ - display/libspdisplay.a \ - dom/libdom.a \ - extension/implementation/libimplementation.a \ - extension/internal/libinternal.a \ - extension/libextension.a \ - extension/script/libscript.a \ - filters/libfilters.a \ - bind/libbind.a \ - helper/libspchelp.a \ - io/libio.a \ - libcroco/libcroco.a \ - libgdl/libgdl.a \ - live_effects/liblive_effects.a \ - live_effects/parameter/liblpeparam.a \ - ui/libui.a \ - ui/cache/libuicache.a \ - ui/dialog/libuidialog.a \ - ui/view/libuiview.a \ - ui/widget/libuiwidget.a \ - util/libinkutil.a \ - debug/libinkdebug.a \ - $(inkjar_libs) \ - libnr/libnr.a \ - libnrtype/libnrtype.a \ - libavoid/libavoid.a \ - libvpsc/libvpsc.a \ - libcola/libcola.a \ - livarot/libvarot.a \ - removeoverlap/libremoveoverlap.a \ - graphlayout/libgraphlayout.a \ - svg/libspsvg.a \ - widgets/libspwidgets.a \ - trace/libtrace.a \ - xml/libspxml.a \ - 2geom/lib2geom.a \ - libinkpost.a +noinst_LIBRARIES = $(inkscape_private_libs) # Extra files to remove when doing "make distclean" DISTCLEANFILES = \ @@ -198,9 +233,9 @@ EXTRA_PROGRAMS = \ libnr/testnr -################################## -### TESTING STUFF (make check) ### -################################## +# ################################# +# ## TESTING STUFF (make check) ### +# ################################# # List of all programs that should be built before testing. Note that this is # different from TESTS, because some tests can be scripts that don't @@ -208,25 +243,23 @@ EXTRA_PROGRAMS = \ # automake adds $(EXEEXT) to check_PROGRAMS items but not to TESTS items: # TESTS items can be scripts etc. check_PROGRAMS = \ - test-src \ - style-test \ - display/test-display \ - helper/test-helper \ - libnr/test-nr \ - svg/test-svg \ - util/test-util \ - xml/test-xml -# io/streamtest + cxxtests \ + style-test # streamtest is unfinished and can't handle the relocations done during # "make distcheck". # List of all tests to be run. TESTS = $(check_PROGRAMS) +# including the the testsuites here ensures that they get distributed +cxxtests_SOURCES = cxxtests.cpp $(CXXTEST_TESTSUITES) +cxxtests_LDADD = libnr/nr-compose-reference.o $(all_libs) + +cxxtests.cpp: $(CXXTEST_TESTSUITES) $(CXXTEST_TEMPLATE) + $(CXXTESTGEN) -o cxxtests.cpp $(CXXTEST_TESTSUITES) + # ################################################ -# # D I S T -# # ################################################ dist-hook: @@ -234,4 +267,4 @@ dist-hook: cp $(srcdir)/pixmaps/*xpm $(distdir)/pixmaps distclean-local: - rm -f display/test-display.xml display/test-display.log helper/test-helper.xml helper/test-helper.log libnr/test-nr.xml libnr/test-nr.log svg/test-svg.xml svg/test-svg.log util/test-util.xml util/test-util.log xml/test-xml.xml xml/test-xml.log test-src.xml test-src.log + rm -f cxxtests.xml cxxtests.log diff --git a/src/Makefile_insert b/src/Makefile_insert index 3fc319c92..d5c9969b6 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -1,23 +1,6 @@ ## Makefile.am fragment, included by src/Makefile.am. -# ################################################ -# -# E X T R A -# -# ################################################ - -if PLATFORM_WIN32 -win32_sources = winmain.cpp registrytool.cpp registrytool.h -win32ldflags = -lcomdlg32 -endif - -if INKJAR -inkjar_dir = inkjar -inkjar_libs = inkjar/libinkjar.a -endif - - # ################################################ # # I N K S C A P E @@ -262,10 +245,6 @@ libinkpre_a_SOURCES = \ version.cpp version.h \ zoom-context.cpp zoom-context.h - -# Force libinkpost.a to be rebuilt if we add files to libinkpost_a_SOURCES. -libinkpost_a_DEPENDENCIES = Makefile_insert - # libinkpost.a: Any object file that needs to be near the end of the link line. # gradient-chemistry.o is called by some things in display/. libinkpost_a_SOURCES = \ @@ -307,63 +286,7 @@ libinkpost_a_SOURCES = \ helper/pixbuf-ops.cpp \ helper/pixbuf-ops.h -inkscape_private_libs = \ - libinkpre.a \ - application/libinkapp.a \ - ui/dialog/libuidialog.a \ - dialogs/libspdialogs.a \ - ui/cache/libuicache.a \ - jabber_whiteboard/libjabber_whiteboard.a \ - pedro/libpedro.a \ - trace/libtrace.a \ - svg/libspsvg.a \ - filters/libfilters.a \ - widgets/libspwidgets.a \ - display/libspdisplay.a \ - helper/libspchelp.a \ - libcroco/libcroco.a \ - libnrtype/libnrtype.a \ - libavoid/libavoid.a \ - livarot/libvarot.a \ - live_effects/liblive_effects.a \ - live_effects/parameter/liblpeparam.a \ - ui/view/libuiview.a \ - ui/libui.a \ - ui/widget/libuiwidget.a \ - libgdl/libgdl.a \ - graphlayout/libgraphlayout.a \ - removeoverlap/libremoveoverlap.a \ - libcola/libcola.a \ - libvpsc/libvpsc.a \ - extension/libextension.a \ - extension/implementation/libimplementation.a \ - extension/internal/libinternal.a \ - libnr/libnr.a \ - extension/script/libscript.a \ - bind/libbind.a \ - dom/libdom.a \ - xml/libspxml.a \ - 2geom/lib2geom.a \ - util/libinkutil.a \ - io/libio.a \ - $(inkjar_libs) \ - libinkpost.a \ - debug/libinkdebug.a - -all_libs = \ - $(inkscape_private_libs) \ - $(INKSCAPE_LIBS) \ - $(GNOME_VFS_LIBS) \ - $(XFT_LIBS) \ - $(FREETYPE_LIBS) \ - $(kdeldadd) \ - $(win32ldflags) \ - $(CARBON_LDFLAGS) \ - $(PERL_LIBS) \ - $(PYTHON_LIBS) \ - $(INKBOARD_LIBS) \ - $(LIBWPG_LIBS) \ - $(IMAGEMAGICK_LIBS) +# Additional dependencies desktop.$(OBJEXT): helper/sp-marshal.h document.$(OBJEXT): helper/sp-marshal.h inkscape_version.h @@ -403,7 +326,7 @@ inkscape_version.h: ../configure.ac # ###################### # ### CxxTest stuff #### # ###################### -inkscape_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/MultiPrinter.h \ $(srcdir)/TRPIFormatter.h \ $(srcdir)/PylogFormatter.h \ @@ -419,14 +342,3 @@ inkscape_testsuites = \ $(srcdir)/style-test.h \ $(srcdir)/test-helpers.h \ $(srcdir)/verbs-test.h - -test_src_SOURCES = \ - test-src.cpp \ - $(inkscape_testsuites) - -test_src_LDADD = \ - $(all_libs) \ - io/libio.a - -test-src.cpp: $(inkscape_testsuites) Makefile_insert $(CXXTEST_TEMPLATE) - $(CXXTESTGEN) -o test-src.cpp $(inkscape_testsuites) diff --git a/src/display/Makefile_insert b/src/display/Makefile_insert index ea1994040..33adbb308 100644 --- a/src/display/Makefile_insert +++ b/src/display/Makefile_insert @@ -129,18 +129,5 @@ display_libspdisplay_a_SOURCES = \ # ###################### # ### CxxTest stuff #### # ###################### -ddislay_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/display/curve-test.h - -display_test_display_SOURCES = \ - display/test-display-main.cpp \ - $(display_test_display_includes) - -display_test_display_LDADD = \ - libnr/libnr.a \ - display/libtest-display.a \ - $(inkscape_private_libs) \ - $(INKSCAPE_LIBS) - -display/test-display.cpp: $(dislay_testsuites) display/Makefile_insert $(CXXTEST_TEMPLATE) - $(CXXTESTGEN) -o display/test-display.cpp $(dislay_testsuites) diff --git a/src/helper/Makefile_insert b/src/helper/Makefile_insert index 1801d0ea1..cabd9b6ad 100644 --- a/src/helper/Makefile_insert +++ b/src/helper/Makefile_insert @@ -62,16 +62,5 @@ helper/sp-marshal.cpp helper/sp-marshal.h: helper/sp-marshal.list # ###################### # ### CxxTest stuff #### # ###################### -helper_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/helper/units-test.h - -helper_test_helper_SOURCES = \ - helper/test-helper.cpp \ - $(helper_testsuites) - -helper_test_helper_LDADD = \ - helper/libspchelp.a \ - -lglib-2.0 - -helper/test-helper.cpp: $(helper_testsuites) helper/Makefile_insert $(CXXTEST_TEMPLATE) - $(CXXTESTGEN) -o xml/test-xml.cpp $(helper_testsuites) diff --git a/src/helper/units-test.h b/src/helper/units-test.h index 15eab65d2..e54c9d2f9 100644 --- a/src/helper/units-test.h +++ b/src/helper/units-test.h @@ -4,30 +4,6 @@ #include #include - -/* N.B. Wrongly returns false if both near 0. (Not a problem for current users.) */ -static bool -approx_equal(double const x, double const y) -{ - return fabs(x / y - 1) < 1e-15; -} - -static double -sp_units_get_points(double const x, SPUnit const &unit) -{ - SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT); - double const px = sp_units_get_pixels(x, unit); - return sp_pixels_get_units(px, pt_unit); -} - -static double -sp_points_get_units(double const pts, SPUnit const &unit) -{ - SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT); - double const px = sp_units_get_pixels(pts, pt_unit); - return sp_pixels_get_units(px, unit); -} - class UnitsTest : public CxxTest::TestSuite { public: @@ -79,6 +55,27 @@ public: { TS_ASSERT(sp_units_table_sane()); } + +private: + /* N.B. Wrongly returns false if both near 0. (Not a problem for current users.) */ + bool approx_equal(double const x, double const y) + { + return fabs(x / y - 1) < 1e-15; + } + + double sp_units_get_points(double const x, SPUnit const &unit) + { + SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT); + double const px = sp_units_get_pixels(x, unit); + return sp_pixels_get_units(px, pt_unit); + } + + double sp_points_get_units(double const pts, SPUnit const &unit) + { + SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT); + double const px = sp_units_get_pixels(pts, pt_unit); + return sp_pixels_get_units(px, unit); + } }; /* diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert index f77475e6c..67af7a618 100644 --- a/src/libnr/Makefile_insert +++ b/src/libnr/Makefile_insert @@ -104,7 +104,7 @@ libnr_testnr_LDADD = \ # ###################### # ### CxxTest stuff #### # ###################### -libnr_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/libnr/in-svg-plane-test.h \ $(srcdir)/libnr/nr-compose-test.h \ $(srcdir)/libnr/nr-matrix-test.h \ @@ -114,16 +114,3 @@ libnr_testsuites = \ $(srcdir)/libnr/nr-scale-test.h \ $(srcdir)/libnr/nr-translate-test.h \ $(srcdir)/libnr/nr-types-test.h - -libnr_test_nr_SOURCES = \ - libnr/test-nr.cpp \ - $(libnr_testsuites) - -libnr_test_nr_LDADD = \ - libnr/libnr.a \ - libnr/nr-compose-reference.o \ - 2geom/lib2geom.a \ - -lglib-2.0 - -libnr/test-nr.cpp: $(libnr_testsuites) libnr/Makefile_insert $(CXXTEST_TEMPLATE) - $(CXXTESTGEN) -o libnr/test-nr.cpp $(libnr_testsuites) diff --git a/src/svg/Makefile_insert b/src/svg/Makefile_insert index eae713d23..b4558ce96 100644 --- a/src/svg/Makefile_insert +++ b/src/svg/Makefile_insert @@ -36,25 +36,10 @@ svg_libspsvg_a_SOURCES = \ # ###################### # ### CxxTest stuff #### # ###################### -svg_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/svg/css-ostringstream-test.h \ $(srcdir)/svg/stringstream-test.h \ $(srcdir)/svg/svg-affine-test.h \ $(srcdir)/svg/svg-color-test.h \ $(srcdir)/svg/svg-length-test.h \ $(srcdir)/svg/svg-path-geom-test.h - -svg_test_svg_SOURCES = \ - svg/test-svg.cpp \ - $(svg_testsuites) - -svg_test_svg_LDADD = \ - svg/libspsvg.a \ - svg/libtest-svg.a \ - test-stubs.o \ - 2geom/lib2geom.a \ - libnr/libnr.a \ - $(INKSCAPE_LIBS) - -svg/test-svg.cpp: $(svg_testsuites) svg/Makefile_insert $(CXXTEST_TEMPLATE) - $(CXXTESTGEN) -o svg/test-svg.cpp $(svg_testsuites) diff --git a/src/svg/svg-affine-test.h b/src/svg/svg-affine-test.h index 9cc1cc2fb..5e9fc61fc 100644 --- a/src/svg/svg-affine-test.h +++ b/src/svg/svg-affine-test.h @@ -9,17 +9,6 @@ #include #include -struct approx_equal { - bool operator()(Geom::Matrix const &ref, Geom::Matrix const &cm) const - { - double maxabsdiff = 0; - for(size_t i=0; i<6; i++) { - maxabsdiff = std::max(std::abs(ref[i]-cm[i]), maxabsdiff); - } - return maxabsdiff < 1e-14; - } -}; - class SvgAffineTest : public CxxTest::TestSuite { private: @@ -27,6 +16,16 @@ private: char const * str; Geom::Matrix matrix; }; + struct approx_equal_pred { + bool operator()(Geom::Matrix const &ref, Geom::Matrix const &cm) const + { + double maxabsdiff = 0; + for(size_t i=0; i<6; i++) { + maxabsdiff = std::max(std::abs(ref[i]-cm[i]), maxabsdiff); + } + return maxabsdiff < 1e-14; + } + }; static test_t const read_matrix_tests[3]; static test_t const read_translate_tests[3]; static test_t const read_scale_tests[3]; @@ -76,7 +75,7 @@ public: for(size_t i=0; i