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 <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli 2024-06-21 17:38:26 +02:00
parent 7274fcf957
commit 2e598ba083

View file

@ -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();