diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-07-20 17:21:43 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-08-20 10:12:58 +0200 |
commit | b56857dbd21083f5d41eaf4c0f08db1977cf8d2e (patch) | |
tree | ed6ed8824418409092f65625c2b312744955906b /sd | |
parent | 72fece73fbda7dc9fa34c4189cd9dfa10c9f2c51 (diff) |
tdf#116350 Import preset text geometry (text effects)
"Font effect" implementation, instead of normal
text, content is converted to "fontwork".
Change-Id: I5d02c7faedb66a4b919e64ae1b830bffb69984c1
Reviewed-on: https://gerrit.libreoffice.org/58358
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/58838
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf116350-texteffects.pptx | bin | 0 -> 38359 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 50 |
2 files changed, 50 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx Binary files differnew file mode 100644 index 000000000000..52a3fe000a9b --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 92258796d507..0607da45b22d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -10,6 +10,7 @@ #include "sdmodeltestbase.hxx" #include <Outliner.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/sequence.hxx> #include <svl/stritem.hxx> #include <editeng/editobj.hxx> #include <editeng/outlobj.hxx> @@ -144,6 +145,7 @@ public: void testTdf104786(); void testTdf104789(); void testOpenDocumentAsReadOnly(); + void testTdf116350TextEffects(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -211,6 +213,7 @@ public: CPPUNIT_TEST(testTdf104786); CPPUNIT_TEST(testTdf104789); CPPUNIT_TEST(testOpenDocumentAsReadOnly); + CPPUNIT_TEST(testTdf116350TextEffects); CPPUNIT_TEST_SUITE_END(); @@ -1689,6 +1692,53 @@ void SdOOXMLExportTest2::testOpenDocumentAsReadOnly() xDocShRef->DoClose(); } +static inline double getAdjustmentValue( uno::Reference<beans::XPropertySet>& xSet ) +{ + auto aGeomPropSeq = xSet->getPropertyValue( "CustomShapeGeometry" ) + .get<uno::Sequence<beans::PropertyValue>>(); + auto aGeomPropVec + = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>( + aGeomPropSeq ); + + const OUString sName = "AdjustmentValues"; + auto aIterator = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [sName]( const beans::PropertyValue& rValue ) { return rValue.Name == sName; } ); + + if (aIterator != aGeomPropVec.end()) + { + uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustment; + double fResult; + aIterator->Value >>= aAdjustment; + aAdjustment[0].Value >>= fResult; + return fResult; + } + + return -1.0; +} + +void SdOOXMLExportTest2::testTdf116350TextEffects() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf116350-texteffects.pptx" ), PPTX ); + + // Default angle for ArchUp + uno::Reference<beans::XPropertySet> xShape0( getShapeFromPage( 0, 0, xDocShRef ) ); + double fAdjust = getAdjustmentValue( xShape0 ); + CPPUNIT_ASSERT_EQUAL( 180.0, fAdjust ); + + // Default angle for ArchDown + uno::Reference<beans::XPropertySet> xShape14( getShapeFromPage( 14, 0, xDocShRef ) ); + fAdjust = getAdjustmentValue( xShape14 ); + CPPUNIT_ASSERT_EQUAL( 0.0, fAdjust ); + + // Angle directly set + uno::Reference<beans::XPropertySet> xShape1( getShapeFromPage( 1, 0, xDocShRef ) ); + fAdjust = getAdjustmentValue( xShape1 ); + CPPUNIT_ASSERT_EQUAL( 213.25, fAdjust ); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |