diff options
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 40 | ||||
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 3 |
2 files changed, 40 insertions, 3 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() { { diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 71ec101f4dd1..eaef70931062 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -287,7 +287,6 @@ css::uno::Any OutputDevice::GetSystemGfxDataAny() const void OutputDevice::SetRefPoint() { - if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRefPointAction( Point(), false ) ); @@ -298,10 +297,8 @@ void OutputDevice::SetRefPoint() if( mpAlphaVDev ) mpAlphaVDev->SetRefPoint(); } - void OutputDevice::SetRefPoint( const Point& rRefPoint ) { - if ( mpMetaFile ) mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, true ) ); |