summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-03-08 19:02:13 +0100
committerRegina Henschel <rb.henschel@t-online.de>2019-03-14 13:30:41 +0100
commitb795e540e4c4d31618a16ca8456476d5651a4d01 (patch)
tree960c6aa717d48e7fa1658eed4d27e09572cf3c92 /sd
parentffcff2fe24ce1fd64b7c45073c09f6d5a5a5d51d (diff)
tdf#122899 use unsigned integer for mso_sptArc
The path coordinates were read as sal_Int16. But for a mso_sptArc shape the values are unsigned integer. I correct it for this shape type only, because I don't know, whether other places actually need sal_Int16. The change from 0xa504 to 0xa604 in the defaults means a change from 'ClockwiseArcTo' to 'ClockwiseArc' so that an implicit moveto is used, same as in VML command 'wr'. Change-Id: Ib9c594c15d5a97048595efd644a4a6e8774fcefd Reviewed-on: https://gerrit.libreoffice.org/68941 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.pptbin0 -> 8192 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt b/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt
new file mode 100644
index 000000000000..9df17e9a8085
--- /dev/null
+++ b/sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 58eb86f3a9fa..ef62c5bfecdc 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -25,6 +25,7 @@
#include <editeng/numitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/postitem.hxx>
+#include <editeng/unoprnms.hxx>
#include <svl/style.hxx>
#include <sfx2/sfxsids.hrc>
@@ -195,6 +196,7 @@ public:
void testDescriptionImport();
void testTdf83247();
void testTdf47365();
+ void testTdf122899();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -282,6 +284,7 @@ public:
CPPUNIT_TEST(testDescriptionImport);
CPPUNIT_TEST(testTdf83247);
CPPUNIT_TEST(testTdf47365);
+ CPPUNIT_TEST(testTdf122899);
CPPUNIT_TEST_SUITE_END();
};
@@ -2696,6 +2699,32 @@ void SdImportTest::testTdf47365()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf122899()
+{
+ // tdf122899 FILEOPEN: ppt: old kind arc from MS Office 97 is broken
+ // Error was, that the path coordinates of a mso_sptArc shape were read as sal_Int16
+ // although they are unsigned 16 bit. This leads to wrong positions of start and end
+ // point and results to a huge shape width in the test document.
+ OUString aSrc="sd/qa/unit/data/ppt/tdf122899_Arc_90_to_91_clockwise.ppt";
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(aSrc), PPT);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get XDrawPagesSupplier", xDrawPagesSupplier.is());
+ uno::Reference<drawing::XDrawPages> xDrawPages(xDrawPagesSupplier->getDrawPages());
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPages->getByIndex(0), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("Could not get xDrawPage", xDrawPage.is());
+ uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_MESSAGE("Could not get xShape", xShape.is());
+ awt::Rectangle aFrameRect;
+ uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is());
+ xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_FRAMERECT) >>= aFrameRect;
+ // original width is 9cm, add some tolerance
+ CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(9020), aFrameRect.Width);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();