diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2020-08-10 23:26:54 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2020-08-11 14:13:23 +0200 |
commit | a6704e6dc53d64bc1442d337f7bfb8deb03f4145 (patch) | |
tree | 539e355ebca6efea490dd95f7e2f2af69e61493f /sd | |
parent | b03e218e9a5f6f8350ccb9c921b97a6bda2485bc (diff) |
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@t-online.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp | bin | 19486 -> 0 bytes | |||
-rw-r--r-- | sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp | bin | 16551 -> 0 bytes | |||
-rw-r--r-- | sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp | bin | 15174 -> 0 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 120 |
4 files changed, 0 insertions, 120 deletions
diff --git a/sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp b/sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp Binary files differdeleted file mode 100644 index 754e71d51222..000000000000 --- a/sd/qa/unit/data/odp/tdf128345_ChartArea_CG_TS.odp +++ /dev/null diff --git a/sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp b/sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp Binary files differdeleted file mode 100644 index 4c09ebb7bb34..000000000000 --- a/sd/qa/unit/data/odp/tdf128345_Chart_CS_TG.odp +++ /dev/null diff --git a/sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp b/sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp Binary files differdeleted file mode 100644 index bfcd8a5dd5c9..000000000000 --- a/sd/qa/unit/data/odp/tdf128345_Legend_CS_TG_axial.odp +++ /dev/null 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(); |