diff options
author | Henry Castro <hcastro@collabora.com> | 2023-07-18 15:21:02 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2023-08-14 15:44:25 +0200 |
commit | 6dcf44872dd89ec2203766cc685e31f16cea8ce5 (patch) | |
tree | b193d293af52a51e07bb29d560185f0747a027e7 | |
parent | 3089be0b87d02f363b97ccbb473d1798e202425c (diff) |
tdf#155799: sc: qa: add unit test "testKeyboardMergeRef"
Change-Id: I4d80ad5d9e5fe2c131f9397ec59c6c16ef92c094
Signed-off-by: Henry Castro <hcastro@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155004
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155631
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 6f1c490b90f4..ff8e84a03bff 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2026,6 +2026,48 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testKeyboardMergeRef) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(mxComponent); + CPPUNIT_ASSERT(pFoundShell); + ScDocShell* pDocSh = dynamic_cast<ScDocShell*>(pFoundShell); + CPPUNIT_ASSERT(pDocSh); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false); + CPPUNIT_ASSERT(pViewShell); + + goToCell("A1:A5"); + dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + goToCell("A6:A10"); + dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + + insertStringToCell(*pModelObj, "B1", "=", false); + + goToCell("A1"); + + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_SHIFT); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(pViewShell->IsRefInputMode()); + { + const OUString* pInput = pViewShell->GetEditString(); + CPPUNIT_ASSERT(pInput); + CPPUNIT_ASSERT_EQUAL(OUString("=A1:A10"), *pInput); + } + + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_UP | KEY_SHIFT); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_UP | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(pViewShell->IsRefInputMode()); + { + const OUString* pInput = pViewShell->GetEditString(); + CPPUNIT_ASSERT(pInput); + CPPUNIT_ASSERT_EQUAL(OUString("=A1:A5"), *pInput); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |