summaryrefslogtreecommitdiff
path: root/sd/qa/unit/tiledrendering/tiledrendering.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-10-15 15:20:23 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-15 16:25:13 +0200
commitcd4976988cf3acb4f1a23f1df7fcc2bfec0f3da0 (patch)
tree87906c91a0df1039fa8f50302a11e0180069749a /sd/qa/unit/tiledrendering/tiledrendering.cxx
parent74d686bc59cd70e7ad89f7845199eb751aa7145d (diff)
sd tiled rendering: let find-all at least select the first match physically
The LOK API can describe a multi-selection, so find-all can signal all matches, editeng can have a single selection only. Instead of having no selections after a find-all, select the first match, so e.g. copy works. Change-Id: I0eab2565916f0c3cce5d77279c0d927ad4b7054c
Diffstat (limited to 'sd/qa/unit/tiledrendering/tiledrendering.cxx')
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 4a5c81b7498a..89a2bf11b228 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -23,6 +23,7 @@
#include <editeng/outliner.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
+#include <svl/srchitem.hxx>
#include <DrawDocShell.hxx>
#include <ViewShell.hxx>
@@ -51,6 +52,7 @@ public:
void testSetGraphicSelection();
void testResetSelection();
void testSearch();
+ void testSearchAll();
#endif
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -63,6 +65,7 @@ public:
CPPUNIT_TEST(testSetGraphicSelection);
CPPUNIT_TEST(testResetSelection);
CPPUNIT_TEST(testSearch);
+ CPPUNIT_TEST(testSearchAll);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -371,12 +374,13 @@ void SdTiledRenderingTest::testResetSelection()
CPPUNIT_ASSERT(!pView->GetTextEditObject());
}
-static void lcl_search(const OUString& rKey)
+static void lcl_search(const OUString& rKey, bool bFindAll = false)
{
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
{"SearchItem.SearchString", uno::makeAny(rKey)},
- {"SearchItem.Backward", uno::makeAny(false)}
+ {"SearchItem.Backward", uno::makeAny(false)},
+ {"SearchItem.Command", uno::makeAny(static_cast<sal_uInt16>(bFindAll ? SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND))},
}));
comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
}
@@ -414,6 +418,17 @@ void SdTiledRenderingTest::testSearch()
CPPUNIT_ASSERT_EQUAL(false, m_bFound);
}
+void SdTiledRenderingTest::testSearchAll()
+{
+ SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+
+ lcl_search("match", /*bFindAll=*/true);
+
+ OString aUsedFormat;
+ // This was empty: find-all did not highlight the first match.
+ CPPUNIT_ASSERT_EQUAL(OString("match"), pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat));
+}
+
#endif
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);