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

Pallavi Jadhav pallavi.jadhav at synerzip.com
Fri Nov 15 08:24:05 PST 2013


 sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx              |   23 +++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 85ff539bb1b6fa90c16f80e44df5df0962521f72
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Fri Nov 15 16:49:31 2013 +0530

    Added Unit test for PNG Crop image in Export.
    
    Reviewed on:
    	https://gerrit.libreoffice.org/6677
    
    Change-Id: I766460915775791388850691b3b940fe32190052

diff --git a/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx b/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx
new file mode 100644
index 0000000..7fda321
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b7bdaef..d182180 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -94,7 +94,8 @@ protected:
             "math-escape.docx",
             "math-mso2k7.docx",
             "ImageCrop.docx",
-            "test_GIF_ImageCrop.docx"
+            "test_GIF_ImageCrop.docx",
+            "test_PNG_ImageCrop.docx"
         };
         std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
 
@@ -1857,6 +1858,26 @@ DECLARE_OOXML_TEST(testGIFImageCrop, "test_GIF_ImageCrop.docx")
     CPPUNIT_ASSERT_EQUAL( sal_Int32( 1448 ), aGraphicCropStruct.Bottom );
 }
 
+DECLARE_OOXML_TEST(testPNGImageCrop, "test_PNG_ImageCrop.docx")
+{
+    /* The problem was image cropping information was not getting saved
+     * after roundtrip.
+     * Check for presenece of cropping parameters in exported file.
+     */
+    uno::Reference<drawing::XShape> image = getShape(1);
+    uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY);
+    ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+    imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
+
+    // FIXME import test is disabled (we only check after import-export-import)
+    // The reason is that after import this is 1141 -- why?
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( 1231 ), aGraphicCropStruct.Left );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( 1295 ), aGraphicCropStruct.Right );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( 1358 ), aGraphicCropStruct.Top );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( 737 ), aGraphicCropStruct.Bottom );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list