summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2022-08-22 12:52:22 -0400
committerJustin Luth <jluth@mail.com>2022-08-23 04:09:04 +0200
commit46dc9f3bbac67e9240adc44ab017f905482ef786 (patch)
treec8140a7662fdf4c7260b19bb124e7ebaf83c23f5 /sw/qa/extras/odfexport
parent3cc6b870c48b23418f65d2c3cd6eab72ef0680de (diff)
tdf#57317 odf export: avoid autolist conflict with NumberingStyles
Somehow you can have autoStyles writing into the styles.xml. Well, the code to prevent duplicates for that needs to exist for autoStyles written into document.xml as well. Change-Id: I9602b7023a1ef009ad644374dc5081afb8a76916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138703 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/qa/extras/odfexport')
-rw-r--r--sw/qa/extras/odfexport/data/tdf57317_autoListName.odtbin0 -> 10953 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport2.cxx31
2 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt
new file mode 100644
index 000000000000..3aafbc519387
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx
index 2a2f015f6b84..5d2f91b92d5d 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -94,6 +94,37 @@ DECLARE_ODFEXPORT_TEST(testTdf143605, "tdf143605.odt")
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(getParagraph(1), "ListLabelString"));
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName)
+{
+ load(mpTestDocumentPath, "tdf57317_autoListName.odt");
+ // The list style (from styles.xml) overrides a duplicate named auto-style
+ //uno::Any aNumStyle = getStyles("NumberingStyles")->getByName("L1");
+ //CPPUNIT_ASSERT(aNumStyle.hasValue());
+ uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty<OUString>(xPara, "ListLabelString"));
+ CPPUNIT_ASSERT_EQUAL(OUString("L1"), getProperty<OUString>(xPara, "NumberingStyleName"));
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:DefaultBullet", {});
+
+ // This was failing with a duplicate auto numbering style name of L1 instead of a unique name,
+ // thus it was showing the same info as before the bullet modification.
+ reload(mpFilter, "");
+ xPara.set(getParagraph(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
+
+ uno::Reference<container::XIndexAccess> xLevels(xPara->getPropertyValue("NumberingRules"),
+ uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProps;
+ xLevels->getByIndex(0) >>= aProps;
+ for (beans::PropertyValue const& rProp : std::as_const(aProps))
+ {
+ if (rProp.Name == "BulletChar")
+ return;
+ }
+ CPPUNIT_FAIL("no BulletChar property");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testListFormatDocx)
{
loadAndReload("listformat.docx");