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/TestAssert.h>
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
23 #include <cppunit/plugin/TestPlugIn.h>
24 
25 #include <basegfx/range/b2drange.hxx>
26 #include <basegfx/range/b2irange.hxx>
27 
28 class B2DRangeTest : public CppUnit::TestFixture
29 {
testRange()30     void testRange()
31     {
32         basegfx::B2DRange aRange(1.2, 2.3, 3.5, 4.8);
33         CPPUNIT_ASSERT_EQUAL(1.2, aRange.getMinX());
34         CPPUNIT_ASSERT_EQUAL(3.5, aRange.getMaxX());
35         CPPUNIT_ASSERT_EQUAL(2.3, aRange.getMinY());
36         CPPUNIT_ASSERT_EQUAL(4.8, aRange.getMaxY());
37 
38         CPPUNIT_ASSERT_EQUAL(2.3, aRange.getWidth());
39         CPPUNIT_ASSERT_EQUAL(2.5, aRange.getHeight());
40 
41         CPPUNIT_ASSERT_EQUAL_MESSAGE("simple range rounding from double to integer",
42                                      basegfx::B2IRange(1, 2, 4, 5), fround(aRange));
43     }
44 
45     // Change the following lines only, if you add, remove or rename
46     // member functions of the current class,
47     // because these macros are need by auto register mechanism.
48 
49     CPPUNIT_TEST_SUITE(B2DRangeTest);
50     CPPUNIT_TEST(testRange);
51     CPPUNIT_TEST_SUITE_END();
52 };
53 
54 CPPUNIT_TEST_SUITE_REGISTRATION(B2DRangeTest);
55 
56 CPPUNIT_PLUGIN_IMPLEMENT();
57 
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
59