summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-05-24 18:02:31 +0200
committerMichael Stahl <mstahl@redhat.com>2014-05-24 18:34:06 +0200
commit6d431ffb682d0e64b75b6267f369822ff0b0617e (patch)
treec2f5d1b184647bab407b393634703271d2002c53 /sw/qa
parenta0ef37c55febac05f19a2cece0552e68384e56aa (diff)
fdo#77454: fix WW8 import/export of negative image crop
The negative crop values were imported as large positive values, which caused the image to be rendered with 1 pixel width after commit 2e5167528f7566dd9b000e50fc1610b7bf99132a. Change-Id: I0e01b9d9a05d90e868699832085a06ba5aab7e54
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ww8export/data/fdo77454.docbin0 -> 11776 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx24
2 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/fdo77454.doc b/sw/qa/extras/ww8export/data/fdo77454.doc
new file mode 100644
index 000000000000..4e2d7b2ad20c
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/fdo77454.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index d014dba42491..585755969bf4 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -17,6 +17,7 @@
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/table/TableBorder2.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
class Test : public SwModelTestBase
{
@@ -150,6 +151,29 @@ DECLARE_WW8EXPORT_TEST(testCharacterBorder, "charborder.odt")
}
}
+DECLARE_WW8EXPORT_TEST(testFdo77454, "fdo77454.doc")
+{
+ {
+ // check negative crops round-trip
+ text::GraphicCrop const crop =
+ getProperty<text::GraphicCrop>(getShape(1), "GraphicCrop");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( -439), crop.Left);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-7040), crop.Right);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( -220), crop.Top);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-7040), crop.Bottom);
+ }
+
+ {
+ // check positive crops round-trip
+ text::GraphicCrop const crop =
+ getProperty<text::GraphicCrop>(getShape(2), "GraphicCrop");
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( 326), crop.Left);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32( 1208), crop.Right);
+ CPPUNIT_ASSERT(abs(sal_Int32(1635) - crop.Top) <= 2);
+ CPPUNIT_ASSERT(abs(sal_Int32( 95) - crop.Bottom) <= 2);
+ }
+}
+
DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc")
{
// See ooxmlexport's testFdo38244().