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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 11 10:52:55 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf136841.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx   |   17 +++++++++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit 076da4cd9d61adf15942a7bfc350bd0d268f64f1
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Mar 10 20:32:22 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Mar 11 11:52:16 2021 +0100

    tdf#136841: sw_ooxmlexport16: Add unittest
    
    Change-Id: I951adefaf60e4c0c5d751ac1a886a9c746989a68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112282
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf136841.docx b/sw/qa/extras/ooxmlexport/data/tdf136841.docx
new file mode 100644
index 000000000000..6f9020ee17f4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf136841.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 5555a819c00e..319695655fcb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -157,6 +157,23 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140572_docDefault_superscript, "tdf14
     CPPUNIT_ASSERT_EQUAL( sal_Int16(0), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEscapement") );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf136841, "tdf136841.docx")
+{
+    uno::Reference<drawing::XShape> image = getShape(1);
+    uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
+    uno::Reference<graphic::XGraphic> graphic;
+    imageProperties->getPropertyValue( "Graphic" ) >>= graphic;
+    Graphic vclGraphic(graphic);
+    BitmapEx bitmap(vclGraphic.GetBitmapEx());
+    CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL( tools::Long(76), bitmap.GetSizePixel().Height());
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Color: R:228 G:71 B:69 A:0
+    // - Actual  : Color: R:0 G:0 B:0 A:0
+    CPPUNIT_ASSERT_EQUAL( Color(228,71,69), bitmap.GetPixelColor(38,38));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getShapes());


More information about the Libreoffice-commits mailing list