diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-24 12:43:12 +0000 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-03-24 15:09:41 +0000 |
commit | 4df2a951b05197448e310cb003449658e52b45fb (patch) | |
tree | 9dc80a6cc6b8a64a68d142d7b9433fa4afd64122 /sc | |
parent | 5bab8fc3b9dd27c0e37cf9a62b1b27c2bf243788 (diff) |
Revert "qa: call ProcessEventsToIdle inside dispatchCommand"
This reverts commit 1029afe2fa49a3a326ca529a68e99e2a7239a395.
number of failures in CppunitTest_sc_uicalc has increased since
this patch was backported. reverting it to find out for sure whether
this introduced it or not
Change-Id: I670412d9445aee5ca2d65f647a82b993682d088f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149518
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/jumbosheets-test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 37 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 81 |
3 files changed, 122 insertions, 0 deletions
diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 0dec10967751..05b2c2248650 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -272,10 +272,12 @@ void ScJumboSheetsTest::testTdf134553() pViewShell->SelectObject(u"Diagram 1"); dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount()); dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); pOleObj = pPage->GetObj(0); CPPUNIT_ASSERT(pOleObj); @@ -315,8 +317,10 @@ void ScJumboSheetsTest::testTdf147509() CPPUNIT_ASSERT_EQUAL(sal_Int32(0), ScDocShell::GetViewData()->GetCurY()); dispatchCommand(mxComponent, ".uno:SelectColumn", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:InsertColumnsAfter", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("A"), pDoc->GetString(ScAddress(0, 0, 0))); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index b7dd40111a90..fb8af68bdd7e 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -768,6 +768,7 @@ void ScTiledRenderingTest::testTextViewSelection() // Create a selection on two cells in the second view, that's a text selection in LOK terms. aView1.m_bTextViewSelectionInvalidated = false; dispatchCommand(mxComponent, ".uno:GoRightSel", {}); + Scheduler::ProcessEventsToIdle(); // Make sure the first view got its notification. CPPUNIT_ASSERT(aView1.m_bTextViewSelectionInvalidated); } @@ -784,6 +785,7 @@ void ScTiledRenderingTest::testDocumentSizeChanged() comphelper::makePropertyValue("ToPoint", OUString("$A$30")), }; dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + Scheduler::ProcessEventsToIdle(); // Assert that the size in the payload is not 0. CPPUNIT_ASSERT(m_aDocumentSize.getWidth() > 0); CPPUNIT_ASSERT(m_aDocumentSize.getHeight() > 0); @@ -856,6 +858,7 @@ void ScTiledRenderingTest::testMoveShapeHandle() {"NewPosY", uno::Any(y+1)} })); dispatchCommand(mxComponent, ".uno:MoveShapeHandle", aPropertyValues); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(!aView1.m_ShapeSelection.isEmpty()); lcl_extractHandleParameters(aView1.m_ShapeSelection, id, x ,y); CPPUNIT_ASSERT_EQUAL(x-1, oldX); @@ -1078,6 +1081,7 @@ void ScTiledRenderingTest::testAutoSum() uno::Sequence<beans::PropertyValue> aArgs; dispatchCommand(mxComponent, ".uno:AutoSum", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_sCellFormula.startsWith("=SUM(")); } @@ -1097,6 +1101,7 @@ void ScTiledRenderingTest::testHideColRow() })); dispatchCommand(mxComponent, ".uno:SelectColumn", aArgs2); + Scheduler::ProcessEventsToIdle(); } SCCOL nOldCurX = ScDocShell::GetViewData()->GetCurX(); @@ -1104,6 +1109,7 @@ void ScTiledRenderingTest::testHideColRow() { uno::Sequence<beans::PropertyValue> aArgs; dispatchCommand(mxComponent, ".uno:HideColumn", aArgs); + Scheduler::ProcessEventsToIdle(); } SCCOL nNewCurX = ScDocShell::GetViewData()->GetCurX(); @@ -1122,6 +1128,7 @@ void ScTiledRenderingTest::testHideColRow() { "Modifier", uno::Any(sal_uInt16(0)) } })); dispatchCommand(mxComponent, ".uno:SelectRow", aArgs2); + Scheduler::ProcessEventsToIdle(); } nOldCurX = ScDocShell::GetViewData()->GetCurX(); @@ -1129,6 +1136,7 @@ void ScTiledRenderingTest::testHideColRow() { uno::Sequence<beans::PropertyValue> aArgs; dispatchCommand(mxComponent, ".uno:HideRow", aArgs); + Scheduler::ProcessEventsToIdle(); } nNewCurX = ScDocShell::GetViewData()->GetCurX(); nNewCurY = ScDocShell::GetViewData()->GetCurY(); @@ -1167,6 +1175,7 @@ void ScTiledRenderingTest::testInvalidateOnCopyPasteCells() // paste cells aView.m_bInvalidateTiles = false; dispatchCommand(mxComponent, ".uno:Paste", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); } @@ -1191,6 +1200,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() aView.m_bInvalidateTiles = false; aView.m_aInvalidations.clear(); dispatchCommand(mxComponent, ".uno:InsertRows", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 51240, 32212230, 63990), aView.m_aInvalidations[0]); @@ -1207,6 +1217,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() aView.m_bInvalidateTiles = false; aView.m_aInvalidations.clear(); dispatchCommand(mxComponent, ".uno:InsertColumns", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(254925, -15, 32212230, 63990), aView.m_aInvalidations[0]); @@ -1236,6 +1247,7 @@ void ScTiledRenderingTest::testCommentCallback() {"Author", uno::Any(OUString("LOK User1"))}, })); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView1.m_aCommentCallbackResult.get<std::string>("action")); @@ -1266,6 +1278,7 @@ void ScTiledRenderingTest::testCommentCallback() {"Author", uno::Any(OUString("LOK User2"))}, }); dispatchCommand(mxComponent, ".uno:EditAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Modify' action CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView1.m_aCommentCallbackResult.get<std::string>("action")); @@ -1287,6 +1300,7 @@ void ScTiledRenderingTest::testCommentCallback() {"Id", uno::Any(OUString::createFromAscii(aCommentId.c_str()))} }); dispatchCommand(mxComponent, ".uno:DeleteNote", aArgs); + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Remove' action CPPUNIT_ASSERT_EQUAL(std::string("Remove"), aView1.m_aCommentCallbackResult.get<std::string>("action")); @@ -1330,12 +1344,14 @@ void ScTiledRenderingTest::testUndoLimiting() // try to execute undo in view #2 SfxLokHelper::setView(nView2); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // check that undo has not been executed on view #2 CPPUNIT_ASSERT_EQUAL(std::size_t(1), pUndoManager->GetUndoActionCount()); // try to execute undo in view #1 SfxLokHelper::setView(nView1); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // check that undo has been executed on view #1 CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetUndoActionCount()); @@ -1345,12 +1361,14 @@ void ScTiledRenderingTest::testUndoLimiting() // try to execute redo in view #2 SfxLokHelper::setView(nView2); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); // check that redo has not been executed on view #2 CPPUNIT_ASSERT_EQUAL(std::size_t(1), pUndoManager->GetRedoActionCount()); // try to execute redo in view #1 SfxLokHelper::setView(nView1); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); // check that redo has been executed on view #1 CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetRedoActionCount()); } @@ -1388,6 +1406,7 @@ void ScTiledRenderingTest::testUndoRepairDispatch() // try to execute undo in view #2 SfxLokHelper::setView(nView2); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // check that undo has not been executed on view #2 CPPUNIT_ASSERT_EQUAL(std::size_t(1), pUndoManager->GetUndoActionCount()); @@ -1398,6 +1417,7 @@ void ScTiledRenderingTest::testUndoRepairDispatch() {"Repair", uno::Any(true)} })); dispatchCommand(mxComponent, ".uno:Undo", aPropertyValues); + Scheduler::ProcessEventsToIdle(); // check that undo has been executed on view #2 in repair mode CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetUndoActionCount()); } @@ -1427,12 +1447,14 @@ void ScTiledRenderingTest::testInsertGraphicInvalidations() { "FileName", uno::Any(createFileURL(u"smile.png")) } })); dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); // undo image insertion in view and see if both views are invalidated aView.m_bInvalidateTiles = false; uno::Sequence<beans::PropertyValue> aArgs2; dispatchCommand(mxComponent, ".uno:Undo", aArgs2); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); } @@ -1930,6 +1952,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() { "Index", uno::Any(sal_Int32(1)) } })); dispatchCommand(mxComponent, ".uno:Insert", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); @@ -1942,6 +1965,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() { "Index", uno::Any(sal_Int32(1)) } })); dispatchCommand(mxComponent, ".uno:Remove", aArgs2); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(5), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); @@ -2755,6 +2779,7 @@ void ScTiledRenderingTest::testSheetViewDataCrash() { "Index", uno::Any(sal_Int32(2)) } })); dispatchCommand(mxComponent, ".uno:Insert", aArgs); + Scheduler::ProcessEventsToIdle(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); @@ -2789,6 +2814,7 @@ void ScTiledRenderingTest::testTextBoxInsert() { "CreateDirectly", uno::Any(true) } })); dispatchCommand(mxComponent, ".uno:DrawText", aArgs); + Scheduler::ProcessEventsToIdle(); // check if we have textbox selected CPPUNIT_ASSERT(!aView1.m_ShapeSelection.isEmpty()); @@ -2826,6 +2852,7 @@ void ScTiledRenderingTest::testCommentCellCopyPaste() {"Author", uno::Any(OUString("LOK Client"))}, })); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView.m_aCommentCallbackResult.get<std::string>("action")); @@ -2842,10 +2869,12 @@ void ScTiledRenderingTest::testCommentCellCopyPaste() // Single cell(with comment) copy paste test { dispatchCommand(mxComponent, ".uno:Copy", aCopyPasteArgs); + Scheduler::ProcessEventsToIdle(); pTabViewShell->SetCursor(1, 49); Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Paste", aCopyPasteArgs); // Paste to cell B50 + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView.m_aCommentCallbackResult.get<std::string>("action")); @@ -2872,10 +2901,12 @@ void ScTiledRenderingTest::testCommentCellCopyPaste() Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Copy", aCopyPasteArgs); + Scheduler::ProcessEventsToIdle(); pTabViewShell->SetCursor(3, 49); Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Paste", aCopyPasteArgs); // Paste to cell D50 + Scheduler::ProcessEventsToIdle(); // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView.m_aCommentCallbackResult.get<std::string>("action")); @@ -2915,6 +2946,7 @@ void ScTiledRenderingTest::testInvalidEntrySave() uno::Sequence<beans::PropertyValue> aArgs; dispatchCommand(mxComponent, ".uno:Save", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("Should not be marked modified after save", !pDocSh->IsModified()); @@ -2978,12 +3010,14 @@ void ScTiledRenderingTest::testUndoReordering() // try to execute undo in view #1 SfxLokHelper::setView(nView1); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // check that undo has been executed on view #1 CPPUNIT_ASSERT_EQUAL(std::size_t(1), pUndoManager->GetUndoActionCount()); // try to execute undo in view #2 SfxLokHelper::setView(nView2); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // check that undo has been executed on view #2 CPPUNIT_ASSERT_EQUAL(std::size_t(0), pUndoManager->GetUndoActionCount()); } @@ -3053,6 +3087,7 @@ void ScTiledRenderingTest::testUndoReorderingRedo() // View 1 presses undo, and the second cell is erased SfxLokHelper::setView(nView1); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(std::size_t(2), pUndoManager->GetUndoActionCount()); CPPUNIT_ASSERT_EQUAL(OUString("xx"), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 0))); @@ -3072,6 +3107,7 @@ void ScTiledRenderingTest::testUndoReorderingRedo() // View 1 presses undo again, and the first cell is erased dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(std::size_t(1), pUndoManager->GetUndoActionCount()); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 0))); @@ -3141,6 +3177,7 @@ void ScTiledRenderingTest::testUndoReorderingMulti() // View 1 presses undo SfxLokHelper::setView(nView1); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(std::size_t(2), pUndoManager->GetUndoActionCount()); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString("CC"), pDoc->GetString(ScAddress(0, 2, 0))); diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 98d3398b09d8..25b4d0790383 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -298,10 +298,12 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994) goToCell("A1"); dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); goToCell("B1"); dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have failed with // - Expected: ='file:///tmp/lu124171irlmb.tmp'#$Sheet1.A1 @@ -386,9 +388,11 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) goToCell("A1"); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); goToCell("A2"); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_MESSAGE("There should be a note on A2", pDoc->HasNote(ScAddress(0, 1, 0))); @@ -396,8 +400,10 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) goToCell("A1"); dispatchCommand(mxComponent, ".uno:SelectRow", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + Scheduler::ProcessEventsToIdle(); for (size_t i = 0; i < 10; ++i) { @@ -406,6 +412,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) CPPUNIT_ASSERT_MESSAGE("There should be no note on A2", !pDoc->HasNote(ScAddress(0, 1, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("A"), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString("B"), pDoc->GetString(ScAddress(0, 1, 0))); @@ -413,15 +420,19 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) CPPUNIT_ASSERT_MESSAGE("There should be a note on A2", pDoc->HasNote(ScAddress(0, 1, 0))); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); } dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); goToCell("A1:A2"); dispatchCommand(mxComponent, ".uno:SelectRow", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + Scheduler::ProcessEventsToIdle(); for (size_t i = 0; i < 10; ++i) { @@ -431,6 +442,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) CPPUNIT_ASSERT_MESSAGE("There should be no note on A2", !pDoc->HasNote(ScAddress(0, 1, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("A"), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString("B"), pDoc->GetString(ScAddress(0, 1, 0))); @@ -438,6 +450,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107869) CPPUNIT_ASSERT_MESSAGE("There should be a note on A2", pDoc->HasNote(ScAddress(0, 1, 0))); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); } } @@ -484,6 +497,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf63805) CPPUNIT_ASSERT_EQUAL(OUString("2014-05-31"), pDoc->GetString(ScAddress(0, 19, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("2012-10-31"), pDoc->GetString(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 0))); @@ -530,13 +544,16 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf94208) goToCell("A3:A8"); dispatchCommand(mxComponent, ".uno:SelectRow", {}); + Scheduler::ProcessEventsToIdle(); //type Control-D/Fill Down dispatchCommand(mxComponent, ".uno:FillDown", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(0, 0, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have failed with // - Expected: 1 @@ -661,11 +678,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119162) // Without the fix in place, this test would have hung here dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString(u"Test" + OUStringChar(u'\xA')), pDoc->GetString(ScAddress(0, 0, 0))); dispatchCommand(mxComponent, ".uno:ChangeCaseToLower", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString(u"test" + OUStringChar(u'\xA')), pDoc->GetString(ScAddress(0, 0, 0))); @@ -689,6 +708,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf90579) goToCell("C1:C2"); dispatchCommand(mxComponent, ".uno:ConvertFormulaToValue", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("2310"), pDoc->GetString(ScAddress(2, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice"), pDoc->GetString(ScAddress(2, 1, 0))); @@ -696,6 +716,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf90579) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetFormula(2, 1, 0)); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("2310"), pDoc->GetString(ScAddress(2, 0, 0))); CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice"), pDoc->GetString(ScAddress(2, 1, 0))); @@ -711,6 +732,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124820) goToCell("B2"); dispatchCommand(mxComponent, ".uno:Strikeout", {}); + Scheduler::ProcessEventsToIdle(); saveAndReload("Calc Office Open XML"); pDoc = getScDoc(); @@ -733,6 +755,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119155) // Without the fix in place, this test would have hung here dispatchCommand(mxComponent, ".uno:ChangeCaseToTitleCase", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("Collagene Expert Targeted Wrinkle Corrector Unboxed 10 Ml"), pDoc->GetString(ScAddress(2, 1, 0))); @@ -755,6 +778,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146795) goToCell("B2"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Move to B3 ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); @@ -769,6 +793,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146795) // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("a"), pDoc->GetString(ScAddress(1, 1, 0))); CPPUNIT_ASSERT_EQUAL(OUString("a"), pDoc->GetString(ScAddress(1, 2, 0))); @@ -799,6 +824,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf147744) goToCell("A2"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Move to A3 ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); @@ -811,6 +837,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf147744) // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(0, 1, 0))); CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(ScAddress(0, 2, 0))); @@ -845,12 +872,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138432) goToCell("A1"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); goToCell("A2"); typeString(u"="); dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); @@ -1003,6 +1032,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf145640) goToCell("A2:F17"); dispatchCommand(mxComponent, ".uno:SortDescending", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A15:B15:C15:D15:E15:F15)"), pDoc->GetFormula(6, 3, 0)); @@ -1012,6 +1042,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf145640) CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(6, 3, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A4:B4:C4:D4:E4:F4)"), pDoc->GetFormula(6, 3, 0)); CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(6, 3, 0))); @@ -1039,10 +1070,12 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf97215) // Without the fix in place, this test would have hung here dispatchCommand(mxComponent, ".uno:SortAscending", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("Inserted at bottom"), pDoc->GetString(ScAddress(0, 0, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("Inserted at bottom"), pDoc->GetString(ScAddress(0, 23, 0))); @@ -1306,15 +1339,18 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) // Use Adding Selection dispatchCommand(mxComponent, ".uno:StatusSelectionModeExp", {}); + Scheduler::ProcessEventsToIdle(); goToCell("A1"); dispatchCommand(mxComponent, ".uno:SelectRow", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:GoDown", {}); dispatchCommand(mxComponent, ".uno:GoDown", {}); lcl_AssertCurrentCursorPosition(*pDocSh, u"A3"); dispatchCommand(mxComponent, ".uno:SelectRow", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Copy", {}); @@ -1370,11 +1406,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf149503) ScDocument* pDoc = getScDoc(); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); ScDPCollection* pDPs = pDoc->GetDPCollection(); CPPUNIT_ASSERT_EQUAL(size_t(1), pDPs->GetCount()); @@ -1386,8 +1425,10 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108292) ScDocument* pDoc = getScDoc(); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Open a new document createScDoc(); @@ -1395,6 +1436,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108292) // Without the fix in place, this test would have crashed dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("2D"), pDoc->GetString(ScAddress(26, 0, 0))); } @@ -1410,15 +1452,18 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol) // Use Adding Selection dispatchCommand(mxComponent, ".uno:StatusSelectionModeExp", {}); + Scheduler::ProcessEventsToIdle(); goToCell("A1"); dispatchCommand(mxComponent, ".uno:SelectColumn", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:GoRight", {}); dispatchCommand(mxComponent, ".uno:GoRight", {}); lcl_AssertCurrentCursorPosition(*pDocSh, u"C1"); dispatchCommand(mxComponent, ".uno:SelectColumn", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Copy", {}); @@ -1724,12 +1769,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108654) CPPUNIT_ASSERT_EQUAL(OUString("=VLOOKUP(C127,#REF!,D$1,0)"), aFormula); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(3, 126, 1); CPPUNIT_ASSERT_EQUAL(OUString(""), aFormula); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount()); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), pDoc->GetTableCount()); } @@ -1791,16 +1838,19 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326) CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount()); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(0, 0, 1); CPPUNIT_ASSERT_EQUAL(OUString(""), aFormula); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount()); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), pDoc->GetTableCount()); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount()); aFormula = pDoc->GetFormula(0, 0, 1); @@ -1808,6 +1858,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326) // Without the fix in place, it would have crashed here dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(0, 0, 1); CPPUNIT_ASSERT_EQUAL(OUString("=RAND()*1000000"), aFormula); @@ -1821,6 +1872,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126685) ScDocument* pDoc = getScDoc(); dispatchCommand(mxComponent, ".uno:SelectAll", {}); // test should crash here without the fix + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( OUString("Control Height will change from 0.65 to 0.61 cm with 120dpi ..."), @@ -1858,11 +1910,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119793) Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5084), xShape->getPosition().X); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have failed with // - Expected: 4984 @@ -1953,12 +2007,15 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124818) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount()); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Cut", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount()); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount()); } @@ -2135,12 +2192,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124822) CPPUNIT_ASSERT_EQUAL(OUString("X"), pDoc->GetString(ScAddress(0, 0, 2))); dispatchCommand(mxComponent, ".uno:SelectAll", {}); + Scheduler::ProcessEventsToIdle(); dispatchCommand(mxComponent, ".uno:Cut", {}); CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 2))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("X"), pDoc->GetString(ScAddress(0, 0, 2))); } @@ -2172,6 +2231,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf118189) // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(0, 77, 0); CPPUNIT_ASSERT_EQUAL(OUString("=FALSE()"), aFormula); @@ -2215,11 +2275,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf118207) CPPUNIT_ASSERT_EQUAL(OUString("=FALSE()"), aFormula); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(1, 77, 0); CPPUNIT_ASSERT_EQUAL(OUString("=FALSE()"), aFormula); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(1, 77, 0); CPPUNIT_ASSERT_EQUAL(OUString(""), aFormula); @@ -2227,6 +2289,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf118207) CPPUNIT_ASSERT_EQUAL(OUString(""), aFormula); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); aFormula = pDoc->GetFormula(0, 77, 0); CPPUNIT_ASSERT_EQUAL(OUString("=FALSE()"), aFormula); @@ -2255,6 +2318,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124778) uno::Sequence<beans::PropertyValue> aArgs = comphelper::InitPropertySequence({ { "Text", uno::Any(OUString("Comment")) } }); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); @@ -2279,6 +2343,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428) uno::Sequence<beans::PropertyValue> aArgs = comphelper::InitPropertySequence({ { "Text", uno::Any(OUString("Comment")) } }); dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); ScDocument* pDoc = getScDoc(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); @@ -2296,21 +2361,25 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428) // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_MESSAGE("There shouldn't be a note on B1", !pDoc->HasNote(ScAddress(1, 0, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There shouldn't be a note on A1", !pDoc->HasNote(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_MESSAGE("There shouldn't be a note on B1", !pDoc->HasNote(ScAddress(1, 0, 0))); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_MESSAGE("There shouldn't be a note on B1", !pDoc->HasNote(ScAddress(1, 0, 0))); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); CPPUNIT_ASSERT_MESSAGE("There should be a note on B1", pDoc->HasNote(ScAddress(1, 0, 0))); @@ -2352,6 +2421,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf130614) lcl_SelectObjectByName(*getViewShell(), u"Object 1"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Open a new document createScDoc(); @@ -2359,6 +2429,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf130614) // Without the fix in place, this test would have crashed here dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); SdrPage* pPage = pDrawLayer->GetPage(0); @@ -2616,11 +2687,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf134675) goToCell("A:A"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Select column B to Z goToCell("B:Z"); dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); for (size_t i = 1; i < 24; ++i) { @@ -2719,6 +2792,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107952) goToCell("D10"); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have failed with // - Expected: 1 @@ -2729,6 +2803,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107952) goToCell("D10"); dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); lcl_AssertCurrentCursorPosition(*pDocSh, u"B1"); } @@ -2765,11 +2840,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144022) goToCell("A5:B79"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); goToCell("D5"); //Without the fix in place, this test would have crashed dispatchCommand(mxComponent, ".uno:PasteTransposed", {}); + Scheduler::ProcessEventsToIdle(); for (size_t i = 3; i < 76; ++i) { @@ -2789,10 +2866,12 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf99386) goToCell("A1:B1"); dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(1, 1, 0))); dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(OUString("This"), pDoc->GetString(ScAddress(1, 0, 0))); @@ -2852,6 +2931,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152014) goToCell("A1"); dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); // Create a second document mxComponent2 = loadFromDesktop("private:factory/scalc"); @@ -2860,6 +2940,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152014) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xFrames->getCount()); dispatchCommand(mxComponent2, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); ScModelObj* pModelObj2 = dynamic_cast<ScModelObj*>(mxComponent2.get()); CPPUNIT_ASSERT(pModelObj2); |