summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2023-10-30 14:42:34 +0100
committerLászló Németh <nemeth@numbertext.org>2023-10-30 21:54:07 +0100
commit79435eb55ef226fb0e3507aabdc2f8af062680f6 (patch)
treebaf38a092ea42d3527f07212f4364f8142ede90b /sw/qa
parenta18174e807e8704c385637b8a53c45b9608bfa42 (diff)
tdf#157988 sw track changes: fix cycle case on a selected word
Cycle case didn't work on a selected word, only on the word under the cursor without selection. Add unit test also for tdf#141198. Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3 "tdf#141198 sw: fix cycle case with change tracking". Change-Id: I0c1361c78d09e9b8743192a47dcdfa6f6da52e38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158666 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter6.cxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 53f6dce1a56a..83bc43f6d866 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -690,6 +690,75 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
+{
+ createSwDoc("tdf130088.docx");
+ SwDoc* pDoc = getSwDoc();
+
+ // select the second word
+ dispatchCommand(mxComponent, ".uno:GoToNextWord", {});
+ dispatchCommand(mxComponent, ".uno:SelectWord", {});
+
+ // enable redlining
+ dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+ // show changes
+ CPPUNIT_ASSERT_MESSAGE(
+ "redlines should be visible",
+ IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+ // cycle case with change tracking
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ // This was false (missing revert of the tracked change)
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSODALES"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt"));
+
+ // tdf#141198 cycle case without selection: the word under the cursor
+
+ dispatchCommand(mxComponent, ".uno:Escape", {});
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSODALES"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodalesSodales"));
+
+ dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+ CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales tincidunt"));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
{
createSwDoc();