tdf#159054 unit test: noting the current state before making changes
The historical implementation is rather bizarre,
so I submit it beforehand so that my patch
shows the changes in behaviour in a clearer way.
I checked LO 5.1, and while things were slightly different
(still inexplicable, but not in the same way)
it still did leave behind the suffix,
and toggled back on as 1.
So this has never been good.
Throwing out the old behaviour seems appropriate in this case.
make CppunitTest_sw_uiwriter9 \
CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering
Change-Id: Id794e629d00480bc5a031aaf0595084cb3eb3559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164984
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx
new file mode 100644
index 0000000..091a383
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 77245e6..a18f14c 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -408,6 +408,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf151710)
CPPUNIT_ASSERT_EQUAL(sStartDoubleQuote, pTextDoc->getText()->getString());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering)
{
createSwDoc("tdf159054_disableOutlineNumbering.docx");
SwDoc* pDoc = getSwDoc();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
const uno::Reference<text::XTextRange> xPara1 = getParagraph(1, "Heading A");
const uno::Reference<text::XTextRange> xPara2 = getParagraph(2, "Heading B");
const uno::Reference<text::XTextRange> xPara3 = getParagraph(3, "Heading C");
CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty<OUString>(xPara1, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty<OUString>(xPara2, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty<OUString>(xPara3, "ListLabelString"));
// select (at least parts) of the first two paragraphs
pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1, /*bBasicCall=*/true);
// on the selection, simulate pressing the toolbar button to toggle OFF numbering
dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
// the selected paragraphs should definitely have the list label removed
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara1, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara2, "ListLabelString"));
// current implementation: the numbering style itself is changed too - affects all Heading 1's.
// A valid alternative implementation would be to simply SetCountInList(false) for 1st para,
// and leave the Outline style format alone.
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara3, "ListLabelString"));
// on the selection, simulate pressing the toolbar button to toggle ON numbering again
dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
// current implementation: the entire format was removed, so turn (default) numbering on
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara1, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara2, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty<OUString>(xPara3, "ListLabelString"));
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_dde_disable)
{
std::shared_ptr<comphelper::ConfigurationChanges> pBatch(