[Libreoffice-commits] core.git: 2 commits - vcl/qa

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 7 15:05:36 UTC 2019


 vcl/qa/cppunit/canvasbitmaptest.cxx |    5 ++++-
 vcl/qa/cppunit/gen/gen.cxx          |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 0d00e5650679786728231a580b1cd46e409038cc
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Oct 2 14:09:13 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Oct 7 17:04:45 2019 +0200

    adjust a confusing test
    
    GetPrefSize() at this point is Size(0,0), so the test was testing
    topleft corner. And getPixel() takes Y,X , so even then it wasn't
    testing the center.
    
    Change-Id: Ie2e489a693fae2b7ea41075ebe6fa3ef405545d5
    Reviewed-on: https://gerrit.libreoffice.org/80351
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/qa/cppunit/gen/gen.cxx b/vcl/qa/cppunit/gen/gen.cxx
index 6dfd3da71079..dfcfaa997b80 100644
--- a/vcl/qa/cppunit/gen/gen.cxx
+++ b/vcl/qa/cppunit/gen/gen.cxx
@@ -68,8 +68,8 @@ CPPUNIT_TEST_FIXTURE(GenTest, testTdf121120)
 {
     Bitmap aBitmap = load("tdf121120.png");
     Bitmap::ScopedReadAccess pAccess(aBitmap);
-    const Size& rSize = aBitmap.GetPrefSize();
-    Color aColor(pAccess->GetPixel(rSize.getWidth() / 2, rSize.getHeight() / 2));
+    const Size& rSize = aBitmap.GetSizePixel();
+    Color aColor(pAccess->GetPixel(rSize.getHeight() / 2, rSize.getWidth() / 2));
     // Without the accompanying fix in place, this test would have failed with 'Expected: 255;
     // Actual  : 1'. I.e. center of the preview (which has the background color) was ~black, not
     // white.
commit a9a6e154301fef99fe294591e0b327ace7e0945f
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Sep 30 17:11:32 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Mon Oct 7 17:04:37 2019 +0200

    fix test for CanvasBitmap not handling N32BitTcMask bpp properly
    
    Change-Id: Ic331d33e0f0feca1fde4425fdb4106b1a769194d
    Reviewed-on: https://gerrit.libreoffice.org/80350
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index bd6f96b7ca95..48514580104b 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -84,10 +84,13 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
     BitmapEx aContainedBmpEx( xBmp->getBitmapEx() );
     Bitmap   aContainedBmp( aContainedBmpEx.GetBitmap() );
     int      nDepth = nOriginalDepth;
+    int      extraBpp = 0;
 
     {
         Bitmap::ScopedReadAccess pAcc( aContainedBmp );
         nDepth = pAcc->GetBitCount();
+        if( pAcc->GetScanlineFormat() == ScanlineFormat::N32BitTcMask )
+            extraBpp = 8; // the format has 8 unused bits
     }
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Original bitmap size not (200,200)",
@@ -106,7 +109,7 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp,
     uno::Sequence<sal_Int8> aPixelData = xBmp->getData(aLayout, geometry::IntegerRectangle2D(0,0,1,1));
 
     const sal_Int32 nExpectedBitsPerPixel(
-        aContainedBmpEx.IsTransparent() ? std::max(8,nDepth)+8 : nDepth);
+        (aContainedBmpEx.IsTransparent() ? std::max(8,nDepth)+8 : nDepth) + extraBpp);
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "# scanlines not 1",
                             static_cast<sal_Int32>(1), aLayout.ScanLines);
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "# scanline bytes mismatch",


More information about the Libreoffice-commits mailing list