summaryrefslogtreecommitdiff
path: root/sc/qa/unit/screenshots/screenshots.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/unit/screenshots/screenshots.cxx')
-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();