summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-07-26 14:29:40 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-27 12:13:18 +0000
commitb7138e03ebc8a33258c099c5cf6015970646a40e (patch)
tree6c4a872182c08e96c832e8b1f60b0cfbfdbb162e /sw/qa
parent9e63e60d6f00ee690fafb9f21f2cafb08a6ad92e (diff)
GSoC Writer Table Styles; Import bugfix
+ Binary autoformats are loaded into document on document creation + Imported table styles overwrite existing styles. Change-Id: I88c08d1356e1c54a03624a051611357670f225ba Reviewed-on: https://gerrit.libreoffice.org/27539 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_4.odtbin0 -> 9094 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx13
-rw-r--r--sw/qa/python/check_styles.py5
3 files changed, 16 insertions, 2 deletions
diff --git a/sw/qa/extras/odfexport/data/table_styles_4.odt b/sw/qa/extras/odfexport/data/table_styles_4.odt
new file mode 100644
index 000000000000..0d96127e3b25
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/table_styles_4.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 56d2d2a6529a..cca1ed0f6c5f 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1126,6 +1126,19 @@ DECLARE_ODFEXPORT_TEST(testTableStyles3, "table_styles_3.odt")
}
}
+DECLARE_ODFIMPORT_TEST(testTableStyles4, "table_styles_4.odt")
+{
+ // Test if loaded styles overwrite existing styles
+ uno::Reference<style::XStyleFamiliesSupplier> XFamiliesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xFamilies(XFamiliesSupplier->getStyleFamilies());
+ uno::Reference<container::XNameAccess> xTableFamily(xFamilies->getByName("TableStyles"), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xTableStyle(xTableFamily->getByName("Green"), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xCell1Style;
+
+ xTableStyle->getByName("first-row-start-column") >>= xCell1Style;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), getProperty<sal_Int32>(xCell1Style, "BackColor"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index 372455ed70ea..8022acd63017 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -232,8 +232,9 @@ class CheckStyle(unittest.TestCase):
xTableStyle2 = xDoc.createInstance("com.sun.star.style.TableStyle")
with self.assertRaises(IllegalArgumentException): #replace with other family style
xTableStyle.replaceByName("first-row", xTableStyle2)
- with self.assertRaises(IllegalArgumentException): #replace with already assigned cell style
- xTableStyle.replaceByName("first-row", xTableStyle2.getByName("first-row"))
+ #replace with already assigned cell style
+ xTableStyle.replaceByName("first-row", xTableStyle2.getByName("first-row"))
+ self.assertEqual(xTableStyle.getByName("first-row"), xTableStyle2.getByName("first-row"))
xDoc.StyleFamilies.getByName("CellStyles").insertByName("Test Cell Style", xCellStyle)
xTableStyle.replaceByName("first-row", xCellStyle)
self.assertEqual(xTableStyle.getByName("first-row"), xCellStyle)