summaryrefslogtreecommitdiff
path: root/xmloff/qa
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-06-01 19:01:00 +0200
committerRegina Henschel <rb.henschel@t-online.de>2023-06-02 12:35:24 +0200
commit8aa623714fd36cf8303ab3bdef0f26db7e69a07c (patch)
tree313c72191d84e8ed0e97ba065f1381dcd72babd5 /xmloff/qa
parent920e76f15b78398de62002e30002f4f8e0fee7c1 (diff)
MCGR: Use tryToRecreateBorder too for transparency
This is similar to 'Use tryToRecreateBorder for better BW comp with LO' (see commit 8259a99f41367a1d8326c9157fe1902915715879), but now for transparency gradients. Change-Id: I1c2e11562fa998c364896d517f4ed3bfe92f6c15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152508 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'xmloff/qa')
-rw-r--r--xmloff/qa/unit/data/MCGR_TransparencyBorder_restoration.pptxbin0 -> 15436 bytes
-rw-r--r--xmloff/qa/unit/style.cxx37
2 files changed, 37 insertions, 0 deletions
diff --git a/xmloff/qa/unit/data/MCGR_TransparencyBorder_restoration.pptx b/xmloff/qa/unit/data/MCGR_TransparencyBorder_restoration.pptx
new file mode 100644
index 000000000000..f32c4d5e2b21
--- /dev/null
+++ b/xmloff/qa/unit/data/MCGR_TransparencyBorder_restoration.pptx
Binary files differ
diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx
index f4b7f8f08012..3c5c050c0226 100644
--- a/xmloff/qa/unit/style.cxx
+++ b/xmloff/qa/unit/style.cxx
@@ -553,6 +553,43 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBorderRestoration)
SetODFDefaultVersion(nCurrentODFVersion);
}
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testTransparencyBorderRestoration)
+{
+ // Load document. It has a shape with transparency gradient build from transparency 100% at
+ // offset 0, transparency 100% at offset 0.4 and transparency 10% at offset 1.0. For better
+ // backward compatibility such gradient is exported with a border of 40% in the transparency
+ // gradient. The color itself is the same for all gradient stops.
+ // When transparency gradient-stops are integrated in ODF strict, the test needs to be adapted.
+ loadFromURL(u"MCGR_TransparencyBorder_restoration.pptx");
+
+ // Backup original ODF default version
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion());
+
+ // Save to ODF_LATEST which is currently ODF 1.3 extended. Make sure transparency gradient-stop
+ //elements are written with offset 0 and 1, and border is written as 40%.
+ SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_LATEST);
+ save("impress8");
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+ OString sPath = "/office:document-styles/office:styles/draw:opacity[1]";
+ assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "stop-opacity", "0.9");
+ assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[2]", "offset", "1");
+ assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "stop-opacity", "0");
+ assertXPath(pXmlDoc, sPath + "/loext:opacity-stop[1]", "offset", "0");
+ assertXPath(pXmlDoc, sPath, "border", "40%");
+
+ // Save to ODF 1.3 strict and make sure border, start and end opacity are suitable set.
+ SetODFDefaultVersion(SvtSaveOptions::ODFDefaultVersion::ODFVER_013);
+ save("impress8");
+ pXmlDoc = parseExport("styles.xml");
+ assertXPath(pXmlDoc, sPath + "/loext:opacity-stop", 0);
+ assertXPath(pXmlDoc, sPath, "start", "0%");
+ assertXPath(pXmlDoc, sPath, "end", "90%");
+ assertXPath(pXmlDoc, sPath, "border", "40%");
+
+ // Set back to original ODF default version.
+ SetODFDefaultVersion(nCurrentODFVersion);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */