[Libreoffice-commits] core.git: Branch 'libreoffice-7-1-1' - emfio/qa

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 25 12:18:23 UTC 2021


 emfio/qa/cppunit/emf/EmfImportTest.cxx |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 9b8500bbbe9a738fed6ba4b54e11cfecd0c34977
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Thu Feb 11 16:24:18 2021 +0100
Commit:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
CommitDate: Thu Feb 25 13:17:50 2021 +0100

    fix test for tdf#137413
    
    The test tested for the topleft corner to be transparent and not black,
    but the bitmap has a black outline, so the corner actually should be
    black, unlike the rest of the bitmap. I have no idea how the test
    could have possibly passed (and those #if tests indicate that it
    correctly failed with most drawing backends). What apparently enabled
    this to pass was commit 828504974d70111e, which made the drawing
    use DrawTransformedBitmap() implementation in the VCL backends,
    and the Cairo one apparently mishandles it. Reverting 828504974d70111e
    made the test fail.
    This commit fixes (and simplifies) the test.
    
    Change-Id: I1560849d683558abbe0cde816c4505b9824a0692
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110769
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit f52c5bea7775ac07cfacc232f0979a03bbdf9aa7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110778
    (cherry picked from commit ed6d37c3a24dd238cbf7fef47068318599fcfcb3)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111460
    Tested-by: René Engelhard <rene at debian.org>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index e8d4833e6424..e81a37d48487 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -26,7 +26,6 @@
 
 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
 #include <drawinglayer/tools/primitive2dxmldump.hxx>
-#include <vcl/bitmapaccess.hxx>
 
 #include <memory>
 
@@ -383,19 +382,13 @@ void Test::TestPdfInEmf()
     // height was only 5cm, so it looked blurry.
     CPPUNIT_ASSERT_EQUAL(14321.0, pVectorGraphicData->getSizeHint().getY());
 
-#if !defined(WNT) && !defined(MACOSX)
-    // Hmm, manual testing on Windows looks OK.
-    BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
-    AlphaMask aMask = aBitmapEx.GetAlpha();
-    Bitmap::ScopedReadAccess pAccess(aMask);
-    Color aColor(pAccess->GetPixel(0, 0));
     // Without the accompanying fix in place, this test would have failed with:
-    // - Expected: 220
+    // - Expected: 255
     // - Actual  : 0
-    // i.e. the pixel at the top left corner was entirely opaque, while it should be mostly
-    // transparent.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(220), aColor.GetBlue());
-#endif
+    // i.e. the pixel in the center was entirely opaque, while it should be transparent.
+    BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+    Size size = aBitmapEx.GetSizePixel();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(255), aBitmapEx.GetTransparency(size.Width() / 2, size.Height() / 2));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);


More information about the Libreoffice-commits mailing list