summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 764095c)
raw | patch | inline | side by side (parent: 764095c)
author | tweenk <tweenk@users.sourceforge.net> | |
Mon, 29 Dec 2008 22:47:57 +0000 (22:47 +0000) | ||
committer | tweenk <tweenk@users.sourceforge.net> | |
Mon, 29 Dec 2008 22:47:57 +0000 (22:47 +0000) |
diff --git a/src/Makefile.am b/src/Makefile.am
index 842c3eb4514bcf1dc16bb2fd451f4d1eed8efebb..200abe1cfa369c5ea325a032e4cd8aa5ad1e545c 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
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
# 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 = \
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
# 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:
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 3fc319c9255c879144562352887d35f04f21da6c..d5c9969b6a181f7d32297933b780f06bb8eb713c 100644 (file)
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
## 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
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 = \
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
# ######################
# ### CxxTest stuff ####
# ######################
-inkscape_testsuites = \
+CXXTEST_TESTSUITES += \
$(srcdir)/MultiPrinter.h \
$(srcdir)/TRPIFormatter.h \
$(srcdir)/PylogFormatter.h \
$(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)
index ea1994040bdd17f5ad1623ac84b16369fe316479..33adbb3086a5899108988a927daf0f19910f5e98 100644 (file)
# ######################
# ### 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)
index 1801d0ea1a2025365e4bcfa55db957400e4b199d..cabd9b6adf6d89370603201e33c8e0d7b7c314a5 100644 (file)
# ######################
# ### 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)
index 15eab65d2541aa6e1272c5b1e51cf99c3093d39c..e54c9d2f93149b2bbcb4c1cda01a2f389059d238 100644 (file)
--- a/src/helper/units-test.h
+++ b/src/helper/units-test.h
#include <glibmm/i18n.h>
#include <math.h>
-
-/* 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:
{
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);
+ }
};
/*
index f77475e6cec3bd25b0dcd2c2c7a4da8acd9c1a85..67af7a61884e71f8641ec931fde51fe0880d45fd 100644 (file)
# ######################
# ### 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 \
$(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)
index eae713d23a82c792eb77a0001989868df989f62d..b4558ce96cc8aa231f4fe6eab445c1f8b4bb7901 100644 (file)
--- a/src/svg/Makefile_insert
+++ b/src/svg/Makefile_insert
# ######################
# ### 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)
index 9cc1cc2fb6e51a4c51feae0efa0ee37bb359ffd1..5e9fc61fc5ee82a1252c16d6cc451ed9b3f47bd7 100644 (file)
#include <math.h>
#include <utility>
-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:
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];
for(size_t i=0; i<G_N_ELEMENTS(read_matrix_tests); i++) {
Geom::Matrix cm;
TSM_ASSERT(read_matrix_tests[i].str , sp_svg_transform_read(read_matrix_tests[i].str, &cm));
- TSM_ASSERT_RELATION(read_matrix_tests[i].str , approx_equal , read_matrix_tests[i].matrix , cm);
+ TSM_ASSERT_RELATION(read_matrix_tests[i].str , approx_equal_pred , read_matrix_tests[i].matrix , cm);
}
}
for(size_t i=0; i<G_N_ELEMENTS(read_translate_tests); i++) {
Geom::Matrix cm;
TSM_ASSERT(read_translate_tests[i].str , sp_svg_transform_read(read_translate_tests[i].str, &cm));
- TSM_ASSERT_RELATION(read_translate_tests[i].str , approx_equal , read_translate_tests[i].matrix , cm);
+ TSM_ASSERT_RELATION(read_translate_tests[i].str , approx_equal_pred , read_translate_tests[i].matrix , cm);
}
}
for(size_t i=0; i<G_N_ELEMENTS(read_scale_tests); i++) {
Geom::Matrix cm;
TSM_ASSERT(read_scale_tests[i].str , sp_svg_transform_read(read_scale_tests[i].str, &cm));
- TSM_ASSERT_RELATION(read_scale_tests[i].str , approx_equal , read_scale_tests[i].matrix , cm);
+ TSM_ASSERT_RELATION(read_scale_tests[i].str , approx_equal_pred , read_scale_tests[i].matrix , cm);
}
}
for(size_t i=0; i<G_N_ELEMENTS(read_rotate_tests); i++) {
Geom::Matrix cm;
TSM_ASSERT(read_rotate_tests[i].str , sp_svg_transform_read(read_rotate_tests[i].str, &cm));
- TSM_ASSERT_RELATION(read_rotate_tests[i].str , approx_equal , read_rotate_tests[i].matrix , cm);
+ TSM_ASSERT_RELATION(read_rotate_tests[i].str , approx_equal_pred , read_rotate_tests[i].matrix , cm);
}
}
for(size_t i=0; i<G_N_ELEMENTS(read_skew_tests); i++) {
Geom::Matrix cm;
TSM_ASSERT(read_skew_tests[i].str , sp_svg_transform_read(read_skew_tests[i].str, &cm));
- TSM_ASSERT_RELATION(read_skew_tests[i].str , approx_equal , read_skew_tests[i].matrix , cm);
+ TSM_ASSERT_RELATION(read_skew_tests[i].str , approx_equal_pred , read_skew_tests[i].matrix , cm);
}
}
Geom::Matrix ref(2.0199976232558053, 1.0674773585906016, -0.14125199392774669, 1.9055550612095459, 14.412730624347654, 28.499820929377454); // Precomputed using Mathematica
Geom::Matrix cm;
TS_ASSERT(sp_svg_transform_read(str, &cm));
- TS_ASSERT_RELATION(approx_equal , ref , cm);
+ TS_ASSERT_RELATION(approx_equal_pred , ref , cm);
}
void testReadFailures()
index c3ac0be0bafe4d8ebf60d84b5e7d696eef87b694..a21cdc6eb20c2072263bbcba589138b5280631fa 100644 (file)
--- a/src/util/Makefile_insert
+++ b/src/util/Makefile_insert
# ### CxxTest stuff ####
# ######################
-util_testsuites = \
+CXXTEST_TESTSUITES += \
$(srcdir)/util/list-container-test.h
-
-util_test_util_SOURCES = \
- util/test-util.cpp \
- $(util_testsuites)
-
-util_test_util_LDADD = \
- util/libtest-util.a \
- gc.o \
- $(INKSCAPE_LIBS)
-
-util/test-util.cpp: $(util_testsuites) util/Makefile_insert $(CXXTEST_TEMPLATE)
- $(CXXTESTGEN) -o util/test-util.cpp $(util_testsuites)
index 3321031c90ec4777f0807fdf54db6e03def4ae88..d135b786e2683917aa05ee1d7e6f20eec73bbf1c 100644 (file)
--- a/src/xml/Makefile_insert
+++ b/src/xml/Makefile_insert
# ######################
# ### CxxTest stuff ####
# ######################
-xml_testsuites = \
+CXXTEST_TESTSUITES += \
$(srcdir)/xml/repr-action-test.h \
$(srcdir)/xml/quote-test.h
-
-xml_test_xml_SOURCES = \
- xml/test-xml.cpp \
- $(xml_testsuites)
-
-xml_test_xml_LDADD = \
- xml/libspxml.a \
- util/libinkutil.a \
- svg/libspsvg.a \
- helper/libspchelp.a \
- test-stubs.o \
- libinkpost.a \
- debug/libinkdebug.a \
- $(INKSCAPE_LIBS)
-
-xml/test-xml.cpp: $(xml_testsuites) xml/Makefile_insert $(CXXTEST_TEMPLATE)
- $(CXXTESTGEN) -o xml/test-xml.cpp $(xml_testsuites)