diff options
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/odg/tablestyles.fodg | 22 | ||||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 35 |
2 files changed, 57 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odg/tablestyles.fodg b/sd/qa/unit/data/odg/tablestyles.fodg index 7b54e73955f9..3672ad8e4a70 100644 --- a/sd/qa/unit/data/odg/tablestyles.fodg +++ b/sd/qa/unit/data/odg/tablestyles.fodg @@ -2,6 +2,28 @@ <office:document xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.graphics"> <office:scripts/> <office:font-face-decls/> + <office:styles> + <style:style style:name="default" style:family="table-cell"/> + <style:style style:name="userdefined" style:family="table-cell"/> + <table:table-template table:name="default"> + <table:first-row table:style-name="userdefined"/> + <table:last-row table:style-name="userdefined"/> + <table:first-column table:style-name="userdefined"/> + <table:last-column table:style-name="userdefined"/> + <table:body table:style-name="userdefined"/> + <table:odd-rows table:style-name="userdefined"/> + <table:odd-columns table:style-name="userdefined"/> + </table:table-template> + <table:table-template table:name="userdefined"> + <table:first-row table:style-name="default"/> + <table:last-row table:style-name="default"/> + <table:first-column table:style-name="default"/> + <table:last-column table:style-name="default"/> + <table:body table:style-name="default"/> + <table:odd-rows table:style-name="default"/> + <table:odd-columns table:style-name="default"/> + </table:table-template> + </office:styles> <office:automatic-styles> <style:page-layout style:name="PM0"> <style:page-layout-properties fo:margin-top="1cm" fo:margin-bottom="1cm" fo:margin-left="1cm" fo:margin-right="1cm" fo:page-width="21.59cm" fo:page-height="27.94cm" style:print-orientation="portrait"/> diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 288e9acacf99..7d7f5c747cf9 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -102,6 +102,7 @@ public: void testColumnsODG(); void testTdf112126(); void testCellProperties(); + void testUserTableStyles(); CPPUNIT_TEST_SUITE(SdExportTest); @@ -151,6 +152,7 @@ public: CPPUNIT_TEST(testColumnsODG); CPPUNIT_TEST(testTdf112126); CPPUNIT_TEST(testCellProperties); + CPPUNIT_TEST(testUserTableStyles); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1767,6 +1769,11 @@ void SdExportTest::testTdf112126() void SdExportTest::testCellProperties() { + // Silence unrelated failure: + // Error: element "table:table-template" is missing "first-row-start-column" attribute + // Looks like an oversight in the schema, as the docs claim this attribute is deprecated. + skipValidation(); + loadFromURL(u"odg/tablestyles.fodg"); saveAndReload("draw8"); @@ -1792,6 +1799,34 @@ void SdExportTest::testCellProperties() CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust::TextVerticalAdjust_CENTER, aTextAdjust); } +void SdExportTest::testUserTableStyles() +{ + // Silence unrelated failure: + // Error: element "table:table-template" is missing "first-row-start-column" attribute + // Looks like an oversight in the schema, as the docs claim this attribute is deprecated. + skipValidation(); + + loadFromURL(u"odg/tablestyles.fodg"); + saveAndReload("draw8"); + + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamily( + xStyleFamiliesSupplier->getStyleFamilies()->getByName("table"), uno::UNO_QUERY); + + uno::Reference<style::XStyle> xTableStyle(xStyleFamily->getByName("default"), uno::UNO_QUERY); + CPPUNIT_ASSERT(!xTableStyle->isUserDefined()); + + uno::Reference<container::XNameAccess> xNameAccess(xTableStyle, uno::UNO_QUERY); + uno::Reference<style::XStyle> xCellStyle(xNameAccess->getByName("first-row"), uno::UNO_QUERY); + CPPUNIT_ASSERT(xCellStyle); + CPPUNIT_ASSERT_EQUAL(OUString("userdefined"), xCellStyle->getName()); + + CPPUNIT_ASSERT(xStyleFamily->hasByName("userdefined")); + xTableStyle.set(xStyleFamily->getByName("userdefined"), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTableStyle->isUserDefined()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |