summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-06-21 00:31:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-07 09:02:15 +0000
commit40fba0f4418084d50cc5c388cb0b6e1abe395d61 (patch)
tree4b1e97aa7755c80d9a8749fb94dc3fe26a2f35fb /sw/qa
parent046244bcfe1c5c1cd2325fe74b933c05e43cf190 (diff)
GSoC Writer Table Styles Import
This patch is implementing import of table styles (table-template). Modified shared code: Added "background" to the cell styles export. To make cell export properties map accessible by both export and import code, moved from xmloff/source/table/XMLTableExport.cxx to xmloff/txtprmap.hxx. To avoid export of default valued properties implemented XPropertyState for SwXTextCellStyle Change-Id: I8b4f12e4b51f478f8ce8fde1203cd4611d7ae852 Reviewed-on: https://gerrit.libreoffice.org/26721 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/odfexport/data/table_styles_1.odtbin0 -> 9874 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx40
2 files changed, 40 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/table_styles_1.odt b/sw/qa/extras/odfexport/data/table_styles_1.odt
new file mode 100644
index 000000000000..701fd92c2aaa
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/table_styles_1.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index aa384775a1ed..313d2cfd39e8 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -816,6 +816,46 @@ DECLARE_ODFEXPORT_TEST(testEmbeddedPdf, "embedded-pdf.odt")
CPPUNIT_ASSERT(!getProperty<OUString>(xShape, "ReplacementGraphicURL").isEmpty());
}
+DECLARE_ODFEXPORT_TEST(testTableStyles1, "table_styles_1.odt")
+{
+ // Table styles basic graphic test.
+ // Doesn't cover all attributes.
+ uno::Reference<style::XStyleFamiliesSupplier> XFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xFamilies(XFamiliesSupplier->getStyleFamilies());
+ uno::Reference<container::XNameAccess> xCellFamily(xFamilies->getByName("CellStyles"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xCell1Style;
+ xCellFamily->getByName("Test style.1") >>= xCell1Style;
+
+ sal_Int64 nInt64 = 0xF0F0F0;
+ sal_Int32 nInt32 = 0xF0F0F0;
+ table::BorderLine2 oBorder;
+
+ xCell1Style->getPropertyValue("BackColor") >>= nInt64;
+ CPPUNIT_ASSERT_EQUAL(sal_Int64(0xCC0000), nInt64);
+ xCell1Style->getPropertyValue("WritingMode") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), nInt32);
+ xCell1Style->getPropertyValue("VertOrient") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nInt32);
+ xCell1Style->getPropertyValue("BorderDistance") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32);
+ xCell1Style->getPropertyValue("LeftBorderDistance") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32);
+ xCell1Style->getPropertyValue("RightBorderDistance") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32);
+ xCell1Style->getPropertyValue("TopBorderDistance") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32);
+ xCell1Style->getPropertyValue("BottomBorderDistance") >>= nInt32;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(97), nInt32);
+ xCell1Style->getPropertyValue("RightBorder") >>= oBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color);
+ xCell1Style->getPropertyValue("LeftBorder") >>= oBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color);
+ xCell1Style->getPropertyValue("TopBorder") >>= oBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color);
+ xCell1Style->getPropertyValue("BottomBorder") >>= oBorder;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), oBorder.Color);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();