summaryrefslogtreecommitdiff
path: root/sc/qa/unit/screenshots
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2018-05-06 22:40:05 -0400
committerEike Rathke <erack@redhat.com>2018-05-23 13:19:20 +0200
commita2e6f31c6f90e446d1462e7c80f6b1317f7825bc (patch)
tree3e009520526d97336d29ba6a45fb1ff22e7b14f5 /sc/qa/unit/screenshots
parent40cf5a9b3dd619a650a94d8b65bf6987125b75fb (diff)
tdf#117228: crash in SfxItemSet::GetItemState...
(unsigned short, bool, SfxPoolItem const**) when pasting comment of closed document Re-work commit 1b7a8277aa3e9f73ccdf15e933a1ee3b42849a44. In the tiled rendering case, each view has its own clipboard, but not in desktop version which it has a shared clipboard each view. Change-Id: I57b1ab81e4c141829dbad899330e5c22204c384a Reviewed-on: https://gerrit.libreoffice.org/53922 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/qa/unit/screenshots')
-rw-r--r--sc/qa/unit/screenshots/screenshots.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 59a10ef21dd9..9eb753dd61fd 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -20,6 +20,7 @@
#include <osl/file.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/lokhelper.hxx>
#include <svl/srchitem.hxx>
#include <svx/numinf.hxx>
#include <vcl/pngwrite.hxx>
@@ -72,9 +73,11 @@ public:
ScScreenshotTest();
void testOpeningModalDialogs();
+ void testMultiViewCopyPaste();
CPPUNIT_TEST_SUITE(ScScreenshotTest);
CPPUNIT_TEST(testOpeningModalDialogs);
+ CPPUNIT_TEST(testMultiViewCopyPaste);
CPPUNIT_TEST_SUITE_END();
};
@@ -286,6 +289,53 @@ void ScScreenshotTest::testOpeningModalDialogs()
mxComponent.clear();
}
+void ScScreenshotTest::testMultiViewCopyPaste()
+{
+ initialize();
+
+ ScDocument& rDoc = mxDocSh->GetDocument();
+
+ rDoc.SetString(ScAddress(0, 0, 0), "TestCopy1");
+ rDoc.SetString(ScAddress(1, 0, 0), "TestCopy2");
+
+ // view #1
+ ScTabViewShell* pView1 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ CPPUNIT_ASSERT(pView1);
+
+ // view #2
+ SfxLokHelper::createView();
+ ScTabViewShell* pView2 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ CPPUNIT_ASSERT(pView1 != pView2);
+ {
+ std::unique_ptr<SfxPoolItem> xItem1;
+ std::unique_ptr<SfxPoolItem> xItem2;
+ CPPUNIT_ASSERT(SfxItemState::DISABLED != pView1->GetViewFrame()->GetBindings().QueryState(SID_PASTE, xItem1));
+ CPPUNIT_ASSERT(SfxItemState::DISABLED != pView2->GetViewFrame()->GetBindings().QueryState(SID_PASTE, xItem2));
+ }
+
+ // copy text view 1
+ pView1->SetCursor(0, 0);
+ pView1->GetViewFrame()->GetBindings().Execute(SID_COPY);
+
+ // copy text view 2
+ pView2->SetCursor(1, 0);
+ pView2->GetViewFrame()->GetBindings().Execute(SID_COPY);
+
+ // paste text view 1
+ pView1->SetCursor(0, 1);
+ pView1->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+
+ // paste text view 2
+ pView2->SetCursor(1, 1);
+ pView2->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("TestCopy2"), rDoc.GetString(ScAddress(0, 1, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("TestCopy2"), rDoc.GetString(ScAddress(1, 1, 0)));
+
+ mxComponent->dispose();
+ mxComponent.clear();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScScreenshotTest);
CPPUNIT_PLUGIN_IMPLEMENT();