sw/qa/extras/uiwriter/uiwriter6.cxx |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit 1dd68c0eab53c5747dac89ef21723be6831b0ada
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Mar 7 12:44:40 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Mar 7 19:52:21 2023 +0000

    tdf#153423: sw_uiwriter6: Add unittest
    
    Change-Id: I585d5ea5ac4d704ef1b303a1bf304c29023c2fba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148416
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 5e232f006d45..13979f0d7234 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -43,6 +43,8 @@
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/scopeguard.hxx>
+#include <editeng/swafopt.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <vcl/scheduler.hxx>
 #include <config_fonts.h>
@@ -1653,6 +1655,29 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108423)
     CPPUNIT_ASSERT_EQUAL(sText, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf153423)
+{
+    createSwDoc();
+    SvxSwAutoFormatFlags flags(*SwEditShell::GetAutoFormatFlags());
+    comphelper::ScopeGuard const g([=]() { 
SwEditShell::SetAutoFormatFlags(&flags); });
+    flags.bSetNumRule = true;
+    SwEditShell::SetAutoFormatFlags(&flags);
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    emulateTyping(*pTextDoc, u"1. Item 1");
+
+    SwXTextDocument* pXTextDocument = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pXTextDocument);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_RETURN);
+    Scheduler::ProcessEventsToIdle();
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1.
+    // - Actual  : 10.
+    CPPUNIT_ASSERT_EQUAL(OUString("1."), 
getProperty<OUString>(getParagraph(1), "ListLabelString"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf106164)
 {
     createSwDoc();

Reply via email to