add a unittest for tdf#132367
Change-Id: I7f694cd830f3aaf7a41fde66c896e6510f2d92e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113043
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx
index 6ed0b88..2ca53bb 100644
--- a/vcl/qa/cppunit/skia/skia.cxx
+++ b/vcl/qa/cppunit/skia/skia.cxx
@@ -44,6 +44,7 @@ public:
void testDelayedScale();
void testTdf137329();
void testTdf140848();
void testTdf132367();
CPPUNIT_TEST_SUITE(SkiaTest);
CPPUNIT_TEST(testBitmapErase);
@@ -55,6 +56,7 @@ public:
CPPUNIT_TEST(testDelayedScale);
CPPUNIT_TEST(testTdf137329);
CPPUNIT_TEST(testTdf140848);
CPPUNIT_TEST(testTdf132367);
CPPUNIT_TEST_SUITE_END();
private:
@@ -425,6 +427,27 @@ void SkiaTest::testTdf140848()
CPPUNIT_ASSERT_EQUAL(COL_WHITE, device->GetPixel(Point(1200, 100)));
}
void SkiaTest::testTdf132367()
{
if (!SkiaHelper::isVCLSkiaEnabled())
return;
ScopedVclPtr<VirtualDevice> device = VclPtr<VirtualDevice>::Create(DeviceFormat::DEFAULT);
device->SetOutputSizePixel(Size(2, 2));
device->SetBackground(Wallpaper(COL_BLACK));
device->Erase();
device->DrawPixel(Point(1, 1), COL_WHITE);
// This will make the bitmap store data in SkImage.
Bitmap bitmap = device->GetBitmap(Point(0, 0), Size(2, 2));
// Scaling will only set up delayed scaling of the SkImage.
bitmap.Scale(Size(4, 4), BmpScaleFlag::NearestNeighbor);
// Now it will need to be converted to pixel buffer, check it's converted properly
// from the SkImage.
BitmapReadAccess access(bitmap);
CPPUNIT_ASSERT_EQUAL(tools::Long(4), access.Width());
CPPUNIT_ASSERT_EQUAL(tools::Long(4), access.Height());
CPPUNIT_ASSERT_EQUAL(BitmapColor(COL_WHITE), access.GetColor(3, 3));
}
} // namespace
CPPUNIT_TEST_SUITE_REGISTRATION(SkiaTest);