summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-03-18 16:56:55 -0400
committerMiklos Vajna <vmiklos@collabora.com>2024-03-20 16:19:14 +0100
commitf78c0dfa7a63303533eed17636e7abf8332eea48 (patch)
tree77e11f600cdb17a1683f9a238ee1834c1915a4c1 /sw/qa
parentd94288a6f26a6f0d58901732c562dfad861ec4c5 (diff)
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>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docxbin0 -> 5355 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter9.cxx37
2 files changed, 37 insertions, 0 deletions
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 000000000000..091a3830e75b
--- /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 77245e63ce2f..a18f14c9ad9a 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(