summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-01-19 13:33:38 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-19 21:17:39 +0100
commitd104d8048045af049502f694c2af8fa8f131f1b9 (patch)
tree284d358dcc95253799455df57959be1582dc89ce /sw
parentc1182f889946cb5d999ac84b447e33f5dcb759d6 (diff)
tdf#136704: sw_uiwriter2: Add unittest
Change-Id: I15568e5f95a955856d4cd1c5b02b31ccf469cf2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109631 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index af48682cfcd2..83b119fe0fed 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -351,6 +351,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode)
rUndoManager.Undo();
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf136704)
+{
+ SwDoc* const pDoc(createDoc());
+ SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
+ corr.GetSwFlags().bReplaceStyles = true;
+ SvxSwAutoFormatFlags flags(*SwEditShell::GetAutoFormatFlags());
+ comphelper::ScopeGuard const g([=]() { SwEditShell::SetAutoFormatFlags(&flags); });
+ flags.bReplaceStyles = true;
+ SwEditShell::SetAutoFormatFlags(&flags);
+
+ pWrtShell->Insert("test");
+ const sal_Unicode cIns = ':';
+ pWrtShell->AutoCorrect(corr, cIns);
+
+ 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 crashed here
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Heading 3"),
+ getProperty<OUString>(getParagraph(1), "ParaStyleName"));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf137245)
{
SwDoc* const pDoc(createDoc());