calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / tools / qa / cppunit / test_poly.cxx
blobf966f5317a487e4879497d67bd2bdb3c21188af8
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/.
8 */
10 #include <cppunit/TestAssert.h>
11 #include <cppunit/TestFixture.h>
12 #include <cppunit/extensions/HelperMacros.h>
14 #include <tools/poly.hxx>
16 namespace
18 class Test : public CppUnit::TestFixture
20 public:
21 void testTdf137068();
23 CPPUNIT_TEST_SUITE(Test);
24 CPPUNIT_TEST(testTdf137068);
25 CPPUNIT_TEST_SUITE_END();
28 void Test::testTdf137068()
30 // Make sure PolyPolygon::Clip() does not break bezier curves.
31 const Point points[] = { { 1337, 411 }, { 1337, 471 }, { 1313, 530 }, { 1268, 582 } };
32 const PolyFlags flags[]
33 = { PolyFlags::Normal, PolyFlags::Control, PolyFlags::Control, PolyFlags::Normal };
34 tools::Polygon polygon(4, points, flags);
35 tools::PolyPolygon polyPolygon(polygon);
36 polyPolygon.Clip(tools::Rectangle(Point(0, 0), Size(1920, 1080)));
37 // operator== is stupid and just compares pointers, compare data manually
38 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(1), polyPolygon.Count());
39 tools::Polygon result = polyPolygon.GetObject(0);
40 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(4), result.GetSize());
41 CPPUNIT_ASSERT_EQUAL(points[0], result.GetPoint(0));
42 CPPUNIT_ASSERT_EQUAL(points[1], result.GetPoint(1));
43 CPPUNIT_ASSERT_EQUAL(points[2], result.GetPoint(2));
44 CPPUNIT_ASSERT_EQUAL(points[3], result.GetPoint(3));
45 CPPUNIT_ASSERT_EQUAL(flags[0], result.GetFlags(0));
46 CPPUNIT_ASSERT_EQUAL(flags[1], result.GetFlags(1));
47 CPPUNIT_ASSERT_EQUAL(flags[2], result.GetFlags(2));
48 CPPUNIT_ASSERT_EQUAL(flags[3], result.GetFlags(3));
51 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */