sc/qa/unit/uicalc/uicalc.cxx |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

New commits:
commit ef538b5441875cc3af97e25c83ed15b393d9bfce
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jul 18 15:22:08 2023 -0400
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Aug 8 16:44:47 2023 +0200

    tdf#155799: sc: qa: add unit test "testMouseMergeRef"
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I2e46a014a3a66fe41b06a07a68c75e52ae5530f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154602
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 2d1378c92c30..4259f56a7777 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2099,6 +2099,41 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testKeyboardMergeRef)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMouseMergeRef)
+{
+    createScDoc();
+    ScDocShell* pDocSh = getScDocShell();
+    ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+    ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+    CPPUNIT_ASSERT(pViewShell);
+
+    goToCell("A1:A5");
+    dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {});
+    goToCell("A6:A10");
+    dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {});
+
+    goToCell("B1");
+    typeString(u"=");
+
+    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: */

Reply via email to