[Libreoffice-commits] core.git: sd/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 24 08:40:17 UTC 2021
sd/qa/unit/import-tests.cxx | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
New commits:
commit 33324a41869817832d57accae5aa5d4c1d813309
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Mar 23 12:06:57 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 24 09:39:29 2021 +0100
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 at libreoffice.org>
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();
}
More information about the Libreoffice-commits
mailing list