diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2019-06-19 22:04:42 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2019-06-20 17:01:46 +0200 |
commit | a4d30a3809c5bf973d39c5e4368a1276582b04b3 (patch) | |
tree | c053360a63085b8255af1d1da892a78c701ea655 /sd/qa | |
parent | 87e2095eae2b4345363042584e11e45339a606fa (diff) |
tdf#100348 unittest Convert Fontwork to TextWarp on export
The test is only about odp->pptx->odp, because import of TextWarp
inside docx is still broken (tdf#125884).
Change-Id: I541904a1b3adf08d7d574fe2079259dbb8502eaa
Reviewed-on: https://gerrit.libreoffice.org/74379
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Tested-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp | bin | 0 -> 14788 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 59 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp b/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp Binary files differnew file mode 100644 index 000000000000..9df8d6615f3e --- /dev/null +++ b/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6bee011d6ada..9305c0122343 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -183,6 +184,7 @@ public: void testTdf115005_FallBack_Images_Off(); void testTdf118806(); void testTdf111789(); + void testTdf100348_convert_Fontwork2TextWarp(); /// SmartArt animated elements void testTdf104792(); void testTdf90627(); @@ -272,6 +274,7 @@ public: CPPUNIT_TEST(testTdf115005_FallBack_Images_Off); CPPUNIT_TEST(testTdf118806); CPPUNIT_TEST(testTdf111789); + CPPUNIT_TEST(testTdf100348_convert_Fontwork2TextWarp); CPPUNIT_TEST(testTdf104792); CPPUNIT_TEST(testTdf90627); CPPUNIT_TEST(testTdf104786); @@ -2336,6 +2339,62 @@ void SdOOXMLExportTest2::testTdf125551() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8587), xShapeBg->getSize().Height); } +void SdOOXMLExportTest2::testTdf100348_convert_Fontwork2TextWarp() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + // Resulting pptx has to contain the TextWarp shape + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp"); + assertXPath(pXmlDocContent, sPathStart + "[@prst='textWave1']"); + const OString sPathAdj(sPathStart + "/a:avLst/a:gd"); + assertXPath(pXmlDocContent, sPathAdj + "[@name='adj1' and @fmla='val 18750']"); + assertXPath(pXmlDocContent, sPathAdj + "[@name='adj2' and @fmla='val -7500']"); + + // Reloading has to get the Fontwork shape back + // TextPath makes a custom shape to a Fontwork shape, so must exist + uno::Reference<beans::XPropertySet> xShapeWavePropSet(getShapeFromPage(0, 0, xDocShRef)); + auto aGeomPropSeq = xShapeWavePropSet->getPropertyValue("CustomShapeGeometry") + .get<uno::Sequence<beans::PropertyValue>>(); + auto aGeomPropVec + = comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq); + OUString sName = "TextPath"; + auto aIterator = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; }); + CPPUNIT_ASSERT_MESSAGE("No TextPath", aIterator != aGeomPropVec.end()); + + // Type has to be same as in original document on roundtrip. + sName = "Type"; + auto aIterator2 = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; }); + CPPUNIT_ASSERT_MESSAGE("No Type", aIterator2 != aGeomPropVec.end()); + OUString sOwnName; + aIterator2->Value >>= sOwnName; + CPPUNIT_ASSERT_EQUAL(OUString("fontwork-wave"), sOwnName); + + // Adjustmentvalues need to be the same. + sName = "AdjustmentValues"; + auto aIterator3 = std::find_if( + aGeomPropVec.begin(), aGeomPropVec.end(), + [sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; }); + CPPUNIT_ASSERT_MESSAGE("No AdjustmentValues", aIterator3 != aGeomPropVec.end()); + uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjValueSeq; + aIterator3->Value >>= aAdjValueSeq; + double fAdj1; + aAdjValueSeq[0].Value >>= fAdj1; + double fAdj2; + aAdjValueSeq[1].Value >>= fAdj2; + CPPUNIT_ASSERT_EQUAL(4050.0, fAdj1); // odp values, not pptx values + CPPUNIT_ASSERT_EQUAL(9180.0, fAdj2); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |