[Libreoffice-commits] core.git: vcl/qa
Chris Sherlock (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 6 12:08:00 UTC 2021
vcl/qa/cppunit/outdev.cxx | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
New commits:
commit f4d5be05f643e9a483fcbb8441faa4a89c0cb280
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Wed Sep 29 17:06:19 2021 +1000
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Oct 6 14:07:23 2021 +0200
vcl: test OutputDevice::DrawRect()
Change-Id: Ic9ed566d171b3059fbe6de9fcc32ca0af6db7a2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122820
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 9a93d8402b95..93ae28e3a732 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -70,6 +70,7 @@ public:
void testGetWaveLineSize();
void testDrawPixel();
void testDrawLine();
+ void testDrawRect();
CPPUNIT_TEST_SUITE(VclOutdevTest);
CPPUNIT_TEST(testVirtualDevice);
@@ -111,6 +112,7 @@ public:
CPPUNIT_TEST(testGetWaveLineSize);
CPPUNIT_TEST(testDrawPixel);
CPPUNIT_TEST(testDrawLine);
+ CPPUNIT_TEST(testDrawRect);
CPPUNIT_TEST_SUITE_END();
};
@@ -1127,6 +1129,44 @@ void VclOutdevTest::testDrawLine()
}
}
+void VclOutdevTest::testDrawRect()
+{
+ {
+ ScopedVclPtrInstance<VirtualDevice> pVDev;
+ GDIMetaFile aMtf;
+ aMtf.Record(pVDev.get());
+
+ pVDev->SetOutputSizePixel(Size(1, 100));
+ pVDev->DrawRect(tools::Rectangle(Point(0, 0), Size(50, 60)));
+
+ MetaAction* pAction = aMtf.GetAction(aMtf.GetActionSize() - 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rect action", MetaActionType::RECT, pAction->GetType());
+ MetaRectAction* pRectAction = dynamic_cast<MetaRectAction*>(pAction);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", tools::Rectangle(Point(0, 0), Size(50, 60)),
+ pRectAction->GetRect());
+ }
+
+ {
+ ScopedVclPtrInstance<VirtualDevice> pVDev;
+ GDIMetaFile aMtf;
+ aMtf.Record(pVDev.get());
+
+ pVDev->SetOutputSizePixel(Size(1, 100));
+ pVDev->DrawRect(tools::Rectangle(Point(0, 0), Size(50, 60)), 5, 10);
+
+ MetaAction* pAction = aMtf.GetAction(aMtf.GetActionSize() - 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rect action", MetaActionType::ROUNDRECT,
+ pAction->GetType());
+ MetaRoundRectAction* pRectAction = dynamic_cast<MetaRoundRectAction*>(pAction);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", tools::Rectangle(Point(0, 0), Size(50, 60)),
+ pRectAction->GetRect());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", static_cast<sal_uInt32>(5),
+ pRectAction->GetHorzRound());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Rectangle wrong", static_cast<sal_uInt32>(10),
+ pRectAction->GetVertRound());
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(VclOutdevTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list