summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-06-07 10:01:55 +0900
committerMiklos Vajna <vmiklos@collabora.com>2021-06-15 14:02:31 +0200
commit4ea943c00f69f418fd9b9ab72d2d153714a34ebc (patch)
treeed36672620b27ac58e6d3f832b170aef2f0a2117 /sd
parent51180d95d50257a2651d58250c9db3e7db7fa4c8 (diff)
tdf#142478 add test that triggers find all and crashes
String "Crash" in document and notes, then trigger "find all", which produced a crash without the fix in-place. Change-Id: I8e6e4a9da1afc85643648aee36a03c1fb39ca16d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116769 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 7f059ce157da0de40a98f63f61d923cc67d93884) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117150 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/odp/search-all-notes.odpbin0 -> 12018 bytes
-rw-r--r--sd/qa/unit/uiimpress.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/search-all-notes.odp b/sd/qa/unit/data/odp/search-all-notes.odp
new file mode 100644
index 000000000000..6c38ecabb0ea
--- /dev/null
+++ b/sd/qa/unit/data/odp/search-all-notes.odp
Binary files differ
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index fe1a7412adf2..72a25a40673c 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -22,6 +22,7 @@
#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/intitem.hxx>
+#include <svl/srchitem.hxx>
#include <svx/svxids.hrc>
#include <svx/svdoashp.hxx>
#include <svx/svdotable.hxx>
@@ -383,6 +384,30 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSpellOnlineParameter)
CPPUNIT_ASSERT_EQUAL(!bSet, pImpressDocument->GetDoc()->GetOnlineSpell());
}
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSearchAllInDocumentAndNotes)
+{
+ // tdf#142478
+ // "find all" produces a crash when the search string exists in notes
+ // and the document
+
+ mxComponent = loadFromDesktop(
+ m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/search-all-notes.odp"));
+
+ auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+ sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+ CPPUNIT_ASSERT(pViewShell);
+
+ uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({
+ { "SearchItem.SearchString", uno::makeAny(OUString("Crash")) },
+ { "SearchItem.Backward", uno::makeAny(false) },
+ { "SearchItem.Command", uno::makeAny(sal_uInt16(SvxSearchCmd::FIND_ALL)) },
+ }));
+
+ dispatchCommand(mxComponent, ".uno:ExecuteSearch", aPropertyValues);
+
+ Scheduler::ProcessEventsToIdle();
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */