summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-26 17:52:27 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-04-26 18:35:56 +0200
commit1b471124df251011b0053900cb82ceb0f3d8be86 (patch)
treed2a6a2abc6c6d57b26b43d74a88ef1dd15293ec3 /sw
parentad6515f48ced36ab9d10840aa60670fc41d25c6b (diff)
tdf#107392 ODF import: fix z-order sorting of SVG images
The problem was that in case the document has shapes where the order does not match the z-index order, so sorting is needed, then sorting failed to take the multi-image feature into account. E.g. SVG images have a PNG fallback, but at the end of the shape import the PNG fallback is removed, which means the "actual" (not the "wished") z-index of the shapes after the SVG image has to be adjusted. Without this happening SvxDrawPage::getByIndex() (or in case of Writer, SwTextBoxHelper::getByIndex()) will throw when the importer calls getByIndex(3) but we only have 3 shapes. This results in not honoring the z-index request of the remaining shapes. Regression from commit 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70 (re-base on ALv2 code. Includes (at least) relevant parts of:, 2012-10-09), from the Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement http://svn.apache.org/viewvc?view=revision&revision=1220836 part. Change-Id: Ibe880e5c6c74b728b4a760498720ee31f052b726 Reviewed-on: https://gerrit.libreoffice.org/36998 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/odfimport/data/tdf107392.odtbin0 -> 43338 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx12
2 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/data/tdf107392.odt b/sw/qa/extras/odfimport/data/tdf107392.odt
new file mode 100644
index 000000000000..c8a05a9eef94
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf107392.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 9572e7f4dba4..ce4a69b7b369 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -772,5 +772,17 @@ DECLARE_ODFIMPORT_TEST(testTdf101729, "tdf101729.odt")
CPPUNIT_ASSERT( x < l + 3 * w / 4);
}
+DECLARE_ODFIMPORT_TEST(testTdf107392, "tdf107392.odt")
+{
+ // Shapes from bottom to top were Frame, SVG, Bitmap, i.e. in the order as
+ // they appeared in the document, not according to their requested z-index,
+ // as sorting failed.
+ // So instead of 0, 1, 2 these were 2, 0, 1.
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getShapeByName("Bitmap"), "ZOrder"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(getShapeByName("Frame"), "ZOrder"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(getShapeByName("SVG"), "ZOrder"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */