1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <cppunit/TestAssert.h>
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
24 #include <basegfx/range/b2drange.hxx>
25 #include <basegfx/range/b2dpolyrange.hxx>
26 #include <basegfx/polygon/b2dpolygontools.hxx>
30 class b2dpolyrange
: public CppUnit::TestFixture
37 aRange
.appendElement(B2DRange(0, 0, 1, 1), B2VectorOrientation::Positive
);
38 aRange
.appendElement(B2DRange(2, 2, 3, 3), B2VectorOrientation::Positive
);
40 CPPUNIT_ASSERT_EQUAL_MESSAGE("simple poly range - count", sal_uInt32(2), aRange
.count());
41 CPPUNIT_ASSERT_EQUAL_MESSAGE("simple poly range - first element", B2DRange(0, 0, 1, 1),
42 std::get
<0>(aRange
.getElement(0)));
43 CPPUNIT_ASSERT_EQUAL_MESSAGE("simple poly range - second element", B2DRange(2, 2, 3, 3),
44 std::get
<0>(aRange
.getElement(1)));
46 // B2DPolyRange relies on correctly orientated rects
47 const B2DRange
aRect(0, 0, 1, 1);
48 CPPUNIT_ASSERT_EQUAL_MESSAGE("createPolygonFromRect - correct orientation",
49 B2VectorOrientation::Positive
,
50 utils::getOrientation(utils::createPolygonFromRect(aRect
)));
53 // Change the following lines only, if you add, remove or rename
54 // member functions of the current class,
55 // because these macros are need by auto register mechanism.
57 CPPUNIT_TEST_SUITE(b2dpolyrange
);
59 CPPUNIT_TEST_SUITE_END();
63 CPPUNIT_TEST_SUITE_REGISTRATION(basegfx::b2dpolyrange
);
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */