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

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 16 11:22:49 UTC 2021


 sd/qa/unit/data/pptx/crop-position.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx      |   23 +++++++++--------------
 sd/qa/unit/import-tests.cxx             |    9 +++++----
 3 files changed, 14 insertions(+), 18 deletions(-)

New commits:
commit 6a5027f5fc84deab83f08b81a01c5acca2cfd9f6
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Wed Feb 10 20:14:22 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Feb 16 12:22:13 2021 +0100

    tdf#134210 Better testing for cropping bitmap of custom shape.
    
    Change-Id: I592e2e99306a4aa27dce17e8b8d75e4bb2262cab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110723
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110976

diff --git a/sd/qa/unit/data/pptx/crop-position.pptx b/sd/qa/unit/data/pptx/crop-position.pptx
index 69507514e0b7..85b859be6b8e 100644
Binary files a/sd/qa/unit/data/pptx/crop-position.pptx and b/sd/qa/unit/data/pptx/crop-position.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index a1e752834f1a..a76c8ec137e6 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1151,25 +1151,18 @@ void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect()
     // Without the accompanying fix in place, this test would have failed with:
     // - Expected: 1
     // - Actual  : 0
-    // - XPath '//a:blipFill/a:srcRect' number of nodes is incorrect
+    // - XPath '/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect' number of nodes is incorrect
     // i.e. <a:srcRect> was exported as <a:fillRect> in <a:stretch>, which made part of the image
     // invisible.
 
+    assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect");
+
     // tdf#134210
     // Original values of attribute of l and r in xml files: <a:srcRect l="4393" r="4393"/>
-    // Because of we have not core feature for cropping bitmap in custom shapes, we added cropping
-    // support to import filter. We modified the bitmap during import. As result the original
-    // image is cropped anymore (if we had the core feature for that, the original image would
-    // remain same, just we would see like cropped in the shape) To see the image in correct
-    // position in Microsoft Office too, we have to remove left right top bottom percentages
-    // anymore. In the future if we add core feature to LibreOffice, this test will failed with
-    // When we add the core feature, we should change the control value with 4393 as following.
-
-    //const OString sXmlPath = "//a:blipFill/a:srcRect";
-    //sal_Int32 nLeftPercent = getXPath(pXmlDoc, sXmlPath, "l").toInt32();
-    //CPPUNIT_ASSERT_EQUAL(sal_Int32(4393), nLeftPercent);
-    //sal_Int32 nRightPercent = getXPath(pXmlDoc, sXmlPath, "r").toInt32();
-    //CPPUNIT_ASSERT_EQUAL(sal_Int32(4393), nRightPercent);
+    // No core feature for handling this. We add suuport to import filter. We crop the bitmap
+    // physically during import and shouldn't export the l r t b attributes anymore. In the
+    // future if we add core feature to LibreOffice, we should change the control value with
+    // 4393.
 
     assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "l");
     assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "r");
@@ -1177,6 +1170,8 @@ void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect()
     assertXPathNoAttribute(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:blipFill/a:srcRect", "b");
 }
 
+
+
 void SdOOXMLExportTest1::testTdf100348FontworkBitmapFill()
 {
     ::sd::DrawDocShellRef xDocShRef
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index d6f6da8c1f83..a60d6f601bfc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -217,8 +217,8 @@ public:
     void testShapeGlowEffectPPTXImpoer();
     void testShapeBlurPPTXImport();
     void testMirroredGraphic();
-    void testCropPositionGraphic();
     void testGreysScaleGraphic();
+    void testTdf134210CropPosition();
 
     bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
     void testPatternImport();
@@ -348,8 +348,8 @@ public:
     CPPUNIT_TEST(testShapeGlowEffectPPTXImpoer);
     CPPUNIT_TEST(testShapeBlurPPTXImport);
     CPPUNIT_TEST(testMirroredGraphic);
-    CPPUNIT_TEST(testCropPositionGraphic);
     CPPUNIT_TEST(testGreysScaleGraphic);
+    CPPUNIT_TEST(testTdf134210CropPosition);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -3328,8 +3328,9 @@ void SdImportTest::testMirroredGraphic()
     xDocShRef->DoClose();
 }
 
-void SdImportTest::testCropPositionGraphic()
+void SdImportTest::testTdf134210CropPosition()
 {
+    // We are testing crop position of bitmap in custom shapes. We should see only green with proper fix.
     sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/crop-position.pptx"), PPTX);
     uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_SET_THROW);
     CPPUNIT_ASSERT(xShape.is());
@@ -3338,7 +3339,7 @@ void SdImportTest::testCropPositionGraphic()
     CPPUNIT_ASSERT(xGraphic.is());
     Graphic aGraphic(xGraphic);
     BitmapEx aBitmap(aGraphic.GetBitmapEx());
-    CPPUNIT_ASSERT_EQUAL( Color(8682893), aBitmap.GetPixelColor( 0, 0 ));
+    CPPUNIT_ASSERT_EQUAL( Color(8508442), aBitmap.GetPixelColor( 0, 0 ));
     xDocShRef->DoClose();
 }
 


More information about the Libreoffice-commits mailing list