summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlimport
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-07 08:19:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-07 08:13:23 +0000
commitf9c8d97d82a85b897520a2fe897352ee5ad879d9 (patch)
tree668a8cc96e2dda54a0ea93e375b116db5870f6a5 /sw/qa/extras/ooxmlimport
parentf84d09cdda19e51373ec0ac4afb969483be24425 (diff)
tdf#95213 DOCX import: don't reuse list label styles
We used to optimize the creation of these styles, so in case two list label had the same character properties, then we could avoid creating two styles for those. This isn't correct though: it means if the style is changed later by the user, then unexpected other places in the document will change as well. Do what the binary DOC filter does: create one character style for each level of a numbering separately. Change-Id: I967b30fc078b1be30f7ef81b2706df2962fc3fb0 Reviewed-on: https://gerrit.libreoffice.org/21191 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/ooxmlimport')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf95213.docxbin0 -> 17747 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx14
2 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf95213.docx b/sw/qa/extras/ooxmlimport/data/tdf95213.docx
new file mode 100644
index 000000000000..831d543b903f
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf95213.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 714704cb6544..fe67d762292b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3033,6 +3033,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92045, "tdf92045.docx")
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(getRun(getParagraph(1), 1), "CharFlash"));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf95213, "tdf95213.docx")
+{
+ // Get the second paragraph's numbering style's 2nd level's character style name.
+ uno::Reference<text::XTextRange> xParagraph = getParagraph(2);
+ auto xLevels = getProperty< uno::Reference<container::XIndexAccess> >(xParagraph, "NumberingRules");
+ uno::Sequence<beans::PropertyValue> aLevel;
+ xLevels->getByIndex(1) >>= aLevel; // 2nd level
+ OUString aName = std::find_if(aLevel.begin(), aLevel.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "CharStyleName"; })->Value.get<OUString>();
+
+ uno::Reference<beans::XPropertySet> xStyle(getStyles("CharacterStyles")->getByName(aName), uno::UNO_QUERY);
+ // This was awt::FontWeight::BOLD.
+ CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xStyle, "CharWeight"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */