summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx36
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx2
2 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0f1cb7f2ad9d..33b8ac9b53ed 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -60,6 +60,7 @@ public:
void testTdf122901();
void testTdf122942();
void testTdf52391();
+ void testTdf101873();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -81,6 +82,7 @@ public:
CPPUNIT_TEST(testTdf122901);
CPPUNIT_TEST(testTdf122942);
CPPUNIT_TEST(testTdf52391);
+ CPPUNIT_TEST(testTdf101873);
CPPUNIT_TEST_SUITE_END();
private:
@@ -878,6 +880,40 @@ void SwUiWriterTest2::testTdf52391()
CPPUNIT_ASSERT_EQUAL(OUString("Portion1Portion2"), xRun->getString());
}
+void SwUiWriterTest2::testTdf101873()
+{
+ SwDoc* pDoc = createDoc();
+ CPPUNIT_ASSERT(pDoc);
+
+ SwDocShell* pDocShell = pDoc->GetDocShell();
+ CPPUNIT_ASSERT(pDocShell);
+
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ // Insert some content.
+ pWrtShell->Insert("something");
+
+ // Search for something which does not exist, twice.
+ uno::Sequence<beans::PropertyValue> aFirst(comphelper::InitPropertySequence({
+ { "SearchItem.SearchString", uno::makeAny(OUString("fig")) },
+ { "SearchItem.Backward", uno::makeAny(false) },
+ }));
+ lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
+ lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aFirst);
+
+ uno::Sequence<beans::PropertyValue> aSecond(comphelper::InitPropertySequence({
+ { "SearchItem.SearchString", uno::makeAny(OUString("something")) },
+ { "SearchItem.Backward", uno::makeAny(false) },
+ }));
+ lcl_dispatchCommand(mxComponent, ".uno:ExecuteSearch", aSecond);
+
+ // Without the accompanying fix in place, this test would have failed with "Expected: something;
+ // Actual:", i.e. searching for "something" failed, even if it was inserted above.
+ SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+ CPPUNIT_ASSERT_EQUAL(OUString("something"), pShellCursor->GetText());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index ca2aa004a257..a4c2f2d32582 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -608,6 +608,8 @@ bool SwView::SearchAndWrap(bool bApi)
m_bExtra = true;
if (FUNC_Search(aOpts))
m_bFound = true;
+ else
+ m_bExtra = false;
}
m_pWrtShell->EndAllAction();