[Libreoffice-commits] core.git: vcl/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Feb 14 10:14:42 UTC 2019


 vcl/qa/cppunit/bitmaprender/BitmapRenderTest.cxx |   27 +++++++++++++++++++++++
 vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png   |binary
 2 files changed, 27 insertions(+)

New commits:
commit 29b27aecb44c00094a6c6d0f8141af969afd9630
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Feb 14 10:07:48 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Feb 14 11:14:14 2019 +0100

    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 at gmail.com>

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
new file mode 100644
index 000000000000..7a8399293c94
Binary files /dev/null and b/vcl/qa/cppunit/bitmaprender/data/ImageRGBA.png differ


More information about the Libreoffice-commits mailing list