1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <cppunit/TestFixture.h>
21 #include <cppunit/extensions/HelperMacros.h>
22 #include <basegfx/point/b2dpoint.hxx>
23 
24 class B2DPointTest : public CppUnit::TestFixture
25 {
26 public:
27     void testCreation();
28 
29     CPPUNIT_TEST_SUITE(B2DPointTest);
30     CPPUNIT_TEST(testCreation);
31     CPPUNIT_TEST_SUITE_END();
32 };
33 
testCreation()34 void B2DPointTest::testCreation()
35 {
36     basegfx::B2DPoint aPoint1(5.0, 2.0);
37     CPPUNIT_ASSERT_EQUAL(5.0, aPoint1.getX());
38     CPPUNIT_ASSERT_EQUAL(2.0, aPoint1.getY());
39 
40     basegfx::B2DPoint aPoint2 = { 5.0, 2.0 };
41     CPPUNIT_ASSERT_EQUAL(5.0, aPoint2.getX());
42     CPPUNIT_ASSERT_EQUAL(2.0, aPoint2.getY());
43 
44     std::vector<basegfx::B2DPoint> aPointVector{
45         { 5.0, 2.0 },
46         { 4.0, 3.0 },
47     };
48     CPPUNIT_ASSERT_EQUAL(5.0, aPointVector[0].getX());
49     CPPUNIT_ASSERT_EQUAL(2.0, aPointVector[0].getY());
50     CPPUNIT_ASSERT_EQUAL(4.0, aPointVector[1].getX());
51     CPPUNIT_ASSERT_EQUAL(3.0, aPointVector[1].getY());
52 }
53 
54 CPPUNIT_TEST_SUITE_REGISTRATION(B2DPointTest);
55 
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
57