Avoid potential negative array index access to cached text.
[LibreOffice.git] / basegfx / test / B2IRangeTest.cxx
blob89d0d029f9de27fd470d1665daea4a485dc03512
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 */
11 #include <cppunit/TestAssert.h>
12 #include <cppunit/TestFixture.h>
13 #include <cppunit/extensions/HelperMacros.h>
14 #include <cppunit/plugin/TestPlugIn.h>
16 #include <basegfx/range/b2irange.hxx>
18 class B2IRangeTest : public CppUnit::TestFixture
20 void testCreation()
22 basegfx::B2IRange aRange(1, 2, 3, 4);
23 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRange.getMinX());
24 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aRange.getMaxX());
25 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aRange.getMinY());
26 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aRange.getMaxY());
28 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aRange.getWidth());
29 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aRange.getHeight());
32 void testCenter()
34 basegfx::B2IRange aRange(1, 2, 2, 3);
35 CPPUNIT_ASSERT_EQUAL(1.5, aRange.getCenterX());
36 CPPUNIT_ASSERT_EQUAL(2.5, aRange.getCenterY());
39 CPPUNIT_TEST_SUITE(B2IRangeTest);
40 CPPUNIT_TEST(testCreation);
41 CPPUNIT_TEST(testCenter);
42 CPPUNIT_TEST_SUITE_END();
45 CPPUNIT_TEST_SUITE_REGISTRATION(B2IRangeTest);
47 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */