[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sd/qa sd/source
Jan Holesovsky
kendy at collabora.com
Mon Jan 25 13:18:00 PST 2016
sd/qa/unit/tiledrendering/tiledrendering.cxx | 17 +++++++++++++++++
sd/source/ui/view/Outliner.cxx | 7 ++-----
2 files changed, 19 insertions(+), 5 deletions(-)
New commits:
commit 1a83c2259498b070c8d38beb44017f319cbdbee4
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Jan 25 21:49:31 2016 +0100
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
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 264f492..5c88c53 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -62,6 +62,7 @@ public:
void testSearchAll();
void testSearchAllSelections();
void testSearchAllNotifications();
+ void testSearchAllFollowedBySearch();
#endif
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -77,6 +78,7 @@ public:
CPPUNIT_TEST(testSearchAll);
//CPPUNIT_TEST(testSearchAllSelections);
CPPUNIT_TEST(testSearchAllNotifications);
+ CPPUNIT_TEST(testSearchAllFollowedBySearch);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -481,6 +483,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 ca625c8..b1535a2 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -719,11 +719,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections)
DetectChange ();
OutlinerView* pOutlinerView = mpImpl->GetOutlinerView();
- DBG_ASSERT(pOutlinerView!=NULL && GetEditEngine().HasView( &pOutlinerView->GetEditView() ),
- "SearchAndReplace without valid view!" );
-
- if( NULL == pOutlinerView || !GetEditEngine().HasView( &pOutlinerView->GetEditView() ) )
- return true;
+ if (!pOutlinerView)
+ return true; // end of search
::boost::shared_ptr<ViewShell> pViewShell (mpWeakViewShell.lock());
if (pViewShell != 0)
More information about the Libreoffice-commits
mailing list