diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2021-08-25 16:38:17 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-09-04 05:54:27 +0200 |
commit | 5f50890d06a411323e5e60098901be4911ef1356 (patch) | |
tree | 187eb35813ab53022217b1e6cd838a21dfb3dd77 /vcl/qa | |
parent | 94c7e6bb3daa60757a982b92d765ee6b0d07fe30 (diff) |
vcl: Add unit test for SetRefPoint(), IsRefPoint() and GetRefPoint()
Change-Id: I4fbc85015326b03fba15daf73176826669a16210
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121017
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index adbf72751b4c..1857b4555c8a 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -54,6 +54,8 @@ public: void testLineColor(); void testFont(); void testTransparentFont(); + void testDefaultRefPoint(); + void testRefPoint(); void testSystemTextColor(); void testShouldDrawWavePixelAsRect(); void testGetWaveLineSize(); @@ -84,6 +86,8 @@ public: CPPUNIT_TEST(testLineColor); CPPUNIT_TEST(testFont); CPPUNIT_TEST(testTransparentFont); + CPPUNIT_TEST(testDefaultRefPoint); + CPPUNIT_TEST(testRefPoint); CPPUNIT_TEST(testSystemTextColor); CPPUNIT_TEST(testShouldDrawWavePixelAsRect); CPPUNIT_TEST(testGetWaveLineSize); @@ -725,6 +729,42 @@ void VclOutdevTest::testTransparentFont() CPPUNIT_ASSERT_EQUAL(nActionsExpected, aMtf.GetActionSize()); } +void VclOutdevTest::testDefaultRefPoint() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + + GDIMetaFile aMtf; + aMtf.Record(pVDev.get()); + + pVDev->SetRefPoint(); + + CPPUNIT_ASSERT(!pVDev->IsRefPoint()); + CPPUNIT_ASSERT_EQUAL(Point(), pVDev->GetRefPoint()); + + MetaAction* pAction = aMtf.GetAction(0); + CPPUNIT_ASSERT_EQUAL(MetaActionType::REFPOINT, pAction->GetType()); + auto pRefPointAction = static_cast<MetaRefPointAction*>(pAction); + CPPUNIT_ASSERT_EQUAL(Point(), pRefPointAction->GetRefPoint()); +} + +void VclOutdevTest::testRefPoint() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + + GDIMetaFile aMtf; + aMtf.Record(pVDev.get()); + + pVDev->SetRefPoint(Point(10, 20)); + + CPPUNIT_ASSERT(pVDev->IsRefPoint()); + CPPUNIT_ASSERT_EQUAL(Point(10, 20), pVDev->GetRefPoint()); + + MetaAction* pAction = aMtf.GetAction(0); + CPPUNIT_ASSERT_EQUAL(MetaActionType::REFPOINT, pAction->GetType()); + auto pRefPointAction = static_cast<MetaRefPointAction*>(pAction); + CPPUNIT_ASSERT_EQUAL(Point(10, 20), pRefPointAction->GetRefPoint()); +} + void VclOutdevTest::testSystemTextColor() { { |