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

New commits:
commit 2e598ba08311adaaaad5b9ea2b4279102ff0f379
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jun 21 17:38:26 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jul 26 18:39:13 2024 +0200

    CppunitTest_sc_uicalc: Test pasting with return key
    
    Initially this test was created to test tdf#161461
    but it needs some tweaks in order to reproduce it
    See 
https://gerrit.libreoffice.org/c/core/+/169341/comment/7c8fc703_8d6797d5/
    So at least add this test to test the paste with
    return key feature on Calc
    
    Change-Id: Ie3ae0975fa164fbf4c1d249649ab25cf0eeef0d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169341
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 023116d021af..68a4289417af 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -646,6 +646,31 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144308)
     xGlobalSheetSettings->setDoAutoComplete(bOldValue);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testPasteWithReturnKey)
+{
+    createScDoc();
+    ScDocument* pDoc = getScDoc();
+    ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+
+    insertStringToCell(u"A1"_ustr, u"Test");
+
+    goToCell(u"A1"_ustr);
+
+    for (SCROW i = 1; i <= 10; ++i)
+    {
+        dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+        dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {});
+
+        // Paste using Return
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
+        pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(u"Test"_ustr, pDoc->GetString(ScAddress(0, i, 
0)));
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf56036)
 {
     createScDoc();

Reply via email to