From: jaspervdg Date: Sat, 19 Jul 2008 11:25:01 +0000 (+0000) Subject: Consistently use (create/destroy)Suite in unit tests. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9eb886f0efdd076022ef171278e8475a580a1e91;p=inkscape.git Consistently use (create/destroy)Suite in unit tests. --- diff --git a/src/display/bezier-utils-test.h b/src/display/bezier-utils-test.h index ec980810b..4e5788983 100644 --- a/src/display/bezier-utils-test.h +++ b/src/display/bezier-utils-test.h @@ -104,6 +104,11 @@ public: } virtual ~BezierUtilsTest() {} +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static BezierUtilsTest *createSuite() { return new BezierUtilsTest(); } + static void destroySuite( BezierUtilsTest *suite ) { delete suite; } + void testCopyWithoutNansOrAdjacentDuplicates() { NR::Point const src[] = { diff --git a/src/helper/units-test.h b/src/helper/units-test.h index ff218ca94..15eab65d2 100644 --- a/src/helper/units-test.h +++ b/src/helper/units-test.h @@ -36,6 +36,11 @@ public: } virtual ~UnitsTest() {} +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static UnitsTest *createSuite() { return new UnitsTest(); } + static void destroySuite( UnitsTest *suite ) { delete suite; } + void testConversions() { struct Case { double x; char const *abbr; double pts; } const tests[] = { diff --git a/src/libnr/nr-compose-test.h b/src/libnr/nr-compose-test.h index fbac745ef..c40975920 100644 --- a/src/libnr/nr-compose-test.h +++ b/src/libnr/nr-compose-test.h @@ -105,6 +105,11 @@ public: delete[] mask; } +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static NrComposeTest *createSuite() { return new NrComposeTest(); } + static void destroySuite( NrComposeTest *suite ) { delete suite; } + // FINAL DST SRC void testnr_R8G8B8A8_N_EMPTY_R8G8B8A8_N() diff --git a/src/svg/css-ostringstream-test.h b/src/svg/css-ostringstream-test.h index 1d407b0e2..295bf4bf3 100644 --- a/src/svg/css-ostringstream-test.h +++ b/src/svg/css-ostringstream-test.h @@ -20,6 +20,12 @@ css_test_float(float const x, std::string const &exp_str) class CSSOStringStreamTest : public CxxTest::TestSuite { public: + +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static CSSOStringStreamTest *createSuite() { return new CSSOStringStreamTest(); } + static void destroySuite( CSSOStringStreamTest *suite ) { delete suite; } + void testFloats() { css_test_float(4.5, "4.5"); diff --git a/src/svg/stringstream-test.h b/src/svg/stringstream-test.h index a8da13150..d1a041721 100644 --- a/src/svg/stringstream-test.h +++ b/src/svg/stringstream-test.h @@ -21,6 +21,12 @@ svg_test_float(float const x, std::string const &exp_str) class StringStreamTest : public CxxTest::TestSuite { public: + +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static StringStreamTest *createSuite() { return new StringStreamTest(); } + static void destroySuite( StringStreamTest *suite ) { delete suite; } + void testFloats() { svg_test_float(4.5, "4.5"); diff --git a/src/svg/svg-affine-test.h b/src/svg/svg-affine-test.h index 7a4c27fb3..9cc1cc2fb 100644 --- a/src/svg/svg-affine-test.h +++ b/src/svg/svg-affine-test.h @@ -32,7 +32,7 @@ private: static test_t const read_scale_tests[3]; static test_t const read_rotate_tests[4]; static test_t const read_skew_tests[3]; - static char const * read_fail_tests[25]; + static char const * const read_fail_tests[25]; static test_t const write_matrix_tests[2]; static test_t const write_translate_tests[3]; static test_t const write_scale_tests[2]; @@ -42,6 +42,11 @@ public: SvgAffineTest() { } +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static SvgAffineTest *createSuite() { return new SvgAffineTest(); } + static void destroySuite( SvgAffineTest *suite ) { delete suite; } + void testReadIdentity() { char const* strs[] = { @@ -200,7 +205,7 @@ SvgAffineTest::test_t const SvgAffineTest::read_skew_tests[3] = { {"skewX( 30)",Geom::Matrix(1,0,tan(30.*DEGREE),1,0,0)}, {"skewX(-30)",Geom::Matrix(1,0,tan(-30.*DEGREE),1,0,0)}, {"skewY(390)",Geom::Matrix(1,tan(30.*DEGREE),0,1,0,0)}}; -char const * SvgAffineTest::read_fail_tests[25] = { +char const * const SvgAffineTest::read_fail_tests[25] = { "matrix((1,2,3,4,5,6)", "matrix((1,2,3,4,5,6))", "matrix(1,2,3,4,5,6))", diff --git a/src/svg/svg-color-test.h b/src/svg/svg-color-test.h index b149b7a44..0636fa32f 100644 --- a/src/svg/svg-color-test.h +++ b/src/svg/svg-color-test.h @@ -23,6 +23,11 @@ public: rgb24 << 8); } +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static SVGColorTest *createSuite() { return new SVGColorTest(); } + static void destroySuite( SVGColorTest *suite ) { delete suite; } + void testWrite() { unsigned const components[] = {0, 0x80, 0xff, 0xc0, 0x77}; diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index 2345803d8..829612b26 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -17,6 +17,11 @@ public: SvgLengthTest() { } +// createSuite and destroySuite get us per-suite setup and teardown +// without us having to worry about static initialization order, etc. + static SvgLengthTest *createSuite() { return new SvgLengthTest(); } + static void destroySuite( SvgLengthTest *suite ) { delete suite; } + void testRead() { for(size_t i=0; i