diff options
-rw-r--r-- | basegfx/test/B2DPointTest.cxx | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/basegfx/test/B2DPointTest.cxx b/basegfx/test/B2DPointTest.cxx index 97c5c0714d32..77fa61d90b9d 100644 --- a/basegfx/test/B2DPointTest.cxx +++ b/basegfx/test/B2DPointTest.cxx @@ -19,30 +19,38 @@ #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> +#include <basegfx/point/b2dpoint.hxx> -namespace basegfx -{ -class b2dpoint : public CppUnit::TestFixture +class B2DPointTest : public CppUnit::TestFixture { public: - // insert your test code here. - // this is only demonstration code - void EmptyMethod() - { - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(b2dpoint); - CPPUNIT_TEST(EmptyMethod); + void testCreation(); + + CPPUNIT_TEST_SUITE(B2DPointTest); + CPPUNIT_TEST(testCreation); CPPUNIT_TEST_SUITE_END(); -}; // class b2dpoint +}; + +void B2DPointTest::testCreation() +{ + basegfx::B2DPoint aPoint1(5.0, 2.0); + CPPUNIT_ASSERT_EQUAL(5.0, aPoint1.getX()); + CPPUNIT_ASSERT_EQUAL(2.0, aPoint1.getY()); + + basegfx::B2DPoint aPoint2 = { 5.0, 2.0 }; + CPPUNIT_ASSERT_EQUAL(5.0, aPoint2.getX()); + CPPUNIT_ASSERT_EQUAL(2.0, aPoint2.getY()); -} // namespace basegfx + std::vector<basegfx::B2DPoint> aPointVector{ + { 5.0, 2.0 }, + { 4.0, 3.0 }, + }; + CPPUNIT_ASSERT_EQUAL(5.0, aPointVector[0].getX()); + CPPUNIT_ASSERT_EQUAL(2.0, aPointVector[0].getY()); + CPPUNIT_ASSERT_EQUAL(4.0, aPointVector[1].getX()); + CPPUNIT_ASSERT_EQUAL(3.0, aPointVector[1].getY()); +} -CPPUNIT_TEST_SUITE_REGISTRATION(basegfx::b2dpoint); +CPPUNIT_TEST_SUITE_REGISTRATION(B2DPointTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |