tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / vcl / backendtest / outputdevice / clip.cxx
blob495b43b6f11f33c26e7dc954a61d8bbfefd52b07
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 <test/outputdevice.hxx>
13 namespace vcl::test
15 Bitmap OutputDeviceTestClip::setupClipRectangle()
17 initialSetup(13, 13, constBackgroundColor);
19 tools::Rectangle rectangle = maVDRectangle;
20 rectangle.shrink(2);
21 mpVirtualDevice->SetClipRegion(vcl::Region(rectangle));
22 mpVirtualDevice->SetBackground(constFillColor);
23 mpVirtualDevice->Erase(maVDRectangle);
25 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
28 Bitmap OutputDeviceTestClip::setupClipPolygon()
30 initialSetup(13, 13, constBackgroundColor);
32 tools::Rectangle rectangle = maVDRectangle;
33 rectangle.shrink(2);
34 mpVirtualDevice->SetClipRegion(vcl::Region(tools::Polygon(rectangle)));
35 mpVirtualDevice->SetBackground(constFillColor);
36 mpVirtualDevice->Erase(maVDRectangle);
38 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
41 Bitmap OutputDeviceTestClip::setupClipPolyPolygon()
43 initialSetup(13, 13, constBackgroundColor);
45 tools::Rectangle rectangle = maVDRectangle;
46 rectangle.shrink(2);
47 mpVirtualDevice->SetClipRegion(vcl::Region(tools::PolyPolygon(rectangle)));
48 mpVirtualDevice->SetBackground(constFillColor);
49 mpVirtualDevice->Erase(maVDRectangle);
51 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
54 Bitmap OutputDeviceTestClip::setupClipB2DPolyPolygon()
56 initialSetup(13, 13, constBackgroundColor);
58 tools::Rectangle rectangle = maVDRectangle;
59 rectangle.shrink(2);
60 mpVirtualDevice->SetClipRegion(vcl::Region(basegfx::B2DPolyPolygon(basegfx::B2DPolygon{
61 basegfx::B2DPoint(rectangle.Left(), rectangle.Top()),
62 basegfx::B2DPoint(rectangle.Left(), rectangle.Bottom()),
63 basegfx::B2DPoint(rectangle.Right(), rectangle.Bottom()),
64 basegfx::B2DPoint(rectangle.Right(), rectangle.Top()),
65 })));
66 mpVirtualDevice->SetBackground(constFillColor);
67 mpVirtualDevice->Erase(maVDRectangle);
69 return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
72 TestResult OutputDeviceTestClip::checkClip(Bitmap& aBitmap)
74 std::vector<Color> aExpected{ constBackgroundColor, constBackgroundColor, constFillColor,
75 constFillColor, constFillColor, constFillColor,
76 constFillColor };
77 return checkRectangles(aBitmap, aExpected);
80 } // end namespace vcl::test
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */