vcl/qa/cppunit/outdev.cxx | 15 +++++++++++++++ vcl/source/outdev/outdev.cxx | 8 ++++++++ vcl/source/outdev/outdevstate.cxx | 8 -------- 3 files changed, 23 insertions(+), 8 deletions(-)
New commits: commit d70622afd96b5d1f530082c8d5dd332188937f17 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Wed Aug 25 17:45:44 2021 +1000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 8 10:12:06 2021 +0200 vcl: move OutputDevice output flag functions to outdev.cxx Add unit test for EnableOutput(), IsOutputEnabled() and is IsDeviceOutputNecessary(). Change-Id: Ic07bcdc650575c1a2788adc3c967cb02e2f68302 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121019 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 5f78c5127807..c69120155d65 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -57,6 +57,7 @@ public: void testDefaultRefPoint(); void testRefPoint(); void testRasterOp(); + void testOutputFlag(); void testSystemTextColor(); void testShouldDrawWavePixelAsRect(); void testGetWaveLineSize(); @@ -90,6 +91,7 @@ public: CPPUNIT_TEST(testDefaultRefPoint); CPPUNIT_TEST(testRefPoint); CPPUNIT_TEST(testRasterOp); + CPPUNIT_TEST(testOutputFlag); CPPUNIT_TEST(testSystemTextColor); CPPUNIT_TEST(testShouldDrawWavePixelAsRect); CPPUNIT_TEST(testGetWaveLineSize); @@ -786,6 +788,19 @@ void VclOutdevTest::testRasterOp() CPPUNIT_ASSERT_EQUAL(RasterOp::Invert, pRasterOpAction->GetRasterOp()); } +void VclOutdevTest::testOutputFlag() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + + CPPUNIT_ASSERT(pVDev->IsOutputEnabled()); + CPPUNIT_ASSERT(pVDev->IsDeviceOutputNecessary()); + + pVDev->EnableOutput(false); + + CPPUNIT_ASSERT(!pVDev->IsOutputEnabled()); + CPPUNIT_ASSERT(!pVDev->IsDeviceOutputNecessary()); +} + void VclOutdevTest::testSystemTextColor() { { diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 1bbfc24cdb4d..1b006ff7f4dd 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -331,6 +331,14 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp ) mpAlphaVDev->SetRasterOp( eRasterOp ); } +void OutputDevice::EnableOutput( bool bEnable ) +{ + mbOutput = bEnable; + + if( mpAlphaVDev ) + mpAlphaVDev->EnableOutput( bEnable ); +} + sal_uInt16 OutputDevice::GetBitCount() const { // we need a graphics instance diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 90fe67eccb1a..5de6b1c5ec92 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -198,14 +198,6 @@ void OutputDevice::ClearStack() Pop(); } -void OutputDevice::EnableOutput( bool bEnable ) -{ - mbOutput = bEnable; - - if( mpAlphaVDev ) - mpAlphaVDev->EnableOutput( bEnable ); -} - void OutputDevice::SetAntialiasing( AntialiasingFlags nMode ) { if ( mnAntialiasing != nMode )