desktop/qa/data/empty.ods |binary desktop/qa/desktop_lib/test_desktop_lib.cxx | 43 ++++++++++++++++++++++++++++ sc/source/ui/view/cellsh3.cxx | 3 + 3 files changed, 46 insertions(+)
New commits: commit 9c32424797ad5c40b4dba0e8726a159e48dcacb2 Author: Gökay Şatır <[email protected]> AuthorDate: Wed Jul 16 14:45:10 2025 +0300 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jul 28 09:31:37 2025 +0200 Call UpdateInputHandler after handling AcceptFormula uno command. Issue: On Online side, setting focus on the calc input bar doesn't allow to continue typing. Steps: 1. open calc 2. start typing into cell 3. click "accept formula" button 4. click again at formulabar 5. try to type UpdateInputHandler finalizes the text editing and send notification back to the client. Also a test is added to ensure that formula bar gets "setText" event after sending "AcceptFormula" uno command. Signed-off-by: Gökay Şatır <[email protected]> Change-Id: I8e3a64753deeb908f7727b0473596f6f3c07ff4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187959 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/desktop/qa/data/empty.ods b/desktop/qa/data/empty.ods new file mode 100644 index 000000000000..8d9e14cf449c Binary files /dev/null and b/desktop/qa/data/empty.ods differ diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 0f7806287c92..0174853f1982 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -156,6 +156,7 @@ public: void testGetPartPageRectangles(); void testSearchCalc(); void testPropertySettingOnFormulaBar(); + void testFormulaBarAcceptButton(); void testSearchAllNotificationsCalc(); void testPaintTile(); void testSaveAs(); @@ -234,6 +235,7 @@ public: CPPUNIT_TEST(testGetPartPageRectangles); CPPUNIT_TEST(testSearchCalc); CPPUNIT_TEST(testPropertySettingOnFormulaBar); + CPPUNIT_TEST(testFormulaBarAcceptButton); CPPUNIT_TEST(testSearchAllNotificationsCalc); CPPUNIT_TEST(testPaintTile); CPPUNIT_TEST(testSaveAs); @@ -3184,6 +3186,47 @@ void DesktopLOKTest::testPropertySettingOnFormulaBar() CPPUNIT_ASSERT_EQUAL(false, aView.m_stateBold); // This line doesn't pass without the fix in this commit. } +void DesktopLOKTest::testFormulaBarAcceptButton() +{ + LibLibreOffice_Impl aOffice; + LibLODocument_Impl* pDocument = loadDoc("empty.ods"); + Scheduler::ProcessEventsToIdle(); + + pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}"); + Scheduler::ProcessEventsToIdle(); + + ViewCallback aView(pDocument); + Scheduler::ProcessEventsToIdle(); + + // Go to A1. + pDocument->pClass->postMouseEvent(pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 1000, 150, 1, 1, 0); + pDocument->pClass->postMouseEvent(pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, 1000, 150, 1, 1, 0); + Scheduler::ProcessEventsToIdle(); + + // Set the focus to formulabar. + pDocument->pClass->sendDialogEvent(pDocument, 0, "{\"id\":\"sc_input_window\", \"cmd\": \"grab_focus\", \"data\": \"null\", \"type\": \"drawingarea\"}"); + Scheduler::ProcessEventsToIdle(); + + // Set selection (nothing selected). + pDocument->pClass->sendDialogEvent(pDocument, 0, "{\"id\":\"sc_input_window\", \"cmd\": \"textselection\", \"data\": \"0;0;0;0\", \"type\": \"drawingarea\"}"); + Scheduler::ProcessEventsToIdle(); + + // Set text. + pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "H"); + pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "H"); + Scheduler::ProcessEventsToIdle(); + + aView.m_JSONDialog.clear(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:AcceptFormula", nullptr, false); + Scheduler::ProcessEventsToIdle(); + // Client should have receive a JSDialog event for formulabar by now. + + // These lines don't pass without the fix in this commit. + CPPUNIT_ASSERT_EQUAL(std::string("formulabar"), aView.m_JSONDialog.get_child("jsontype").get_value<std::string>()); + CPPUNIT_ASSERT_EQUAL(std::string("setText"), aView.m_JSONDialog.get_child("data").get_child("action_type").get_value<std::string>()); + CPPUNIT_ASSERT_EQUAL(std::string("sc_input_window"), aView.m_JSONDialog.get_child("data").get_child("control_id").get_value<std::string>()); +} + void DesktopLOKTest::testRunMacro() { LibLibreOffice_Impl aOffice; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 2a9d6b94ebd4..74e7169e4f98 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -1074,7 +1074,10 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_ACCEPT_FORMULA: { if (GetViewData().HasEditView(GetViewData().GetActivePart())) + { pScMod->InputEnterHandler(); + pTabViewShell->UpdateInputHandler(); + } } break;
