diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2021-10-01 11:25:20 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-10-11 11:57:34 +0200 |
commit | 545f993d86148f550a58e02c0bdefb04222ac5fe (patch) | |
tree | 9681eba70c131a7dda94f5e986760a79e3841f2d /vcl/qa/cppunit | |
parent | debf76437f181e4e8aa61b0fc159738ad9312c73 (diff) |
vcl: test OutputDevice::DrawBorder()
Change-Id: I627cf9a8f9f6697a7e01cef9356b298e0a2b21f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122971
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qa/cppunit')
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 490810544917..0d4d6187742e 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -79,6 +79,7 @@ public: void testDrawPie(); void testDrawChord(); void testDrawCheckered(); + void testDrawBorder(); CPPUNIT_TEST_SUITE(VclOutdevTest); CPPUNIT_TEST(testVirtualDevice); @@ -127,6 +128,7 @@ public: CPPUNIT_TEST(testDrawPie); CPPUNIT_TEST(testDrawChord); CPPUNIT_TEST(testDrawCheckered); + CPPUNIT_TEST(testDrawBorder); CPPUNIT_TEST_SUITE_END(); }; @@ -1728,6 +1730,42 @@ void VclOutdevTest::testDrawCheckered() CPPUNIT_ASSERT_EQUAL_MESSAGE("Not pop", MetaActionType::POP, pAction->GetType()); } +void VclOutdevTest::testDrawBorder() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + GDIMetaFile aMtf; + aMtf.Record(pVDev.get()); + + pVDev->SetOutputSizePixel(Size(100, 100)); + pVDev->DrawBorder(tools::Rectangle(Point(0, 0), Size(50, 60))); + + MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a line color action (light gray)", MetaActionType::LINECOLOR, + pAction->GetType()); + MetaLineColorAction* pLineColorAction = dynamic_cast<MetaLineColorAction*>(pAction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not light gray", COL_LIGHTGRAY, pLineColorAction->GetColor()); + + pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rect action (light gray border)", MetaActionType::RECT, + pAction->GetType()); + MetaRectAction* pRectAction = dynamic_cast<MetaRectAction*>(pAction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", tools::Rectangle(Point(1, 1), Size(49, 59)), + pRectAction->GetRect()); + + pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a line color action (gray)", MetaActionType::LINECOLOR, + pAction->GetType()); + pLineColorAction = dynamic_cast<MetaLineColorAction*>(pAction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not gray", COL_GRAY, pLineColorAction->GetColor()); + + pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT + 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rect action (gray border)", MetaActionType::RECT, + pAction->GetType()); + pRectAction = dynamic_cast<MetaRectAction*>(pAction); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", tools::Rectangle(Point(0, 0), Size(49, 59)), + pRectAction->GetRect()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(VclOutdevTest); CPPUNIT_PLUGIN_IMPLEMENT(); |