[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 19 20:18:29 UTC 2021
sw/qa/extras/uiwriter/uiwriter2.cxx | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
New commits:
commit d104d8048045af049502f694c2af8fa8f131f1b9
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jan 19 13:33:38 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jan 19 21:17:39 2021 +0100
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 at libreoffice.org>
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());
More information about the Libreoffice-commits
mailing list