diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-01 17:51:11 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-01 16:52:52 +0100 |
commit | af843af4c816ef25246c815e187729ec25b2f000 (patch) | |
tree | 33d1d43ca64face4f0fb9e8668e7437776c6c44e /sd | |
parent | 70769fc81e57d9ba84aa0c4e4dfc0b30a6cd273d (diff) |
tdf#121844: properly implement autoTxRot support
... after commit cf7b97d1328ec2f2c8254abb9ce67d63d9c54c80
Change-Id: If46265f49a85d92254fedb719d76ff7319c092cc
Reviewed-on: https://gerrit.libreoffice.org/64396
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-autoTxRot.pptx | bin | 0 -> 58937 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 91 |
2 files changed, 91 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-autoTxRot.pptx b/sd/qa/unit/data/pptx/smartart-autoTxRot.pptx Binary files differnew file mode 100644 index 000000000000..30e69a6de6c1 --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-autoTxRot.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index fe24ff486fa3..1f30ba36e394 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -28,6 +28,7 @@ public: void testDir(); void testMaxDepth(); void testRotation(); + void testTextAutoRotation(); void testPyramid(); void testChevron(); void testCycle(); @@ -56,6 +57,7 @@ public: CPPUNIT_TEST(testDir); CPPUNIT_TEST(testMaxDepth); CPPUNIT_TEST(testRotation); + CPPUNIT_TEST(testTextAutoRotation); CPPUNIT_TEST(testPyramid); CPPUNIT_TEST(testChevron); CPPUNIT_TEST(testCycle); @@ -240,6 +242,95 @@ void SdImportTestSmartArt::testRotation() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testTextAutoRotation() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-autoTxRot.pptx"), PPTX); + + auto testText = [&](int pageNo, sal_Int32 txtNo, const OUString& expTx, sal_Int32 expShRot, + sal_Int32 expTxRot) { + OString msgText = "Page: " + OString::number(pageNo) + " text: " + OString::number(txtNo); + uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, pageNo, xDocShRef), + uno::UNO_QUERY_THROW); + + uno::Reference<text::XText> xTxt(xShapeGroup->getByIndex(txtNo), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgText.getStr(), expTx, xTxt->getString()); + uno::Reference<beans::XPropertySet> xTxtProps(xTxt, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgText.getStr(), expShRot, + xTxtProps->getPropertyValue("RotateAngle").get<sal_Int32>()); + + auto aGeomPropSeq = xTxtProps->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq); + + auto it = aCustomShapeGeometry.find("TextPreRotateAngle"); + if (it == aCustomShapeGeometry.end()) + { + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgText.getStr(), sal_Int32(0), expTxRot); + } + else + { + CPPUNIT_ASSERT_EQUAL_MESSAGE(msgText.getStr(), expTxRot, it->second.get<sal_Int32>()); + } + }; + + // Slide 1: absent autoTxRot => defaults to "upr" + testText(0, 0, "a", 0, 0); + testText(0, 1, "b", 33750, 0); + testText(0, 2, "c", 31500, 0); + testText(0, 3, "d", 29250, 90); + testText(0, 4, "e", 27000, 90); + testText(0, 5, "f", 24750, 90); + testText(0, 6, "g", 22500, 180); + testText(0, 7, "h", 20250, 180); + testText(0, 8, "i", 18000, 180); + testText(0, 9, "j", 15750, 180); + testText(0, 10, "k", 13500, 180); + testText(0, 11, "l", 11250, 270); + testText(0, 12, "m", 9000, 270); + testText(0, 13, "n", 6750, 270); + testText(0, 14, "o", 4500, 0); + testText(0, 15, "p", 2250, 0); + + // Slide 2: autoTxRot == "none" + testText(1, 0, "a", 0, 0); + testText(1, 1, "b", 33750, 0); + testText(1, 2, "c", 31500, 0); + testText(1, 3, "d", 29250, 0); + testText(1, 4, "e", 27000, 0); + testText(1, 5, "f", 24750, 0); + testText(1, 6, "g", 22500, 0); + testText(1, 7, "h", 20250, 0); + testText(1, 8, "i", 18000, 0); + testText(1, 9, "j", 15750, 0); + testText(1, 10, "k", 13500, 0); + testText(1, 11, "l", 11250, 0); + testText(1, 12, "m", 9000, 0); + testText(1, 13, "n", 6750, 0); + testText(1, 14, "o", 4500, 0); + testText(1, 15, "p", 2250, 0); + + // Slide 3: autoTxRot == "grav" + testText(2, 0, "a", 0, 0); + testText(2, 1, "b", 33750, 0); + testText(2, 2, "c", 31500, 0); + testText(2, 3, "d", 29250, 0); + testText(2, 4, "e", 27000, 0); + testText(2, 5, "f", 24750, 180); + testText(2, 6, "g", 22500, 180); + testText(2, 7, "h", 20250, 180); + testText(2, 8, "i", 18000, 180); + testText(2, 9, "j", 15750, 180); + testText(2, 10, "k", 13500, 180); + testText(2, 11, "l", 11250, 180); + testText(2, 12, "m", 9000, 0); + testText(2, 13, "n", 6750, 0); + testText(2, 14, "o", 4500, 0); + testText(2, 15, "p", 2250, 0); + + xDocShRef->DoClose(); +} + void SdImportTestSmartArt::testBasicProcess() { //FIXME : so far this only introduce the test document, but the actual importer was not fixed yet. |