/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// glue points export // without the fix in place, this test would have failed with // - Expected: "*/ 690465 w 2407298" // - Actual : "*/ 1917.97586131837 w 5236"
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:gdLst/a:gd[5]", "name",
u"GluePoint1X");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:gdLst/a:gd[5]", "fmla",
u"*/ 690465 w 2407298");
// without the fix in place, this test would have failed with // - Expected: "*/ 802433 h 1884784" // - Actual : "*/ 2229.18869642357 h 6687"
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:gdLst/a:gd[6]", "name",
u"GluePoint1Y");
assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:gdLst/a:gd[6]", "fmla",
u"*/ 802433 h 1884784");
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf165262)
{
createSdImpressDoc("ppt/tdf165262.ppt");
save(u"Impress Office Open XML"_ustr);
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf147586)
{
createSdImpressDoc("pptx/tdf147586.pptx");
save(u"Impress Office Open XML"_ustr);
xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/slides/slide1.xml"_ustr); // Without the fix in place, this test would have failed with // - Expected: 227fc7 // - Actual : 4f4f4f
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[1]/a:pPr/a:buClr/a:srgbClr", "val",
u"227fc7");
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[2]/a:pPr/a:buClr/a:srgbClr", "val",
u"227fc7");
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf68759)
{
createSdImpressDoc("odp/tdf68759.odp");
save(u"Impress Office Open XML"_ustr);
// Text in a legacy rectangle
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1); // Text in (closed) Polygon
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1); // Text in a legacy ellipse
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr/a:noAutofit", 1);
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf115394)
{
createSdImpressDoc("pptx/tdf115394.pptx");
save(u"Impress Office Open XML"_ustr);
// Slow in MS formats
SdPage* pPage1 = pDoc->GetSdPage(0, PageKind::Standard);
fTransitionDuration = pPage1->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration);
// Medium in MS formats
SdPage* pPage2 = pDoc->GetSdPage(1, PageKind::Standard);
fTransitionDuration = pPage2->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration);
// Fast in MS formats
SdPage* pPage3 = pDoc->GetSdPage(2, PageKind::Standard);
fTransitionDuration = pPage3->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration);
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
// check that the document contains original vector images const uno::Sequence<OUString> names = xNameAccess->getElementNames(); int nSVMFiles = 0; for (OUString const& s : names)
{ if (s.endsWith(".svm"))
nSVMFiles++;
}
CPPUNIT_ASSERT_EQUAL(3, nSVMFiles);
}
int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages)
{
createSdImpressDoc("odp/tdf115005_no_fallback_images.odp");
// check if fallback images were not created if AddReplacementImages=true/false // set AddReplacementImages
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(
comphelper::ConfigurationChanges::create()); if (!officecfg::Office::Common::Save::Graphic::AddReplacementImages::isReadOnly())
officecfg::Office::Common::Save::Graphic::AddReplacementImages::set(
bAddReplacementImages, batch);
batch->commit();
}
// save the file with already set options
save(u"impress8"_ustr);
// additional checks of the output file
uno::Reference<packages::zip::XZipFileAccess2> xNameAccess
= packages::zip::ZipFileAccess::createWithURL(m_xContext, maTempFile.GetURL());
// check that the document contains original vector images const uno::Sequence<OUString> names = xNameAccess->getElementNames(); int nSVMFiles = 0; int nPNGFiles = 0; for (OUString const& n : names)
{ if (n.endsWith(".svm"))
nSVMFiles++; if (n.endsWith(".png") && n != "Thumbnails/thumbnail.png") // Ignore the thumbnail
nPNGFiles++;
}
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone"); // Before the fix, that tag was missing so PP put bullet to each para.
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testZeroIndentExport)
{ // Load the bugdoc and save to pptx then.
createSdImpressDoc("odp/testZeroIndent.odp");
save(u"Impress Office Open XML"_ustr); // There are 3 slides, get them
xmlDocUniquePtr pSlide1 = parseExport(u"ppt/slides/slide1.xml"_ustr);
xmlDocUniquePtr pSlide2 = parseExport(u"ppt/slides/slide2.xml"_ustr);
xmlDocUniquePtr pSlide3 = parseExport(u"ppt/slides/slide3.xml"_ustr);
// Each slide has 3 paragraphs, one full line, an empty and a normal para. // Check the indent and bullet. These have to match with PP. Before the fix, // they were different.
assertXPath(pSlide1, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone");
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf100348_convert_Fontwork2TextWarp)
{
createSdImpressDoc("odp/tdf100348_Fontwork2TextWarp.odp");
save(u"Impress Office Open XML"_ustr);
// Resulting pptx has to contain the TextWarp shape
xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/slides/slide1.xml"_ustr); static constexpr OString sPathStart( "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:prstTxWarp"_ostr);
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)); auto aGeomPropSeq = xShapeWavePropSet->getPropertyValue(u"CustomShapeGeometry"_ustr)
.get<uno::Sequence<beans::PropertyValue>>(); auto aGeomPropVec
= comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq);
OUString sName = u"TextPath"_ustr; 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(u"fontwork-wave"_ustr, 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);
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf125573_FontWorkScaleX)
{
createSdImpressDoc("pptx/tdf125573_FontWorkScaleX.pptx");
save(u"Impress Office Open XML"_ustr);
// Error was, that attribute 'fromWordArt' was ignored // ensure, resulting pptx has fromWordArt="1" on textArchDown shape
xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/slides/slide1.xml"_ustr);
assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr[@fromWordArt='1']");
// Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path.
uno::Reference<beans::XPropertySet> xShapeArchProps(getShapeFromPage(0, 0));
awt::Rectangle aBoundRectArch;
xShapeArchProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectArch; // BoundRect is DPI dependent, thus allow some range. // Expected width is 13139 in 96dpi and is 13106 in 120 dpi, for example // (Without fix Expected less than: 85 Actual : 10432)
CPPUNIT_ASSERT_LESS(sal_Int32(85), std::abs(aBoundRectArch.Width - 13145));
// Error was, that text in shapes of category "Warp" was not scaled to the path.
uno::Reference<beans::XPropertySet> xShapeWaveProps(getShapeFromPage(0, 1));
awt::Rectangle aBoundRectWave;
xShapeWaveProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRectWave; // BoundRect is DPI dependent, thus allow some range. // Expected with is 11576 in 96dpt and is 11578 in 120dpi, for example
CPPUNIT_ASSERT_LESS(sal_Int32(85), std::abs(aBoundRectWave.Width - 11576));
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf99497_keepAppearanceOfCircleKind)
{ // Error was, that all CircleKind were exported to 'ellipse'. // Resulting pptx has to contain the customshapes of the corresponding kind // slide 1 ARC -> arc, slide 2 CUT -> chord, slide 3 SECTION -> pie // Adjustment values need to exist and their values need to correspond to the // original angles. Shape 'arc' needs to be unfilled.
createSdImpressDoc("odp/tdf99497_CircleKind.odp");
save(u"Impress Office Open XML"_ustr);
auto aGeomPropSeq = xSet->getPropertyValue(u"CustomShapeGeometry"_ustr)
.get<uno::Sequence<beans::PropertyValue>>(); auto aGeomPropVec
= comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq);
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf99213)
{
createSdImpressDoc("odp/tdf99213-target-missing.odp");
save(u"Impress Office Open XML"_ustr);
xmlDocUniquePtr pXmlDocContent = parseExport(u"ppt/slides/slide1.xml"_ustr); // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl
assertXPath(pXmlDocContent, "//p:attrNameLst", 2); // Timenode that miss its target element should be filtered.
assertXPath(pXmlDocContent, "//p:attrNameLst/preceding-sibling::p:tgtEl", 2);
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testPotxExport)
{ // Create new document
createSdImpressDoc();
// Export as a POTM template
save(u"Impress Office Open XML Template"_ustr);
// Load and check content type
xmlDocUniquePtr pContentTypes = parseExport(u"[Content_Types].xml"_ustr);
CPPUNIT_ASSERT(pContentTypes);
assertXPath(pContentTypes, "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", "ContentType",
u"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");
}
CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf44223)
{
createSdImpressDoc("pptx/tdf44223.pptx");
save(u"Impress Office Open XML"_ustr);
// tdf#124230 all nodes were under p:childTnLst, but event triggered nodes need // to be under p:subTnLst, especially for audio to work correctly. // Start condition: 0s after timenode id 5 begins.
assertXPath(pDoc1, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt",
u"begin");
assertXPath(pDoc1, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", u"0");
assertXPath(pDoc1, "//p:subTnLst/p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond/p:tn", "val",
u"5");
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.22Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.