From 98ab3cef46179bd2cdc5e4bd8311a479cca204f4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 15 Nov 2023 21:33:35 -0700 Subject: [PATCH] Fix SelectionRectangle tests - Press-and-hold needs a release after the press. - Doing press-and-hold at 1,1 selects the top-left cell; at that time if we click at 1,1 again in an effort to get rid of the selection, we're actually clicking on a selection handle. Let's click outside instead. Amends c52710c10c4ec975a24fcb29799522d9dfdeac2f Change-Id: If5d459c063d2e2e1aa27a3bf0e13e8515607e701 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Qt CI Bot (cherry picked from commit 5b63e2a426e302bc01c38fa7ec1cc8ebe22ca0ac) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 1bc4315eafa932842de431f8bab688651eb6f5a1) --- .../quickcontrols/controls/data/tst_selectionrectangle.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/quickcontrols/controls/data/tst_selectionrectangle.qml b/tests/auto/quickcontrols/controls/data/tst_selectionrectangle.qml index 022cbff724..290d41216f 100644 --- a/tests/auto/quickcontrols/controls/data/tst_selectionrectangle.qml +++ b/tests/auto/quickcontrols/controls/data/tst_selectionrectangle.qml @@ -278,7 +278,7 @@ TestCase { // Ensure that a press and hold doesn't start a selection mousePress(tableView, 1, 1, Qt.LeftButton) - mousePress(tableView, 1, 1, Qt.LeftButton, Qt.NoModifier, 1000) + mouseRelease(tableView, 1, 1, Qt.LeftButton, Qt.NoModifier, 1000) verify(!tableView.selectionModel.hasSelection) } @@ -417,7 +417,7 @@ TestCase { verify(!tableView.selectionModel.hasSelection) // Do a press and hold mousePress(tableView, 1, 1, Qt.LeftButton) - mousePress(tableView, 1, 1, Qt.LeftButton, Qt.NoModifier, 1000) + mouseRelease(tableView, 1, 1, Qt.LeftButton, Qt.NoModifier, 1000) verify(tableView.selectionModel.hasSelection) compare(tableView.selectionModel.selectedIndexes.length, 1) verify(tableView.selectionModel.isSelected(tableView.model.index(0, 0))) @@ -426,7 +426,7 @@ TestCase { compare(activeSpy.count, 1) // Remove selection - mouseClick(tableView, 1, 1, Qt.LeftButton) + mouseClick(tableView, 100, 100, Qt.LeftButton) verify(!tableView.selectionModel.hasSelection) compare(draggingSpy.count, 0) compare(activeSpy.count, 2)