diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2008-12-29 22:47:57 +0000 |
|---|---|---|
| committer | tweenk <tweenk@users.sourceforge.net> | 2008-12-29 22:47:57 +0000 |
| commit | 0afd9182f7a018baa5bfeb46a33dfcf6c6680fbd (patch) | |
| tree | 7a57215d94a3ff5de09f50aec4db551a42f59dbc /src/helper | |
| parent | Fix bug #311736 (uninitialized variables resulted in weird snapping behaviour... (diff) | |
| download | inkscape-0afd9182f7a018baa5bfeb46a33dfcf6c6680fbd.tar.gz inkscape-0afd9182f7a018baa5bfeb46a33dfcf6c6680fbd.zip | |
Build a single test executable on Linux to match Windows build system.
(bzr r7040)
Diffstat (limited to 'src/helper')
| -rw-r--r-- | src/helper/Makefile_insert | 13 | ||||
| -rw-r--r-- | src/helper/units-test.h | 45 |
2 files changed, 22 insertions, 36 deletions
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 <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: @@ -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); + } }; /* |
