summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-03-23 12:06:57 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-03-24 09:39:29 +0100
commit33324a41869817832d57accae5aa5d4c1d813309 (patch)
treedbe36bfa4e1d75b419d4ad6276b5b33f642061f6 /sd/qa
parent71f3980e40454907ee7e512678635eb48d9a4058 (diff)
sd_import_tests: simplify test
Change-Id: Idf1bae6bfb8a41d2bea65c4e1848368d2a2abd14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112984 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/import-tests.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index cce54cb16e4f..19fda935620a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1618,21 +1618,23 @@ void SdImportTest::testTdf113163()
BitmapEx aBMPEx = aPNGReader.read();
// make sure the bitmap is not empty and correct size (PNG export->import was successful)
- CPPUNIT_ASSERT_EQUAL(Size(100, 100), aBMPEx.GetSizePixel());
+ Size aSize = aBMPEx.GetSizePixel();
+ CPPUNIT_ASSERT_EQUAL(Size(100, 100), aSize);
Bitmap aBMP = aBMPEx.GetBitmap();
{
Bitmap::ScopedReadAccess pReadAccess(aBMP);
- int nNonBlackCount = 0;
- for (tools::Long nY = 1; nY < 99; ++nY)
+ for (tools::Long nX = 1; nX < aSize.Width() - 1; ++nX)
{
- for (tools::Long nX = 1; nX < 99; ++nX)
+ for (tools::Long nY = 1; nY < aSize.Height() - 1; ++nY)
{
- const Color aColor = pReadAccess->GetColor(nY, nX);
- if ((aColor.GetRed() != 0x00) || (aColor.GetGreen() != 0x00) || (aColor.GetBlue() != 0x00))
- ++nNonBlackCount;
+ // Check all pixels in the image are black
+ // Without the fix in place, this test would have failed with
+ // - Expected: 0
+ // - Actual : 16777215
+ const Color aColor = pReadAccess->GetColor(nX, nY);
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, aColor);
}
}
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Tdf113163: EMF image is not transparent", 0, nNonBlackCount);
}
xDocShRef->DoClose();
}