summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-03-18 00:48:49 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-03-18 09:15:32 +0100
commitc9e5640c8fcad7beb42a66f9bee0252eee9fe323 (patch)
tree4d773e9e48124bb5f4a9147568ab2ed9c265d1aa /sw
parentc08271500f6a13e80f739e2609b86ca8351f681e (diff)
tdf#118693: no need to use convertMm100ToTwip() for line shapes anymore
It was introduced in 11129d89b152db54c86bb2bda58c24b8abb6c5a8 < tdf#85232 WPG import: fix handling of line shapes > and later in 36bade04d3780bc54c51b46bb0b63e69789658a5 < tdf106792 Get rid of SvxShapePolyPolygonBezier > ForceMetricToItemPoolMetric was added to SvxShapePolyPolygon::setPropertyValueImpl to convert from 100thmm to twips as can be read in the comment in testTdf85232 With this change, xShape->getPosition().X in testTdf85232 is 2267, which was already in twips Change-Id: I30b757885327a477213f96f8f84541971f435164 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112663 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf118693.docxbin0 -> 26072 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx12
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx37
3 files changed, 39 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf118693.docx b/sw/qa/extras/ooxmlimport/data/tdf118693.docx
new file mode 100644
index 000000000000..4e832398bcd5
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf118693.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 16351d9fcb35..8163c0c10377 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1346,16 +1346,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf85232, "tdf85232.docx")
// Make sure we're not testing the ellipse child.
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), xShapeDescriptor->getShapeType());
- // tdf#106792 checked that during load of tdf85232.docx the method
- // SvxShapePolyPolygon::setPropertyValueImpl is used three times. In
- // that method, a call to ForceMetricToItemPoolMetric was missing so
- // that the import did not convert the input values from 100thmm
- // to twips what is needed due to the object residing in Writer. The
- // UNO API by definition is in 100thmm. Result is that in SwXShape::getPosition
- // the offset (aOffset) now is (0, 0) instead of an existing offset in
- // the load of the document before (what is plausible for a GroupObject).
- // Thus, I will adapt the result value here to the now (hopefully) correct one.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1630), xShape->getPosition().X); // was: 2267
+ // This was 2900: horizontal position of the line was incorrect, the 3 children were not connected visually.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2267), xShape->getPosition().X);
}
DECLARE_OOXMLIMPORT_TEST(testTdf95755, "tdf95755.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 474cfbe2b13d..fcfaccafb774 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -196,6 +196,43 @@ DECLARE_OOXMLIMPORT_TEST(testTdf120547, "tdf120547.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(8073), aSizeShape3.Height);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf118693, "tdf118693.docx")
+{
+ uno::Reference<drawing::XShape> xGroupShape = getShape(1);
+ uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xGroup->getCount());
+
+ awt::Point aPosGroup = xGroupShape->getPosition();
+ awt::Size aSizeGroup = xGroupShape->getSize();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosGroup.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosGroup.Y);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6369), aSizeGroup.Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4983), aSizeGroup.Height);
+
+ // Without the fix in place, this test would have failed at many places
+ // as the first shape in the group would have had an incorrect position,
+ // an incorrect width or an incorrect height.
+
+ uno::Reference<drawing::XShape> xShape1(xGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+ awt::Point aPosShape1 = xShape1->getPosition();
+ awt::Size aSizeShape1 = xShape1->getSize();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(12863), aPosShape1.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(146), aPosShape1.Y);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3669), aSizeShape1.Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4914), aSizeShape1.Height);
+
+ uno::Reference<drawing::XShape> xShape2(xGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+ awt::Point aPosShape2 = xShape2->getPosition();
+ awt::Size aSizeShape2 = xShape2->getSize();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosShape2.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosShape2.Y);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4595), aSizeShape2.Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4983), aSizeShape2.Height);
+}
+
DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx")
{
// Font names inside a group shape were not imported