[Libreoffice-commits] core.git: sw/CppunitTest_sw_ww8export.mk sw/qa

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 10 18:47:34 UTC 2021


 sw/CppunitTest_sw_ww8export.mk       |    1 +
 sw/qa/extras/ww8export/ww8export.cxx |   16 ++++++----------
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 106899c9d9d8c3f381fc6a6874c431dea1ea6057
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Mar 5 23:17:48 2021 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Mar 10 19:46:51 2021 +0100

    use BitmapEx for testing bitmap contents, not DIB
    
    The weirdo that tested the bitmap using the format-specific way
    was ... me, in 2014.
    
    Change-Id: I2cf96ba42da7099f2ce0b80ac53261c67321ef0e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112041
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/sw/CppunitTest_sw_ww8export.mk b/sw/CppunitTest_sw_ww8export.mk
index beec46f3cc7f..e338a15f1947 100644
--- a/sw/CppunitTest_sw_ww8export.mk
+++ b/sw/CppunitTest_sw_ww8export.mk
@@ -32,6 +32,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_ww8export, \
     sw \
 	swqahelper \
     tl \
+    vcl \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,sw_ww8export,\
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index be85611d18e3..b7befec7c0cd 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -500,16 +500,12 @@ DECLARE_WW8EXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.doc")
     uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
     uno::Reference<graphic::XGraphic> graphic;
     imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
-    uno::Reference<awt::XBitmap> bitmap(graphic, uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL( sal_Int32(58), bitmap->getSize().Width );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32(320), bitmap->getSize().Height );
-    const uno::Sequence< sal_Int8 > data = bitmap->getDIB(); // as .bmp data
-    CPPUNIT_ASSERT_EQUAL( sal_Int32(20278), data.getLength());
-    CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b0])); // -50 = 206 pixel value
-    CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b1]));
-    CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b2]));
-    CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b3]));
-    CPPUNIT_ASSERT_EQUAL( -50, int(data[0x6b4]));
+    Graphic vclGraphic(graphic);
+    BitmapEx bitmap(vclGraphic.GetBitmapEx());
+    CPPUNIT_ASSERT_EQUAL( tools::Long(58), bitmap.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL( tools::Long(320), bitmap.GetSizePixel().Height());
+    CPPUNIT_ASSERT_EQUAL( Color(206,206,206), bitmap.GetPixelColor(16,27));
+    CPPUNIT_ASSERT_EQUAL( Color(206,206,206), bitmap.GetPixelColor(22,48));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf95321, "tdf95321.doc")


More information about the Libreoffice-commits mailing list