diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-02-14 10:07:48 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-02-14 11:14:14 +0100 |
commit | 29b27aecb44c00094a6c6d0f8141af969afd9630 (patch) | |
tree | 1d25784f066b89e7e1e61bad9b38a916a6d06874 /vcl | |
parent | b414ab3ec0caa8f53d76743ee43efcf78a7d5fa9 (diff) |
vcl: test rendering of bitmaps with alpha
Change-Id: I6fde9581793fe85fc30d0660de3d62f0ddbfe9fd
Reviewed-on: https://gerrit.libreoffice.org/67807
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx | 27 | ||||
-rw-r--r-- | vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png | bin | 0 -> 106 bytes |
2 files changed, 27 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx index b6f2dbbd3d99..e770f1a4cc86 100644 --- a/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx +++ b/vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx @@ -19,6 +19,7 @@ #include <vcl/pngwrite.hxx> #include <vcl/graphicfilter.hxx> +#include <vcl/filter/PngImageReader.hxx> static OUString const gaDataUrl = "/vcl/qa/cppunit/bitmaprender/data/"; @@ -37,10 +38,13 @@ public: void testTdf104141(); void testTdf113918(); + void testDrawBitmap32(); CPPUNIT_TEST_SUITE(BitmapRenderTest); CPPUNIT_TEST(testTdf104141); CPPUNIT_TEST(testTdf113918); + CPPUNIT_TEST(testDrawBitmap32); + CPPUNIT_TEST_SUITE_END(); }; @@ -95,6 +99,29 @@ void BitmapRenderTest::testTdf113918() CPPUNIT_ASSERT(aColor.GetGreen() > 100); } +void BitmapRenderTest::testDrawBitmap32() +{ + ScopedVclPtrInstance<VirtualDevice> pVDev; + pVDev->SetOutputSizePixel(Size(8, 8)); + pVDev->SetBackground(Wallpaper(COL_WHITE)); + pVDev->Erase(); + + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(0, 0))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(1, 1))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(2, 2))); + + SvFileStream aFileStream(getFullUrl("ImageRGBA.png"), StreamMode::READ); + + vcl::PngImageReader aPngReader(aFileStream); + BitmapEx aBitmapEx; + aPngReader.read(aBitmapEx); + pVDev->DrawBitmapEx(Point(), aBitmapEx); + + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetPixel(Point(0, 0))); + CPPUNIT_ASSERT_EQUAL(COL_YELLOW, pVDev->GetPixel(Point(1, 1))); + CPPUNIT_ASSERT_EQUAL(Color(0x00, 0x7F, 0xFF, 0x7F), pVDev->GetPixel(Point(2, 2))); +} + CPPUNIT_TEST_SUITE_REGISTRATION(BitmapRenderTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png b/vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png Binary files differnew file mode 100644 index 000000000000..7a8399293c94 --- /dev/null +++ b/vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png |