diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-14 14:20:40 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-14 14:45:09 +0100 |
commit | 7b5d20983dfbfb458898eeab54828ba5fef5841f (patch) | |
tree | b067a0fbdb143073e17a44e20cc0384193be550c /sd | |
parent | b9565ef0a73c235cd1e14fce9031db6e9237c524 (diff) |
editeng: handle SdrModel::isTiledSearching()
Given that the edit/outliner views can come and go, avoid the lifecycle
problems with just passing a pointer to the sdr model to editeng, and
then it'll always have the up to date "are we searching" information.
editeng can't depend on svx, so provide an interface class SdrModel can
implement.
Change-Id: I3b98011593b00ac0fab05b6b9c591dd20d94c579
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 13b4223a2444..296964d2c15d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -54,6 +54,7 @@ public: void testSearch(); void testSearchAll(); void testSearchAllSelections(); + void testSearchAllNotifications(); #endif CPPUNIT_TEST_SUITE(SdTiledRenderingTest); @@ -68,6 +69,7 @@ public: CPPUNIT_TEST(testSearch); CPPUNIT_TEST(testSearchAll); CPPUNIT_TEST(testSearchAllSelections); + CPPUNIT_TEST(testSearchAllNotifications); #endif CPPUNIT_TEST_SUITE_END(); @@ -86,13 +88,17 @@ private: sal_Int32 m_nPart; std::vector<OString> m_aSearchResultSelection; std::vector<int> m_aSearchResultPart; + int m_nSelectionBeforeSearchResult; + int m_nSelectionAfterSearchResult; #endif }; SdTiledRenderingTest::SdTiledRenderingTest() #if !defined(WNT) && !defined(MACOSX) : m_bFound(true), - m_nPart(0) + m_nPart(0), + m_nSelectionBeforeSearchResult(0), + m_nSelectionAfterSearchResult(0) #endif { } @@ -177,6 +183,10 @@ void SdTiledRenderingTest::callbackImpl(int nType, const char* pPayload) lcl_convertRectangle(rString, aRectangle); m_aSelection.push_back(aRectangle); } + if (m_aSearchResultSelection.empty()) + ++m_nSelectionBeforeSearchResult; + else + ++m_nSelectionAfterSearchResult; } break; case LOK_CALLBACK_SEARCH_NOT_FOUND: @@ -458,6 +468,20 @@ void SdTiledRenderingTest::testSearchAllSelections() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testSearchAllNotifications() +{ + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp"); + pXImpressDocument->registerCallback(&SdTiledRenderingTest::callback, this); + + lcl_search("third", /*bFindAll=*/true); + // Make sure that we get no notifications about selection changes during search. + CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); + // But we do get the selection of the first hit. + CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); + comphelper::LibreOfficeKit::setActive(false); +} + #endif CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); |