diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-08-27 10:30:02 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-08-27 12:18:33 +0200 |
commit | 1864e6353179678a2ca1a175c203fd9e0cc5a580 (patch) | |
tree | 5ca8377d52db5c81464c61abe07b08fe9710e96e | |
parent | 8d8e5ab9193785acc4e1cb05e0db7f97afde1e2b (diff) |
tdf#116315: sw_uiwriter3: Add unittest
Change-Id: I29aa953d8541d45b003703ba91c143fc9760ceac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121135
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index c88abacb9536..72b715051cce 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1686,6 +1686,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629) CPPUNIT_ASSERT_EQUAL(1, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf116315) +{ + SwDoc* const pDoc = createSwDoc(); + SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtSh); + + pWrtSh->Insert("This is a test"); + pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 4, /*bBasicCall=*/false); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + for (sal_Int32 i = 0; i < 5; ++i) + { + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("This is a Test"), getParagraph(1)->getString()); + + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3); + Scheduler::ProcessEventsToIdle(); + + // Without the fix in place, this test would have failed with + // - Expected: This is a test + // - Actual : This is a TEST + CPPUNIT_ASSERT_EQUAL(OUString("This is a test"), getParagraph(1)->getString()); + + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("This is a TEST"), getParagraph(1)->getString()); + + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("This is a test"), getParagraph(1)->getString()); + } +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613) { SwDoc* const pDoc = createSwDoc(); |