diff options
-rw-r--r-- | oox/source/drawingml/shape.cxx | 13 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/tdf122717.docx | bin | 0 -> 4940 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 |
3 files changed, 23 insertions, 3 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index bc2d7b59f1d8..819d117d4fa9 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -856,10 +856,17 @@ Reference< XShape > const & Shape::createAndInsert( uno::Reference<lang::XServiceInfo> xModelInfo(rFilterBase.getModel(), uno::UNO_QUERY); for( i = 0; i < nNumPoints; ++i ) { - const basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); + basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); - // tdf#106792 Not needed anymore due to the change in SdrPathObj::NbcResize: - // tdf#96674: Guard against zero width or height. + // Guard against zero width or height. + if (i) + { + const basegfx::B2DPoint& rPreviousPoint = aPoly.getB2DPoint(i - 1); + if (aPoint.getX() - rPreviousPoint.getX() == 0) + aPoint.setX(aPoint.getX() + 1); + if (aPoint.getY() - rPreviousPoint.getY() == 0) + aPoint.setY(aPoint.getY() + 1); + } pPoints[i] = awt::Point(static_cast<sal_Int32>(aPoint.getX()), static_cast<sal_Int32>(aPoint.getY())); } diff --git a/sw/qa/extras/ooxmlimport/data/tdf122717.docx b/sw/qa/extras/ooxmlimport/data/tdf122717.docx Binary files differnew file mode 100644 index 000000000000..9a2098272c75 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/tdf122717.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b8f725a9d109..216fb0de07c0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1429,6 +1429,19 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx") CPPUNIT_ASSERT(aActualSize.Height > 0); } +DECLARE_OOXMLIMPORT_TEST(testTdf122717, "tdf122717.docx") +{ + uno::Reference<drawing::XShape> xShape = getShape(1); + CPPUNIT_ASSERT(xShape.is()); + awt::Size aActualSize(xShape->getSize()); + // Without the fix in place, this test would have failed with + // - Expected: 2 + // - Actual : 8160 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aActualSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8160), aActualSize.Height); + +} + DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx") { sal_Int32 nFlyHeight = parseDump("//fly/infos/bounds", "height").toInt32(); |