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/b2ibox.hxx>
25 #include <basegfx/point/b2ipoint.hxx>
26 #include <basegfx/utils/rectcliptools.hxx>
30 class b2ibox
: public CppUnit::TestFixture
35 // cohen sutherland clipping
36 B2IBox
aBox(0, 0, 10, 10);
38 CPPUNIT_ASSERT_EQUAL_MESSAGE("(0,0) is outside range!", sal_uInt32(0),
39 utils::getCohenSutherlandClipFlags(B2IPoint(0, 0), aBox
));
40 CPPUNIT_ASSERT_EQUAL_MESSAGE("(-1,-1) is inside range!",
41 utils::RectClipFlags::LEFT
| utils::RectClipFlags::TOP
,
42 utils::getCohenSutherlandClipFlags(B2IPoint(-1, -1), aBox
));
43 CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,9) is outside range!", sal_uInt32(0),
44 utils::getCohenSutherlandClipFlags(B2IPoint(9, 9), aBox
));
45 CPPUNIT_ASSERT_EQUAL_MESSAGE("(10,10) is inside range!",
46 utils::RectClipFlags::RIGHT
| utils::RectClipFlags::BOTTOM
,
47 utils::getCohenSutherlandClipFlags(B2IPoint(10, 10), aBox
));
50 // Change the following lines only, if you add, remove or rename
51 // member functions of the current class,
52 // because these macros are need by auto register mechanism.
53 CPPUNIT_TEST_SUITE(b2ibox
);
54 CPPUNIT_TEST(TestBox
);
55 CPPUNIT_TEST_SUITE_END();
58 } // namespace basegfx
60 CPPUNIT_TEST_SUITE_REGISTRATION(basegfx::b2ibox
);
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */