summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-01-25 21:49:31 +0100
committerJan Holesovsky <kendy@collabora.com>2016-01-25 22:01:47 +0100
commited5450f2a5ed8e72b48b4d976217746cea04a5c9 (patch)
treef2847574a748202fc4a89cf4442424347bea4cb6 /sd
parentdcdc98b73601870a0d04a8d5253e56a4db59a266 (diff)
sd lok: Fix normal 'search' performed after a 'search all'.
The DBG_ASSERT followed by the same test actually returning immediately prevents the actual 'search' after a 'search all' being performed. I hope this does not have any negative consequences; but if it does, we should fix the root cause, instead of having this kind of defensive programming here. Change-Id: I909533f301dda9c20cab1968de45e5fa7975e852
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx17
-rw-r--r--sd/source/ui/view/Outliner.cxx7
2 files changed, 19 insertions, 5 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 296964d2c15d..fab2c4ed9671 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -55,6 +55,7 @@ public:
void testSearchAll();
void testSearchAllSelections();
void testSearchAllNotifications();
+ void testSearchAllFollowedBySearch();
#endif
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -70,6 +71,7 @@ public:
CPPUNIT_TEST(testSearchAll);
CPPUNIT_TEST(testSearchAllSelections);
CPPUNIT_TEST(testSearchAllNotifications);
+ CPPUNIT_TEST(testSearchAllFollowedBySearch);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -482,6 +484,21 @@ void SdTiledRenderingTest::testSearchAllNotifications()
comphelper::LibreOfficeKit::setActive(false);
}
+void SdTiledRenderingTest::testSearchAllFollowedBySearch()
+{
+ comphelper::LibreOfficeKit::setActive();
+ SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+ pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this);
+
+ lcl_search("third", /*bFindAll=*/true);
+ lcl_search("match", /*bFindAll=*/false);
+
+ OString aUsedFormat;
+ // This used to give wrong result: 'search' after 'search all' still
+ // returned 'third'
+ CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat));
+}
+
#endif
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index ce7aef6aad15..de9756eca9cf 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -705,11 +705,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
DetectChange ();
OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
- DBG_ASSERT(pOutlinerView!=nullptr && GetEditEngine().HasView( &pOutlinerView->GetEditView() ),
- "SearchAndReplace without valid view!" );
-
- if( nullptr == pOutlinerView || !GetEditEngine().HasView( &pOutlinerView->GetEditView() ) )
- return true;
+ if (!pOutlinerView)
+ return true; // end of search
std::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock());
if (pViewShell != nullptr)