summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2018-07-20 17:21:43 +0200
committerAndras Timar <andras.timar@collabora.com>2018-08-10 10:21:05 +0200
commitbfa0e40e2e7182928f354ce0bfaa11152080ad5b (patch)
tree45065763b2d25005dd255d4008af52228331e2d7 /sd
parent3ffca217ac7f66eddf3f88444d33241a635e60f3 (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>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/tdf116350-texteffects.pptxbin0 -> 38359 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx51
2 files changed, 50 insertions, 1 deletions
diff --git a/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx
new file mode 100644
index 000000000000..52a3fe000a9b
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf116350-texteffects.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 310b6e6c9d22..fb5f99ddc21a 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>
@@ -137,7 +138,7 @@ public:
void testTdf90627();
void testTdf104786();
void testTdf104789();
-
+ void testTdf116350TextEffects();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -199,6 +200,7 @@ public:
CPPUNIT_TEST(testTdf90627);
CPPUNIT_TEST(testTdf104786);
CPPUNIT_TEST(testTdf104789);
+ CPPUNIT_TEST(testTdf116350TextEffects);
CPPUNIT_TEST_SUITE_END();
@@ -1570,6 +1572,53 @@ void SdOOXMLExportTest2::testTdf104789()
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();