diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2019-07-13 13:10:20 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-08-08 13:03:01 +0200 |
commit | 41dbf08b99c259b387e95e9143b88b508724d945 (patch) | |
tree | 95809c129da81a78d484836d32195effe780221b /vcl/qa | |
parent | 7e88bc73030c7708f1a8b47491070aae5b73aac1 (diff) |
tdf#74702: use OutputDevice::GetBackgroundColor()
Apply the Liskov substitution principle to OutputDevice::GetBackgroundColor().
This helps in SmTmpDevice::Impl_GetColor() because it no longer needs to know
about what type of OutputDevice it is calling to get the background color.
This forced a rename of basctl::ModulWindowLayout::GetBackgroundColor() to be
GetSyntaxBackgroundColor(), but this is a happy coincidence as it makes the
function intent clearer anyway.
Change-Id: I11298a63cb01c187f3a8a4a2c9e90eacda6c3e6b
Reviewed-on: https://gerrit.libreoffice.org/75521
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 45bae92ca58c..b91248078ab8 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -10,6 +10,8 @@ #include <test/bootstrapfixture.hxx> #include <vcl/virdev.hxx> +#include <vcl/print.hxx> +#include <vcl/window.hxx> #include <vcl/bitmapaccess.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -21,18 +23,38 @@ public: void testVirtualDevice(); void testUseAfterDispose(); + void testPrinterBackgroundColor(); + void testWindowBackgroundColor(); CPPUNIT_TEST_SUITE(VclOutdevTest); CPPUNIT_TEST(testVirtualDevice); CPPUNIT_TEST(testUseAfterDispose); + CPPUNIT_TEST(testPrinterBackgroundColor); + CPPUNIT_TEST(testWindowBackgroundColor); CPPUNIT_TEST_SUITE_END(); }; +void VclOutdevTest::testPrinterBackgroundColor() +{ + ScopedVclPtrInstance<Printer> pPrinter; + CPPUNIT_ASSERT_EQUAL(pPrinter->GetBackgroundColor(), COL_WHITE); +} + +void VclOutdevTest::testWindowBackgroundColor() +{ + ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); + pWindow->SetBackground(Wallpaper(COL_WHITE)); + CPPUNIT_ASSERT_EQUAL(pWindow->GetBackgroundColor(), COL_WHITE); +} + void VclOutdevTest::testVirtualDevice() { ScopedVclPtrInstance< VirtualDevice > pVDev; pVDev->SetOutputSizePixel(Size(32,32)); pVDev->SetBackground(Wallpaper(COL_WHITE)); + + CPPUNIT_ASSERT_EQUAL(pVDev->GetBackgroundColor(), COL_WHITE); + pVDev->Erase(); pVDev->DrawPixel(Point(1,2),COL_BLUE); pVDev->DrawPixel(Point(31,30),COL_RED); |