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 c52710c10c

Pick-to: 6.5 6.6
Change-Id: If5d459c063d2e2e1aa27a3bf0e13e8515607e701
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Shawn Rutledge 2023-11-15 21:33:35 -07:00
parent 3240470c94
commit 5b63e2a426
1 changed files with 3 additions and 3 deletions

View File

@ -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)
}
@ -537,7 +537,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)))
@ -546,7 +546,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)