[Libreoffice-commits] core.git: chart2/qa sd/qa

Regina Henschel (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 11 12:14:09 UTC 2020


 chart2/qa/extras/chart2geometry.cxx                          |  211 ++++++++++-
 chart2/qa/extras/data/pptx/tdf128345_ChartArea_CG_TS.pptx    |binary
 chart2/qa/extras/data/pptx/tdf128345_ChartWall_CS_TG.pptx    |binary
 chart2/qa/extras/data/pptx/tdf128345_Legend_CS_TG_axial.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx                           |  120 ------
 5 files changed, 193 insertions(+), 138 deletions(-)

New commits:
commit a6704e6dc53d64bc1442d337f7bfb8deb03f4145
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Mon Aug 10 23:26:54 2020 +0200
Commit:     Regina Henschel <rb.henschel at t-online.de>
CommitDate: Tue Aug 11 14:13:23 2020 +0200

    tdf#128345 Move unit tests from sd to chart2 and improve them
    
    a) The unit tests are about charts and therefore it is more natural to
    have them in module chart2.
    b) The file name of the chart in the pptx package is generated with a
    static counter. Therefore the name depends on whether there have
    been previous savings. Module chart2 has a method, that ignores the
    number and takes the first matching file. Using that makes the tests
    more stable and allows to fix the static counter without need to
    adjust the tests.
    c) I have put them into a new test suite, which I have started
    recently. The other test suites are already hudge.
    So this patch depends on commit
    74be8bb787a44464957e5d3105c8de6d36e81b4a
    d) I have made the paths in the tests independent of the naming
    conventions which LibreOffice uses for styles and definitions.
    e) I have split the tests in export and import.
    
    Change-Id: If68c6e8d1eea8470074b96fb2c9efdd9090264b0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100451
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>

diff --git a/chart2/qa/extras/chart2geometry.cxx b/chart2/qa/extras/chart2geometry.cxx
index dedfda6e1c24..cc4fc628612d 100644
--- a/chart2/qa/extras/chart2geometry.cxx
+++ b/chart2/qa/extras/chart2geometry.cxx
@@ -35,16 +35,29 @@ public:
         : ChartTest()
     {
     }
+    // Mostly tests for line and fill properties
     void testTdf135184RoundLineCap();
     void testTdf135184RoundLineCap2();
     void testTdf135184RoundLineCap3();
     void testTdf135184RoundLineCap4();
+    void testTdf128345ChartArea_CG_TS_export();
+    void testTdf128345ChartArea_CG_TS_import();
+    void testTdf128345ChartWall_CS_TG_export();
+    void testTdf128345ChartWall_CS_TG_import();
+    void testTdf128345Legend_CS_TG_axial_export();
+    void testTdf128345Legend_CS_TG_axial_import();
 
     CPPUNIT_TEST_SUITE(Chart2GeometryTest);
     CPPUNIT_TEST(testTdf135184RoundLineCap);
     CPPUNIT_TEST(testTdf135184RoundLineCap2);
     CPPUNIT_TEST(testTdf135184RoundLineCap3);
     CPPUNIT_TEST(testTdf135184RoundLineCap4);
+    CPPUNIT_TEST(testTdf128345ChartArea_CG_TS_export);
+    CPPUNIT_TEST(testTdf128345ChartArea_CG_TS_import);
+    CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_export);
+    CPPUNIT_TEST(testTdf128345ChartWall_CS_TG_import);
+    CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_export);
+    CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial_import);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -58,6 +71,10 @@ protected:
     xmlDocUniquePtr parseExport(const OUString& rDir, const OUString& rFilterFormat);
 };
 
+// This is copied from Chart2ExportTest. It allows to access the chart form a MS Office document
+// without knowing whether the file is a chart1.xml or chart2.xml... As of August 2020, Calc
+// and Impress use a static variable for the number and therefore the number depends on whether
+// there had already been savings before.
 namespace
 {
 struct CheckForChartName
@@ -115,24 +132,27 @@ void Chart2GeometryTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
     {
         char const* pPrefix;
         char const* pURI;
-    } const aNamespaces[]
-        = { { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
-            { "v", "urn:schemas-microsoft-com:vml" },
-            { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
-            { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
-            { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
-            { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
-            { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
-            { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
-            { "c15", "http://schemas.microsoft.com/office/drawing/2012/chart" },
-            { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
-            { "chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" },
-            { "style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" },
-            { "svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" },
-            { "table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" },
-            { "text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" },
-            { "xlink", "http://www.w3c.org/1999/xlink" },
-            { "c15", "http://schemas.microsoft.com/office/drawing/2012/chart" } };
+    } const aNamespaces[] = {
+        // OOXML
+        { "w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
+        { "v", "urn:schemas-microsoft-com:vml" },
+        { "c", "http://schemas.openxmlformats.org/drawingml/2006/chart" },
+        { "a", "http://schemas.openxmlformats.org/drawingml/2006/main" },
+        { "mc", "http://schemas.openxmlformats.org/markup-compatibility/2006" },
+        { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
+        { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
+        { "wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" },
+        { "c15", "http://schemas.microsoft.com/office/drawing/2012/chart" },
+        // ODF
+        { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
+        { "chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" },
+        { "draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" },
+        { "style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" },
+        { "svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" },
+        { "table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" },
+        { "text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" },
+        { "xlink", "http://www.w3c.org/1999/xlink" },
+    };
     for (size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
     {
         xmlXPathRegisterNs(pXmlXPathCtx, reinterpret_cast<xmlChar const*>(aNamespaces[i].pPrefix),
@@ -235,6 +255,161 @@ void Chart2GeometryTest::testTdf135184RoundLineCap4()
     assertXPath(pXmlDoc, sChartStart + "/c:title" + sDash, "val", "dashDot");
 }
 
+void Chart2GeometryTest::testTdf128345ChartArea_CG_TS_export()
+{
+    // chart area with color gradient and solid transparency
+    // Without the patch the transparency was lost in saved pptx file.
+    load("/chart2/qa/extras/data/odp/", "tdf128345_ChartArea_CG_TS.odp");
+
+    // Make sure the chart area has a transparency in gradient stops in saved pptx file.
+    xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    OString sPathStart("//c:chartSpace/c:spPr/a:gradFill");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2);
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "30000");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "30000");
+}
+
+void Chart2GeometryTest::testTdf128345ChartArea_CG_TS_import()
+{
+    // This works on the file, which was exported from file tdf128345_ChartArea_CG_TS.odp to pptx.
+    // It has gradient stops with identical transparency values.
+    // Make sure chart area has transparency when pptx document is opened and resaved as odp.
+    // As of Aug 2020, the import generates a transparency gradient. When import is changed to
+    // generate solid transparency, the test needs to be adapted.
+    load("/chart2/qa/extras/data/pptx/", "tdf128345_ChartArea_CG_TS.pptx");
+
+    // Find transparency gradient name
+    xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc);
+    const OString sChartPath(
+        "//office:document-content/office:body/office:chart/chart:chart/@chart:style-name");
+    const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
+    const OString sStylePath(
+        "//office:document-content/office:automatic-styles/style:style[@style:name='"
+        + OU2O(sOUChartStyleName) + "']");
+    assertXPath(pXmlDoc, sStylePath, 1);
+    assertXPath(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name", 1);
+    const OUString sOUOpacityName
+        = getXPathContent(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name");
+
+    // Verify the content of the opacity definition
+    xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc2);
+    const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
+    const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
+    const OString sStart(sOpacityPath + "[" + sAttribute);
+    assertXPath(pXmlDoc2, sStart + "]", 1);
+    assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:start='30%']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:end='30%']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:angle='30deg']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:border='20%']");
+}
+
+void Chart2GeometryTest::testTdf128345ChartWall_CS_TG_export()
+{
+    // chart wall with solid color and transparency gradient
+    // Without the patch the transparency was lost.
+    load("/chart2/qa/extras/data/odp/", "tdf128345_ChartWall_CS_TG.odp");
+
+    // Make sure the chart has a gradient with transparency in gradient stops in saved pptx file.
+    xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    OString sPathStart("//c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 2); //linear
+    // MS Office has opacity, so 100% transparency is val="0"
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "0");
+    // no element for 0% transparent
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", 0);
+}
+
+void Chart2GeometryTest::testTdf128345ChartWall_CS_TG_import()
+{
+    // This works on the file, which was exported from file tdf128345_ChartWall_CS_TG.odp to pptx.
+    // Make sure chart wall has transparency when pptx document is resaved as odp.
+    load("/chart2/qa/extras/data/pptx/", "tdf128345_ChartWall_CS_TG.pptx");
+
+    // Find transparency gradient name
+    xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc);
+    const OString sChartPath("//office:document-content/office:body/office:chart/chart:chart/"
+                             "chart:plot-area/chart:wall/@chart:style-name");
+    const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
+    const OString sStylePath(
+        "//office:document-content/office:automatic-styles/style:style[@style:name='"
+        + OU2O(sOUChartStyleName) + "']");
+    assertXPath(pXmlDoc, sStylePath, 1);
+    assertXPath(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name", 1);
+    const OUString sOUOpacityName
+        = getXPathContent(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name");
+
+    // Verify content of the opacity definition
+    xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc2);
+    const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
+    const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
+    const OString sStart(sOpacityPath + "[" + sAttribute);
+    assertXPath(pXmlDoc2, sStart + "]", 1);
+    assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:end='100%']");
+}
+
+void Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_export()
+{
+    // legend with solid color and transparency gradient
+    // Without the patch the transparency was lost.
+    load("/chart2/qa/extras/data/odp/", "tdf128345_Legend_CS_TG_axial.odp");
+
+    // Make sure the chart has a gradient with transparency in gradient stops in saved pptx file.
+    xmlDocUniquePtr pXmlDoc = parseExport("ppt/charts/chart", "Impress MS PowerPoint 2007 XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    OString sPathStart("//c:chartSpace/c:chart/c:legend/c:spPr/a:gradFill");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs", 3); // axial
+    // no element for 0% transparent
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 0);
+    // 100% transparent = opacity 0. It comes from "axial", therefor it is in the middle.
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "0");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]", "pos", "50000");
+    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[3]/a:srgbClr/a:alpha", 0);
+}
+
+void Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import()
+{
+    // This works on the file, which was exported from file tdf128345_Legend_CS_TG_axial.odp to pptx.
+    // Error was, that in case of axial not the middle value was taken but start and end value.
+    load("/chart2/qa/extras/data/pptx/", "tdf128345_Legend_CS_TG_axial.pptx");
+
+    // Find transparency gradient name
+    xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc);
+    const OString sChartPath("//office:document-content/office:body/office:chart/chart:chart/"
+                             "chart:legend/@chart:style-name");
+    const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
+    const OString sStylePath(
+        "//office:document-content/office:automatic-styles/style:style[@style:name='"
+        + OU2O(sOUChartStyleName) + "']");
+    assertXPath(pXmlDoc, sStylePath, 1);
+    assertXPath(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name", 1);
+    const OUString sOUOpacityName
+        = getXPathContent(pXmlDoc, sStylePath + "/style:graphic-properties/@draw:opacity-name");
+
+    // Verify content of the opacity definition
+    xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
+    CPPUNIT_ASSERT(pXmlDoc2);
+    const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
+    const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
+    const OString sStart(sOpacityPath + "[" + sAttribute);
+    assertXPath(pXmlDoc2, sStart + "]", 1);
+    assertXPath(pXmlDoc2, sStart + " and @draw:style='axial']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']");
+    assertXPath(pXmlDoc2, sStart + " and @draw:end='100%']");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2GeometryTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp b/chart2/qa/extras/data/odp/tdf128345_ChartArea_CG_TS.odp
similarity index 100%
rename from sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp
rename to chart2/qa/extras/data/odp/tdf128345_ChartArea_CG_TS.odp
diff --git a/sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp b/chart2/qa/extras/data/odp/tdf128345_ChartWall_CS_TG.odp
similarity index 100%
rename from sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp
rename to chart2/qa/extras/data/odp/tdf128345_ChartWall_CS_TG.odp
diff --git a/sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp b/chart2/qa/extras/data/odp/tdf128345_Legend_CS_TG_axial.odp
similarity index 100%
rename from sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp
rename to chart2/qa/extras/data/odp/tdf128345_Legend_CS_TG_axial.odp
diff --git a/chart2/qa/extras/data/pptx/tdf128345_ChartArea_CG_TS.pptx b/chart2/qa/extras/data/pptx/tdf128345_ChartArea_CG_TS.pptx
new file mode 100644
index 000000000000..986dbe0dfdaf
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf128345_ChartArea_CG_TS.pptx differ
diff --git a/chart2/qa/extras/data/pptx/tdf128345_ChartWall_CS_TG.pptx b/chart2/qa/extras/data/pptx/tdf128345_ChartWall_CS_TG.pptx
new file mode 100644
index 000000000000..63d126b78de1
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf128345_ChartWall_CS_TG.pptx differ
diff --git a/chart2/qa/extras/data/pptx/tdf128345_Legend_CS_TG_axial.pptx b/chart2/qa/extras/data/pptx/tdf128345_Legend_CS_TG_axial.pptx
new file mode 100644
index 000000000000..67e383cfb1c4
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf128345_Legend_CS_TG_axial.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 210337794ce9..f1b8bcca5b6d 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -98,9 +98,6 @@ public:
     void testTdf128345GradientRadial();
     void testTdf128345GradientAxial();
     void testTdf134969TransparencyOnColorGradient();
-    void testTdf128345ChartArea_CG_TS();
-    void testTdf128345Chart_CS_TG();
-    void testTdf128345Legend_CS_TG_axial();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
@@ -148,9 +145,6 @@ public:
     CPPUNIT_TEST(testTdf128345GradientRadial);
     CPPUNIT_TEST(testTdf128345GradientAxial);
     CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient);
-    CPPUNIT_TEST(testTdf128345ChartArea_CG_TS);
-    CPPUNIT_TEST(testTdf128345Chart_CS_TG);
-    CPPUNIT_TEST(testTdf128345Legend_CS_TG_axial);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -173,11 +167,6 @@ public:
             { "a14", "http://schemas.microsoft.com/office/drawing/2010/main" },
             { "wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" },
             { "wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" },
-            // ODF
-            { "office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" },
-            { "draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"},
-            { "style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" },
-            { "chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" },
         };
         for (size_t i = 0; i < SAL_N_ELEMENTS(namespaces); ++i)
         {
@@ -1241,115 +1230,6 @@ void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient()
     assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "60000");
 }
 
-void SdOOXMLExportTest1::testTdf128345ChartArea_CG_TS()
-{
-    // chart area with color gradient and solid transparency
-    // Without the patch the transparency was lost.
-    ::sd::DrawDocShellRef xDocShRef
-        = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp"), ODP);
-    utl::TempFile tempFile;
-    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
-    // Make sure the chart area has a transparency in gradient stops in saved file.
-    xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/charts/chart1.xml"); // <-- does not exists, is chart2.xml ??
-    OString sPathStart("//c:chartSpace/c:spPr/a:gradFill");
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs",2);
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "30000");
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "30000");
-
-    // Make sure chart area has transparency in the reloaded document. Currently transparency is
-    // always imported as gradient. Change test, when import creates solid transparency.
-    // I use the saved odp file for testing, because I don't know how to access the chart
-    // from the active document in a unit test.
-    utl::TempFile tempFile2;
-    xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile2);
-    xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile2, "Object 1/styles.xml");
-    sPathStart = "//office:document-styles/office:styles";
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:start='30%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:end='30%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:border='20%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:name='msTransGradient_20_1']");
-
-    xmlDocUniquePtr pXmlDoc3 = parseExport(tempFile2, "Object 1/content.xml");
-    sPathStart = "//office:document-content/office:automatic-styles/style:style[@style:name='ch1']";
-    assertXPath(pXmlDoc3, sPathStart + "/style:graphic-properties[@draw:opacity-name='msTransGradient_20_1']");
-    sPathStart = "//office:document-content/office:body/office:chart";
-    assertXPath(pXmlDoc3, sPathStart + "/chart:chart[@chart:style-name='ch1']");
-
-    xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest1::testTdf128345Chart_CS_TG()
-{
-    // chart with solid color and transparency gradient
-    // Without the patch the transparency was lost.
-    ::sd::DrawDocShellRef xDocShRef
-        = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp"), ODP);
-    utl::TempFile tempFile;
-    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
-    // Make sure the chart area has a transparency in gradient stops in saved file.
-    xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/charts/chart2.xml"); // <-- why not chart1.xml ??
-    OString sPathStart("//c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill");
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs",2); //linear
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "0"); // 100% transparent
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", 0); // no element for 0% transparent
-
-    // Make sure chart has transparency in the reloaded document.
-    // I use the saved odp file for testing, because I don't know how to access the chart
-    // from the active document in a unit test.
-    utl::TempFile tempFile2;
-    xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile2);
-    xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile2, "Object 1/styles.xml");
-    sPathStart = "//office:document-styles/office:styles";
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:style='linear']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:start='0%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:end='100%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:name='msTransGradient_20_1']");
-
-    xmlDocUniquePtr pXmlDoc3 = parseExport(tempFile2, "Object 1/content.xml");
-    sPathStart = "//office:document-content/office:automatic-styles/style:style[@style:name='ch8']";
-    assertXPath(pXmlDoc3, sPathStart + "/style:graphic-properties[@draw:opacity-name='msTransGradient_20_1']");
-    sPathStart = "//office:document-content/office:body/office:chart/chart:chart/chart:plot-area";
-    assertXPath(pXmlDoc3, sPathStart + "/chart:wall[@chart:style-name='ch8']");
-
-    xDocShRef->DoClose();
-}
-
-void SdOOXMLExportTest1::testTdf128345Legend_CS_TG_axial()
-{
-    // legend with solid color and transparency gradient
-    // Without the patch the transparency was lost.
-    ::sd::DrawDocShellRef xDocShRef
-        = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp"), ODP);
-    utl::TempFile tempFile;
-    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
-    // Make sure the legend has a transparency in gradient stops in saved file.
-    xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/charts/chart3.xml");
-    OString sPathStart("//c:chartSpace/c:chart/c:legend/c:spPr/a:gradFill");
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs",3); // axial
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", 0); // no element for 0% transparent
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "0"); // 100% transparent
-    assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[3]/a:srgbClr/a:alpha", 0); // no element for 0% transparent
-
-    // Make sure legend has axial transparency in the reloaded document.
-    // I use the saved odp file for testing, because I don't know how to access the chart
-    // from the active document in a unit test.
-    utl::TempFile tempFile2;
-    xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile2);
-    xmlDocUniquePtr pXmlDoc2 = parseExport(tempFile2, "Object 1/styles.xml");
-    sPathStart = "//office:document-styles/office:styles";
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:style='axial']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:start='0%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:end='100%']");
-    assertXPath(pXmlDoc2, sPathStart + "/draw:opacity[@draw:name='msTransGradient_20_1']");
-
-    xmlDocUniquePtr pXmlDoc3 = parseExport(tempFile2, "Object 1/content.xml");
-    sPathStart = "//office:document-content/office:automatic-styles/style:style[@style:name='ch2']";
-    assertXPath(pXmlDoc3, sPathStart + "/style:graphic-properties[@draw:opacity-name='msTransGradient_20_1']");
-    sPathStart = "//office:document-content/office:body/office:chart/chart:chart";
-    assertXPath(pXmlDoc3, sPathStart + "/chart:legend[@chart:style-name='ch2']");
-    xDocShRef->DoClose();
-}
-
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list