diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-15 10:06:33 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-15 10:37:31 +0100 |
commit | 61161254ab880f02a7a26822d45ff96ec7ca76c3 (patch) | |
tree | 8d7b565bef0bf0f8648d246c8aaf406cb1b832dc /desktop | |
parent | 79fa9bb77c702571de753c739e257ff6c27071ca (diff) |
sc tiled rendering: it's pointless to send selection changes during search all
Change-Id: I787cd1760bca0bf7fbc3132579b569882ec25ae2
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 987ac1be9618..f06959545722 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -36,7 +36,9 @@ using namespace desktop; class DesktopLOKTest : public UnoApiTest { public: - DesktopLOKTest() : UnoApiTest("/desktop/qa/data/") + DesktopLOKTest() : UnoApiTest("/desktop/qa/data/"), + m_nSelectionBeforeSearchResult(0), + m_nSelectionAfterSearchResult(0) { } @@ -67,6 +69,7 @@ public: void testGetFilterTypes(); void testGetPartPageRectangles(); void testSearchCalc(); + void testSearchAllNotificationsCalc(); void testPaintTile(); void testSaveAs(); void testSaveAsCalc(); @@ -83,6 +86,7 @@ public: CPPUNIT_TEST(testGetFilterTypes); CPPUNIT_TEST(testGetPartPageRectangles); CPPUNIT_TEST(testSearchCalc); + CPPUNIT_TEST(testSearchAllNotificationsCalc); CPPUNIT_TEST(testPaintTile); CPPUNIT_TEST(testSaveAs); CPPUNIT_TEST(testSaveAsCalc); @@ -97,6 +101,8 @@ public: OString m_aTextSelection; std::vector<OString> m_aSearchResultSelection; std::vector<int> m_aSearchResultPart; + int m_nSelectionBeforeSearchResult; + int m_nSelectionAfterSearchResult; // for testCommandResult osl::Condition m_aCommandResultCondition; @@ -149,6 +155,10 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) case LOK_CALLBACK_TEXT_SELECTION: { m_aTextSelection = pPayload; + if (m_aSearchResultSelection.empty()) + ++m_nSelectionBeforeSearchResult; + else + ++m_nSelectionAfterSearchResult; } break; case LOK_CALLBACK_SEARCH_RESULT_SELECTION: @@ -311,6 +321,31 @@ void DesktopLOKTest::testSearchCalc() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testSearchAllNotificationsCalc() +{ + LibLibreOffice_Impl aOffice; + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("search.ods"); + pDocument->pClass->initializeForRendering(pDocument, nullptr); + pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"SearchItem.SearchString", uno::makeAny(OUString("foo"))}, + {"SearchItem.Backward", uno::makeAny(false)}, + {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(SvxSearchCmd::FIND_ALL))}, + })); + comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + + // This was 1, make sure that we get no notifications about selection changes during search. + CPPUNIT_ASSERT_EQUAL(0, m_nSelectionBeforeSearchResult); + // But we do get the selection afterwards. + CPPUNIT_ASSERT(m_nSelectionAfterSearchResult > 0); + + comphelper::LibreOfficeKit::setActive(false); +} + void DesktopLOKTest::testPaintTile() { LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); |