summaryrefslogtreecommitdiff
path: root/sw/qa/extras/unowriter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-03 01:33:20 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-01-03 15:35:00 +0100
commit0fce75bde16d64970feab5de488da530193dfa23 (patch)
tree5ad7f9c5c2d0cc685127d4c58291633b1ca6e2c3 /sw/qa/extras/unowriter
parent4ca73073a0d7c62b12a7354f76f8f80adc5d98c1 (diff)
tdf#129743 follow-up: implement the other variant of the fix
Reimplement commit d8a188d8d59ae51621a0540fe931e1c70db285fe Seems that I was overly optimistic. The behaviour of CreateCursor affects many places; first of them is CreateNewShellCursor, which would start returning cursors with selection after the fix from commit d8a188d8d59ae51621a0540fe931e1c70db285fe. Or if we change which cursor is returned from that method, then the order of the chain would reverse. And there are many such places. So just make it like before, and do the conservative fix. Change-Id: Ib6bf414f0e91d6fb59f73fbfc0fbd799457d49c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86151 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/unowriter')
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 2f01c47605ba..3d3301130388 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -793,7 +793,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect)
loadURL("private:factory/swriter", nullptr);
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, css::uno::UNO_QUERY_THROW);
auto xSimpleText = xTextDocument->getText();
- xSimpleText->insertString(xSimpleText->getStart(), "abc abc abc", false);
+ xSimpleText->insertString(xSimpleText->getStart(), "Abc aBc abC", false);
// Create a search descriptor and find all occurencies of search string
css::uno::Reference<css::util::XSearchable> xSearchable(mxComponent, css::uno::UNO_QUERY_THROW);
@@ -802,7 +802,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect)
xSearchDescriptor->setPropertyValue("SearchCaseSensitive", css::uno::Any(false));
xSearchDescriptor->setPropertyValue("SearchBackwards", css::uno::Any(true));
xSearchDescriptor->setPropertyValue("SearchRegularExpression", css::uno::Any(false));
- xSearchDescriptor->setSearchString("Abc");
+ xSearchDescriptor->setSearchString("abc");
auto xSearchResult = xSearchable->findAll(xSearchDescriptor);
// Select them all
@@ -812,16 +812,16 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect)
xSelectionSupplier->select(css::uno::Any(xSearchResult));
css::uno::Reference<css::container::XIndexAccess> xSelection(xSelectionSupplier->getSelection(),
css::uno::UNO_QUERY_THROW);
- // Now check that they all are selected.
+ // Now check that they all are selected in the reverse order ("SearchBackwards").
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xSelection->getCount());
- for (sal_Int32 i = 0; i < xSelection->getCount(); ++i)
- {
- css::uno::Reference<css::text::XTextRange> xTextRange(xSelection->getByIndex(i),
- css::uno::UNO_QUERY_THROW);
- // For i=0, result was empty (cursor was put before the last occurence without selection)
- const OString sComment = "i=" + OString::number(i);
- CPPUNIT_ASSERT_EQUAL_MESSAGE(sComment.getStr(), OUString("abc"), xTextRange->getString());
- }
+ css::uno::Reference<css::text::XTextRange> xTextRange(xSelection->getByIndex(0),
+ css::uno::UNO_QUERY_THROW);
+ // For #0, result was empty (cursor was put before the last occurence without selection)
+ CPPUNIT_ASSERT_EQUAL(OUString("abC"), xTextRange->getString());
+ xTextRange.set(xSelection->getByIndex(1), css::uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("aBc"), xTextRange->getString());
+ xTextRange.set(xSelection->getByIndex(2), css::uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("Abc"), xTextRange->getString());
}
CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTransparentText)