diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-07-27 01:47:21 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-07-28 05:27:18 +0200 |
commit | 486f997d257533b889bd5af4c85eb1e2f4c9c152 (patch) | |
tree | 036d6b697e5d65dd62b0cee0e6cc763cbcf8c63b /basegfx | |
parent | 62a803532f0cb8f777037d0915c1e69166963fd2 (diff) |
unit test for B2DPoint
Change-Id: I86a9d555e4915658acf5829fbf7c8336255d6343
Reviewed-on: https://gerrit.libreoffice.org/76490
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'basegfx')
-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: */ |