+ expectedSelection.clear();
+ expectedSelection << index[2] << index[3] << index[4];
+ verifyCurrentItemAndSelection(view, index[4], expectedSelection);
+
+ /**
+ * Starting a drag&drop operation should not clear the selection, see
+ *
+ * https://bugs.kde.org/show_bug.cgi?id=158649
+ */
+
+ view.clearSelection();
+ QVERIFY(view.selectionModel()->selectedIndexes().isEmpty());
+
+ // Click item 0 ("a")
+ kDebug() << "Click on \"a\"";
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(index[0]).center());
+ verifyCurrentItemAndSelection(view, index[0]);
+
+ // Shift-Down -> "a" and "b" should be selected
+ kDebug() << "Shift-Down";
+ QTest::keyClick(view.viewport(), Qt::Key_Down, Qt::ShiftModifier);
+ expectedSelection.clear();
+ expectedSelection << index[0] << index[1];
+ verifyCurrentItemAndSelection(view, index[1], expectedSelection);
+
+ // Press mouse button on item 0 ("a"), but do not release it. Check that the selection is unchanged
+ kDebug() << "Mouse press on \"a\"";
+ QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(index[0]).center());
+ verifyCurrentItemAndSelection(view, index[0], expectedSelection);
+
+ // Move mouse to item 1 ("b"), check that selection is unchanged
+ kDebug() << "Move mouse to \"b\"";
+ QMouseEvent moveEvent(QEvent::MouseMove, view.visualRect(index[1]).center(), Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
+ bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent);
+ QVERIFY(moveEventReceived);
+ verifyCurrentItemAndSelection(view, index[0], expectedSelection);
+
+ // Release mouse button on item 1 ("b"), check that selection is unchanged
+ kDebug() << "Mouse release on \"b\"";
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(index[1]).center());
+ verifyCurrentItemAndSelection(view, index[0], expectedSelection);