diff options
Diffstat (limited to 'sc/qa/unit/uicalc/uicalc.cxx')
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index ff8e84a03bff..d5973976441d 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2068,6 +2068,42 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testKeyboardMergeRef) } } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMouseMergeRef) +{ + 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); + + Point aA1 = pViewShell->GetViewData().GetPrintTwipsPos(0, 0); + Point aA6 = pViewShell->GetViewData().GetPrintTwipsPos(0, 5); + Point aA7 = pViewShell->GetViewData().GetPrintTwipsPos(0, 6); + + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aA1.X() + 5, aA1.Y() + 5, 1, MOUSE_LEFT, 0); + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, aA6.X() + 5, aA6.Y() + 5, 1, MOUSE_LEFT, 0); + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aA7.X() + 5, aA7.Y() + 5, 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT(pViewShell->IsRefInputMode()); + { + const OUString* pInput = pViewShell->GetEditString(); + CPPUNIT_ASSERT(pInput); + CPPUNIT_ASSERT_EQUAL(OUString("=A1:A10"), *pInput); + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |