[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 19 13:52:02 UTC 2019


 sw/qa/extras/uiwriter/uiwriter2.cxx  |   36 +++++++++++++++++++++++++++++++++++
 sw/source/uibase/uiview/viewsrch.cxx |    2 +
 2 files changed, 38 insertions(+)

New commits:
commit 62c1acdda27966c810cab25a1d0667c6a18c436d
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 18 21:50:53 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 19 14:51:41 2019 +0100

    tdf#101873 sw: fix search for second term after double not found
    
    Regression from commit 8d2fe8d7e5f374f3a106a4fc58ef597a52815ad0
    (SwView::SearchAndWrap: fix WrapAround search in fly frames,
    2015-06-03).
    
    The search implementation looks in the body text, then in case searching
    in extra content was not enabled already, it attempts to search there.
    
    The problem was that while the wrap-around implementation intended to do
    the same, it failed to unset the "search in extra" flag in case nothing
    was found, fix that now.
    
    (cherry picked from commit 9c1383e4da135db28c422752153e9a77558e8c2f)
    
    Conflicts:
            sw/qa/extras/uiwriter/uiwriter2.cxx
    
    Change-Id: Idf078e464824cad69c9709309435f2db207503b8
    Reviewed-on: https://gerrit.libreoffice.org/68004
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0ab26ac25485..dbc3b738d3b4 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -41,6 +41,7 @@ public:
     void testTdf119019();
     void testTdf119824();
     void testTdf105413();
+    void testTdf101873();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest2);
     CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -52,6 +53,7 @@ public:
     CPPUNIT_TEST(testTdf119019);
     CPPUNIT_TEST(testTdf119824);
     CPPUNIT_TEST(testTdf105413);
+    CPPUNIT_TEST(testTdf101873);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -442,6 +444,40 @@ void SwUiWriterTest2::testTdf105413()
                          getProperty<OUString>(getParagraph(1), "ParaStyleName"));
 }
 
+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 96b1708eb4be..9e0df20e7743 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -624,6 +624,8 @@ bool SwView::SearchAndWrap(bool bApi)
         m_bExtra = true;
         if (FUNC_Search(aOpts))
             m_bFound = true;
+        else
+            m_bExtra = false;
     }
 
     m_pWrtShell->EndAllAction();


More information about the Libreoffice-commits mailing list