basegfx/test/B2DPointTest.cxx |   46 ++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)

New commits:
commit 486f997d257533b889bd5af4c85eb1e2f4c9c152
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Jul 27 01:47:21 2019 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Jul 28 05:27:18 2019 +0200

    unit test for B2DPoint
    
    Change-Id: I86a9d555e4915658acf5829fbf7c8336255d6343
    Reviewed-on: https://gerrit.libreoffice.org/76490
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

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: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to