diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-01-16 17:26:33 +0100 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-01-18 14:51:43 +0100 |
commit | d185daec6814ff3179ce7ef4242952505f98fa19 (patch) | |
tree | 46eb693bc15a97dbb40338bbeb2f210410a71904 /sw | |
parent | bc0a9076aa43a0782bcf81e55d3f84f6af0f68e8 (diff) |
ooxml: unit test for shape theme attributes preservation
This tests checks that the shape style attribute for fill color is
preserved, that the theme attibute for shape fill is preserved too
and that the interaction between them and direct assignment of some
color works properly.
Change-Id: Ia934c46731ed38be14ed851e083d0ed6fc151b01
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx | bin | 0 -> 18425 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 48 |
2 files changed, 48 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx b/sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx Binary files differnew file mode 100644 index 000000000000..8fdbd06526c1 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index f093b5dc2663..fe922477c9cc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2469,6 +2469,54 @@ DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx") CPPUNIT_ASSERT_EQUAL(OUString("ooxml-borderCallout1"), aType); } +DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.docx") +{ + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + + // check shape style has been preserved + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef", + "idx", "1"); + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr", + "val", "accent1"); + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef", + "idx", "1"); + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr", + "val", "accent1"); + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef", + "idx", "1"); + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:fillRef/a:schemeClr", + "val", "accent1"); + + // check shape style hasn't been overwritten + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill", + 0); + + // check direct theme assignments have been preserved + assertXPath(pXmlDocument, + "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:schemeClr", + "val", "accent6"); + + // check direct color assignments have been preserved + OUString sFillColor = getXPath(pXmlDocument, + "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill/a:srgbClr", + "val"); + CPPUNIT_ASSERT_EQUAL(sFillColor.toInt32(16), sal_Int32(0x00b050)); + + // check colors are properly applied to shapes on import + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(getShape(1), "FillColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xf79646), getProperty<sal_Int32>(getShape(2), "FillColor")); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), getProperty<sal_Int32>(getShape(3), "FillColor")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); |