summaryrefslogtreecommitdiff
path: root/vcl/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-10-31 20:22:17 +0100
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:14 +0100
commitcefafdf6865251e2efcbcfb8f19af6bfd72390c3 (patch)
treedb46685219ffe7aaa3f8dd6f04ec91b2e878231f /vcl/qa
parent014c9f953eeae7b3db39f88c90af8b436553e1c1 (diff)
backendtest: test blending of bitmap
This forces a blending of an alpha virtualdevice with a BitmapEx which has an alpha component. This tries a fast-path with using blendAlphaBitmap in the backend and does blending manually and slower if the fast-path is not available. Change-Id: I7e45dc78ce3e61ede408aa8388802a193cbc577a
Diffstat (limited to 'vcl/qa')
-rw-r--r--vcl/qa/cppunit/BackendTest.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index 50e3981cc591..928d7746827b 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -22,6 +22,17 @@ class BackendTest : public test::BootstrapFixture
// "xdg-open ./workdir/CppunitTest/vcl_backend_test.test.core/"
static constexpr const bool mbExportBitmap = false;
+ void exportImage(OUString const& rsFilename, BitmapEx const& rBitmapEx)
+ {
+ if (mbExportBitmap)
+ {
+ BitmapEx aBitmapEx(rBitmapEx);
+ aBitmapEx.Scale(Size(128, 128), BmpScaleFlag::Fast);
+ SvFileStream aStream(rsFilename, StreamMode::WRITE | StreamMode::TRUNC);
+ GraphicFilter::GetGraphicFilter().compressAsPNG(aBitmapEx, aStream);
+ }
+ }
+
void exportImage(OUString const& rsFilename, Bitmap const& rBitmap)
{
if (mbExportBitmap)
@@ -377,6 +388,16 @@ public:
CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
}
+ void testDrawBlend()
+ {
+ vcl::test::OutputDeviceTestBitmap aOutDevTest;
+ BitmapEx aBitmapEx = aOutDevTest.setupDrawBlend();
+ auto eResult = vcl::test::OutputDeviceTestBitmap::checkBlend(aBitmapEx);
+ exportImage("08-05_blend_test.png", aBitmapEx);
+ if (aOutDevTest.getRenderBackendName() == "skia")
+ CPPUNIT_ASSERT(eResult != vcl::test::TestResult::Failed);
+ }
+
CPPUNIT_TEST_SUITE(BackendTest);
CPPUNIT_TEST(testDrawRectWithRectangle);
CPPUNIT_TEST(testDrawRectWithPixel);
@@ -417,6 +438,7 @@ public:
CPPUNIT_TEST(testDrawTransformedBitmap);
CPPUNIT_TEST(testDrawBitmapExWithAlpha);
CPPUNIT_TEST(testDrawMask);
+ CPPUNIT_TEST(testDrawBlend);
CPPUNIT_TEST_SUITE_END();
};