diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2025-02-05 18:01:48 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2025-02-05 21:18:37 +0100 |
commit | 311ec7341945365970a4ab35ad8da01ea4d845d0 (patch) | |
tree | b3504de5d282bff03fe7d80e2d6bfc452a5a84a2 /sc | |
parent | 12ed25fb94fbbee15389467dc6ae02eddf811c34 (diff) |
sc: Add test for the fill handle drag and drop
Change-Id: I4625b989800b07bf94db07af0e3feb568e9f015a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181190
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 82f9c296b1f1..86e638a5dc03 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2468,6 +2468,38 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMouseMergeRef) } } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testFillHandleDnD) +{ + // Test the fill handle drag and drop + createScDoc(); + + ScTabViewShell* pViewShell = getViewShell(); + + insertStringToCell(u"A1"_ustr, u"1"); + + // Select cell A1 to show the handle + goToCell(u"A1"_ustr); + + // B2 left top corner = A1 right bottom corner + Point aB2 = pViewShell->GetViewData().GetPrintTwipsPos(1, 1); + Point aA7 = pViewShell->GetViewData().GetPrintTwipsPos(0, 6); + + ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aB2.X() - 1, aB2.Y() - 1, 1, + MOUSE_LEFT, 0); + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, aA7.X(), aA7.Y(), 1, MOUSE_LEFT, 0); + pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aA7.X(), aA7.Y(), 1, MOUSE_LEFT, 0); + Scheduler::ProcessEventsToIdle(); + + ScDocument* pDoc = getScDoc(); + CPPUNIT_ASSERT_EQUAL(u"1"_ustr, pDoc->GetString(ScAddress(0, 0, 0))); + CPPUNIT_ASSERT_EQUAL(u"2"_ustr, pDoc->GetString(ScAddress(0, 1, 0))); + CPPUNIT_ASSERT_EQUAL(u"3"_ustr, pDoc->GetString(ScAddress(0, 2, 0))); + CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(ScAddress(0, 3, 0))); + CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetString(ScAddress(0, 4, 0))); + CPPUNIT_ASSERT_EQUAL(u"6"_ustr, pDoc->GetString(ScAddress(0, 5, 0))); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |