summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2013-11-15 16:49:31 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-11-15 17:23:42 +0100
commit85ff539bb1b6fa90c16f80e44df5df0962521f72 (patch)
tree2b7dd52c286264aca1b0334168f61f7b8d398956 /sw
parent93a23d1148381871c4ed15117c9e24cb3780b9f5 (diff)
Added Unit test for PNG Crop image in Export.
Reviewed on: https://gerrit.libreoffice.org/6677 Change-Id: I766460915775791388850691b3b940fe32190052
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docxbin0 -> 57502 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx23
2 files changed, 22 insertions, 1 deletions
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 000000000000..7fda32144d69
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b7bdaef0f95f..d182180579b5 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();