sc/qa/unit/uicalc/data/tdf156462.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx         |   15 +++++++++++++++
 2 files changed, 15 insertions(+)

New commits:
commit cfb1e6354e095d0addf9f7a1114902b2bce5f627
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Aug 1 16:17:32 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 1 19:33:34 2023 +0200

    tdf#156462: sc_uicalc: Add unittest
    
    Change-Id: Ib02bcb33c243450cdc94328e07d02510d50eb7c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155164
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/uicalc/data/tdf156462.ods 
b/sc/qa/unit/uicalc/data/tdf156462.ods
new file mode 100644
index 000000000000..3f77ac3be0b3
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf156462.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index d96b78b87136..9a795f4a5bde 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1227,6 +1227,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf68290)
     lcl_AssertCurrentCursorPosition(*pDocSh, u"M3");
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf156462)
+{
+    createScDoc("tdf156462.ods");
+    ScDocShell* pDocSh = getScDocShell();
+
+    lcl_AssertCurrentCursorPosition(*pDocSh, u"G2");
+
+    ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_LEFT);
+    Scheduler::ProcessEventsToIdle();
+
+    // Without the fix in place, the cursor would have jumped to cell C2
+    lcl_AssertCurrentCursorPosition(*pDocSh, u"D2");
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057)
 {
     createScDoc("tdf132057.ods");

Reply via email to