diff options
Diffstat (limited to 'tests')
20 files changed, 339 insertions, 46 deletions
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index 17c51eaaf4..569c610e24 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -53,6 +53,7 @@ void tst_QNoDebug::noDebugOutput() const // should do nothing qDebug() << "foo"; qCDebug(cat) << "foo"; + qCDebug(cat, "foo"); // qWarning still works, though QTest::ignoreMessage(QtWarningMsg, "bar"); diff --git a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro index 541e73636c..3745782dfc 100644 --- a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro +++ b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro @@ -9,7 +9,7 @@ SUBDIRS = lib \ tst.depends += almostplugin SUBDIRS += almostplugin } -macos:qtConfig(private_tests) { +macos:qtConfig(private_tests):qtHaveModule(gui) { tst.depends += machtest SUBDIRS += machtest } diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index db5e83e2c7..13dc924f93 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -204,6 +204,7 @@ private slots: void basicRawEventTranslationOfIds(); void multiPointRawEventTranslationOnTouchScreen(); void multiPointRawEventTranslationOnTouchPad(); + void touchOnMultipleTouchscreens(); void deleteInEventHandler(); void deleteInRawEventTranslation(); void crashInQGraphicsSceneAfterNotHandlingTouchBegin(); @@ -213,11 +214,13 @@ private slots: private: QTouchDevice *touchScreenDevice; + QTouchDevice *secondaryTouchScreenDevice; QTouchDevice *touchPadDevice; }; tst_QTouchEvent::tst_QTouchEvent() : touchScreenDevice(QTest::createTouchDevice()) + , secondaryTouchScreenDevice(QTest::createTouchDevice()) , touchPadDevice(QTest::createTouchDevice(QTouchDevice::TouchPad)) { } @@ -225,6 +228,7 @@ tst_QTouchEvent::tst_QTouchEvent() void tst_QTouchEvent::cleanup() { QVERIFY(QGuiApplication::topLevelWindows().isEmpty()); + QWindowSystemInterfacePrivate::clearPointIdMap(); } void tst_QTouchEvent::qPointerUniqueId() @@ -951,6 +955,157 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen() } } +void tst_QTouchEvent::touchOnMultipleTouchscreens() +{ + tst_QTouchEventWidget touchWidget; + touchWidget.setWindowTitle(QTest::currentTestFunction()); + touchWidget.setAttribute(Qt::WA_AcceptTouchEvents); + touchWidget.setGeometry(100, 100, 400, 300); + touchWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); + QWindow *window = touchWidget.windowHandle(); + + QPointF pos = touchWidget.rect().center(); + QPointF screenPos = touchWidget.mapToGlobal(pos.toPoint()); + QPointF delta(10, 10); + QRectF screenGeometry = QApplication::desktop()->screenGeometry(&touchWidget); + + QVector<QTouchEvent::TouchPoint> rawTouchPoints(3); + rawTouchPoints[0].setId(0); + rawTouchPoints[1].setId(10); + rawTouchPoints[2].setId(11); + + // this should be translated to a TouchBegin + rawTouchPoints[0].setState(Qt::TouchPointPressed); + rawTouchPoints[0].setScreenPos(screenPos); + rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry)); + rawTouchPoints[0].setRawScreenPositions({{12, 34}, {56, 78}}); + ulong timestamp = 1234; + QList<QWindowSystemInterface::TouchPoint> nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window); + QWindowSystemInterface::handleTouchEvent(window, timestamp, touchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(touchWidget.seenTouchBegin); + QVERIFY(!touchWidget.seenTouchUpdate); + QVERIFY(!touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.timestamp, timestamp); + QTouchEvent::TouchPoint touchBeginPoint = touchWidget.touchBeginPoints.first(); + const int touchPointId = (QTouchDevicePrivate::get(touchScreenDevice)->id << 24) + 1; + const int secTouchPointId = (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2; + QCOMPARE(touchBeginPoint.id(), touchPointId); + QCOMPARE(touchBeginPoint.state(), rawTouchPoints[0].state()); + QCOMPARE(touchBeginPoint.pos(), pos); + + // press a point on secondaryTouchScreenDevice + touchWidget.seenTouchBegin = false; + rawTouchPoints[1].setState(Qt::TouchPointPressed); + rawTouchPoints[1].setScreenPos(screenPos); + rawTouchPoints[1].setNormalizedPos(normalized(rawTouchPoints[1].pos(), screenGeometry)); + rawTouchPoints[1].setRawScreenPositions({{90, 100}, {110, 120}}); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[1], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(!touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.timestamp, timestamp); + touchBeginPoint = touchWidget.touchBeginPoints[0]; + QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 2); + QCOMPARE(touchBeginPoint.state(), rawTouchPoints[1].state()); + QCOMPARE(touchBeginPoint.pos(), pos); + + // press another point on secondaryTouchScreenDevice + touchWidget.seenTouchBegin = false; + rawTouchPoints[2].setState(Qt::TouchPointPressed); + rawTouchPoints[2].setScreenPos(screenPos); + rawTouchPoints[2].setNormalizedPos(normalized(rawTouchPoints[2].pos(), screenGeometry)); + rawTouchPoints[2].setRawScreenPositions({{130, 140}, {150, 160}}); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[2], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(!touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchBeginPoints.count(), 1); + QCOMPARE(touchWidget.timestamp, timestamp); + touchBeginPoint = touchWidget.touchBeginPoints[0]; + QCOMPARE(touchBeginPoint.id(), (QTouchDevicePrivate::get(secondaryTouchScreenDevice)->id << 24) + 3); + QCOMPARE(touchBeginPoint.state(), rawTouchPoints[2].state()); + QCOMPARE(touchBeginPoint.pos(), pos); + + // moving the first point should translate to TouchUpdate + rawTouchPoints[0].setState(Qt::TouchPointMoved); + rawTouchPoints[0].setScreenPos(screenPos + delta); + rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry)); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(touchWidget.seenTouchBegin); + QVERIFY(touchWidget.seenTouchUpdate); + QVERIFY(!touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchUpdatePoints.count(), 1); + QTouchEvent::TouchPoint touchUpdatePoint = touchWidget.touchUpdatePoints.first(); + QCOMPARE(touchUpdatePoint.id(), touchPointId); + QCOMPARE(touchUpdatePoint.state(), rawTouchPoints[0].state()); + QCOMPARE(touchUpdatePoint.pos(), pos + delta); + + // releasing the first point translates to TouchEnd + rawTouchPoints[0].setState(Qt::TouchPointReleased); + rawTouchPoints[0].setScreenPos(screenPos + delta + delta); + rawTouchPoints[0].setNormalizedPos(normalized(rawTouchPoints[0].pos(), screenGeometry)); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[0], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, touchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(touchWidget.seenTouchBegin); + QVERIFY(touchWidget.seenTouchUpdate); + QVERIFY(touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchEndPoints.count(), 1); + QTouchEvent::TouchPoint touchEndPoint = touchWidget.touchEndPoints.first(); + QCOMPARE(touchEndPoint.id(), touchPointId); + QCOMPARE(touchEndPoint.state(), rawTouchPoints[0].state()); + QCOMPARE(touchEndPoint.pos(), pos + delta + delta); + + // Widgets don't normally handle this case: if a TouchEnd was seen before, then + // WA_WState_AcceptedTouchBeginEvent will be false, and + // QApplicationPrivate::translateRawTouchEvent will ignore touch events that aren't TouchBegin. + // So we have to set it true. It _did_ in fact accept the touch begin from the secondary device, + // but it also got a TouchEnd from the primary device in the meantime. + touchWidget.setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, true); + + // Releasing one point on the secondary touchscreen does not yet generate TouchEnd. + touchWidget.seenTouchEnd = false; + touchWidget.touchEndPoints.clear(); + rawTouchPoints[1].setState(Qt::TouchPointReleased); + rawTouchPoints[2].setState(Qt::TouchPointStationary); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[1] << rawTouchPoints[2], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(touchWidget.seenTouchBegin); + QVERIFY(touchWidget.seenTouchUpdate); + QVERIFY(!touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchUpdatePoints.count(), 2); + QCOMPARE(touchWidget.touchUpdatePoints[0].id(), secTouchPointId); + QCOMPARE(touchWidget.touchUpdatePoints[1].id(), secTouchPointId + 1); + + // releasing the last point on the secondary touchscreen translates to TouchEnd + touchWidget.seenTouchEnd = false; + rawTouchPoints[2].setState(Qt::TouchPointReleased); + nativeTouchPoints = + QWindowSystemInterfacePrivate::toNativeTouchPoints(QList<QTouchEvent::TouchPoint>() << rawTouchPoints[2], window); + QWindowSystemInterface::handleTouchEvent(window, ++timestamp, secondaryTouchScreenDevice, nativeTouchPoints); + QCoreApplication::processEvents(); + QVERIFY(touchWidget.seenTouchBegin); + QVERIFY(touchWidget.seenTouchUpdate); + QVERIFY(touchWidget.seenTouchEnd); + QCOMPARE(touchWidget.touchEndPoints.count(), 1); + touchEndPoint = touchWidget.touchEndPoints.first(); + QCOMPARE(touchEndPoint.id(), secTouchPointId + 1); + QCOMPARE(touchEndPoint.state(), rawTouchPoints[2].state()); +} + void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() { tst_QTouchEventWidget touchWidget; diff --git a/tests/auto/network/access/hpack/tst_hpack.cpp b/tests/auto/network/access/hpack/tst_hpack.cpp index 810745a065..d5e359db57 100644 --- a/tests/auto/network/access/hpack/tst_hpack.cpp +++ b/tests/auto/network/access/hpack/tst_hpack.cpp @@ -57,7 +57,6 @@ private Q_SLOTS: void lookupTableConstructor(); - void lookupTableStatic_data(); void lookupTableStatic(); void lookupTableDynamic(); @@ -126,7 +125,7 @@ void tst_Hpack::bitstreamConstruction() // 'Read' some data back: for (int i = 0; i < size; ++i) { uchar bitPattern = 0; - const auto bitsRead = in.peekBits(i * 8, 8, &bitPattern); + const auto bitsRead = in.peekBits(quint64(i * 8), 8, &bitPattern); QVERIFY(bitsRead == 8); QVERIFY(bitPattern == bytes[i]); } @@ -282,7 +281,7 @@ void tst_Hpack::bitstreamCompression() const auto start = QRandomGenerator::global()->bounded(uint(bytes.length()) / 2); auto end = start * 2; if (!end) - end = bytes.length() / 2; + end = unsigned(bytes.length() / 2); strings.push_back(bytes.substr(start, end - start)); const auto &s = strings.back(); totalStringBytes += s.size(); @@ -384,43 +383,21 @@ void tst_Hpack::lookupTableConstructor() } } -void tst_Hpack::lookupTableStatic_data() -{ - QTest::addColumn<QByteArray>("expectedName"); - QTest::addColumn<QByteArray>("expectedValue"); - - // Some predefined fields to find - // (they are always defined/required by HPACK). - QTest::newRow(":authority|") << QByteArray(":authority") << QByteArray(""); - QTest::newRow(":method|GET") << QByteArray(":method") << QByteArray("GET"); - QTest::newRow(":method|POST") << QByteArray(":method") << QByteArray("POST"); - QTest::newRow(":path|/") << QByteArray(":path") << QByteArray("/"); - QTest::newRow(":path|/index.html") << QByteArray(":path") << QByteArray("/index.html"); - QTest::newRow(":scheme|http") << QByteArray(":scheme") << QByteArray("http"); - QTest::newRow(":scheme|https") << QByteArray(":scheme") << QByteArray("https"); - QTest::newRow(":status|200") << QByteArray(":status") << QByteArray("200"); - QTest::newRow(":status|204") << QByteArray(":status") << QByteArray("204"); - QTest::newRow(":status|206") << QByteArray(":status") << QByteArray("206"); - QTest::newRow(":status|304") << QByteArray(":status") << QByteArray("304"); - QTest::newRow(":status|400") << QByteArray(":status") << QByteArray("400"); - QTest::newRow(":status|404") << QByteArray(":status") << QByteArray("404"); - QTest::newRow(":status|500") << QByteArray(":status") << QByteArray("500"); -} - void tst_Hpack::lookupTableStatic() { const FieldLookupTable table(0, false /*all static, no need in 'search index'*/); - - QFETCH(QByteArray, expectedName); - QFETCH(QByteArray, expectedValue); - - const quint32 index = table.indexOf(expectedName, expectedValue); - QVERIFY(index != 0); - + const auto &staticTable = FieldLookupTable::staticPart(); QByteArray name, value; - QVERIFY(table.field(index, &name, &value)); - QCOMPARE(name, expectedName); - QCOMPARE(value, expectedValue); + quint32 currentIndex = 1; // HPACK is indexing starting from 1. + for (const HeaderField &field : staticTable) { + const quint32 index = table.indexOf(field.name, field.value); + QVERIFY(index != 0); + QCOMPARE(index, currentIndex); + QVERIFY(table.field(index, &name, &value)); + QCOMPARE(name, field.name); + QCOMPARE(value, field.value); + ++currentIndex; + } } void tst_Hpack::lookupTableDynamic() diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp index 1f9ffb8985..6e2220fa67 100644 --- a/tests/auto/network/access/http2/http2srv.cpp +++ b/tests/auto/network/access/http2/http2srv.cpp @@ -431,6 +431,13 @@ void Http2Server::readReady() if (connectionError) return; + if (redirectSent) { + // We are a "single shot" server, working in 'h2' mode, + // responding with a redirect code. Don't bother to handle + // anything else now. + return; + } + if (upgradeProtocol) { handleProtocolUpgrade(); } else if (waitingClientPreface) { @@ -800,6 +807,13 @@ void Http2Server::sendResponse(quint32 streamID, bool emptyBody) HttpHeader header; if (redirectWhileReading) { + if (redirectSent) { + // This is a "single-shot" server responding with a redirect code. + return; + } + + redirectSent = true; + qDebug("server received HEADERS frame (followed by DATA frames), redirecting ..."); Q_ASSERT(targetPort); header.push_back({":status", "308"}); diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h index 87a17ced8b..ae3f084fdc 100644 --- a/tests/auto/network/access/http2/http2srv.h +++ b/tests/auto/network/access/http2/http2srv.h @@ -193,6 +193,7 @@ private: // Redirect, with status code 308, as soon as we've seen headers, while client // may still be sending DATA frames. See tst_Http2::earlyResponse(). bool redirectWhileReading = false; + bool redirectSent = false; quint16 targetPort = 0; QAtomicInt interrupted; protected slots: diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 235b78c34a..52e98c1fc1 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -473,7 +473,7 @@ void tst_Http2::earlyResponse() runEventLoop(); QVERIFY(serverPort); - sendRequest(1, QNetworkRequest::NormalPriority, {10000000, Qt::Uninitialized}); + sendRequest(1, QNetworkRequest::NormalPriority, {1000000, Qt::Uninitialized}); runEventLoop(); diff --git a/tests/auto/network/ssl/qsslkey/BLACKLIST b/tests/auto/network/ssl/qsslkey/BLACKLIST index c0dfe5eb86..f9bc0af6de 100644 --- a/tests/auto/network/ssl/qsslkey/BLACKLIST +++ b/tests/auto/network/ssl/qsslkey/BLACKLIST @@ -1,2 +1,2 @@ -redhatenterpriselinuxworkstation-6.6 -rhel-7.4 +redhatenterpriselinuxworkstation +rhel diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index a720860288..25ab62a1c3 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -56,7 +56,7 @@ winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility !qtConfig(process): SUBDIRS -= qprocess_and_guieventloop -!mac: SUBDIRS -= \ +!macos|!qtHaveModule(gui): SUBDIRS -= \ macgui \ macnativeevents \ macplist \ diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST new file mode 100644 index 0000000000..01679eb6ee --- /dev/null +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST @@ -0,0 +1,11 @@ +winrt +[sort:QFileDialog usage] +ubuntu +b2qt +[specialFiles] +ubuntu +b2qt +[dirsBeforeFiles] +ubuntu +b2qt +windows diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro index bc4671f60c..db8cf7de3f 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro @@ -1,3 +1,6 @@ +INCLUDEPATH += ../../../../shared +HEADERS += ../../../../shared/emulationdetector.h + CONFIG += testcase # This testcase can be slow on Windows and OS X, and may interfere with other file system tests. win32:testcase.timeout = 900 @@ -8,5 +11,3 @@ QT += core-private testlib SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel - -CONFIG += insignificant_test # QTBUG-29403 diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 9ee5292fcb..665a116a3a 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ +#include <emulationdetector.h> #include <QtTest/QtTest> #ifdef QT_BUILD_INTERNAL #include <private/qfilesystemmodel_p.h> @@ -788,6 +789,9 @@ void tst_QFileSystemModel::sort() MyFriendFileSystemModel *myModel = new MyFriendFileSystemModel(); QTreeView *tree = new QTreeView(); + if (fileDialogMode && EmulationDetector::isRunningArmOnX86()) + QSKIP("Crashes in QEMU. QTBUG-70572"); + #ifdef QT_BUILD_INTERNAL if (fileDialogMode) myModel->d_func()->disableRecursiveSort = true; diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 9175c0bff4..9511654110 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -121,6 +121,7 @@ private slots: void task254449_draggingItemToNegativeCoordinates(); void keyboardSearch(); void shiftSelectionWithNonUniformItemSizes(); + void shiftSelectionWithItemAlignment(); void clickOnViewportClearsSelection(); void task262152_setModelColumnNavigate(); void taskQTBUG_2233_scrollHiddenItems_data(); @@ -1798,6 +1799,51 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() } } +void tst_QListView::shiftSelectionWithItemAlignment() +{ + QStringList items; + for (int c = 0; c < 2; c++) { + for (int i = 10; i > 0; i--) + items << QString(i, QLatin1Char('*')); + + for (int i = 1; i < 11; i++) + items << QString(i, QLatin1Char('*')); + } + + QListView view; + view.setFlow(QListView::TopToBottom); + view.setWrapping(true); + view.setItemAlignment(Qt::AlignLeft); + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + + QStringListModel model(items); + view.setModel(&model); + + QFont font = view.font(); + font.setPixelSize(10); + view.setFont(font); + view.resize(300, view.sizeHintForRow(0) * items.size() / 2 + view.horizontalScrollBar()->height()); + + view.show(); + QApplication::setActiveWindow(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); + QCOMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow()); + + QModelIndex index1 = view.model()->index(items.size() / 4, 0); + QPoint p = view.visualRect(index1).center(); + QVERIFY(view.viewport()->rect().contains(p)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); + QCOMPARE(view.currentIndex(), index1); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), 1); + + QModelIndex index2 = view.model()->index(items.size() / 4 * 3, 0); + p = view.visualRect(index2).center(); + QVERIFY(view.viewport()->rect().contains(p)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p); + QCOMPARE(view.currentIndex(), index2); + QCOMPARE(view.selectionModel()->selectedIndexes().size(), index2.row() - index1.row() + 1); +} + void tst_QListView::clickOnViewportClearsSelection() { QStringList items; diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 8f9afeea4d..a9858ae420 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -199,6 +199,7 @@ private slots: void taskQTBUG_45697_crash(); void taskQTBUG_7232_AllowUserToControlSingleStep(); void taskQTBUG_8376(); + void taskQTBUG_61476(); void testInitialFocus(); }; @@ -4726,5 +4727,58 @@ void tst_QTreeView::taskQTBUG_8376() QCOMPARE(rowHeightLvl1Visible, rowHeightLvl1Visible2); } +void tst_QTreeView::taskQTBUG_61476() +{ + // This checks that if a user clicks on an item to collapse it that it + // does not edit (in this case change the check state) the item that is + // now over the mouse just because it got a release event + QTreeView tv; + QStandardItemModel model; + QStandardItem *lastTopLevel = nullptr; + { + for (int i = 0; i < 4; ++i) { + QStandardItem *item = new QStandardItem(QLatin1String("Row Item")); + item->setCheckable(true); + item->setCheckState(Qt::Checked); + model.appendRow(item); + lastTopLevel = item; + for (int j = 0; j < 2; ++j) { + QStandardItem *childItem = new QStandardItem(QLatin1String("Child row Item")); + childItem->setCheckable(true); + childItem->setCheckState(Qt::Checked); + item->appendRow(childItem); + QStandardItem *grandChild = new QStandardItem(QLatin1String("Grand child row Item")); + grandChild->setCheckable(true); + grandChild->setCheckState(Qt::Checked); + childItem->appendRow(grandChild); + } + } + } + tv.setModel(&model); + tv.expandAll(); + // We need it to be this size so that the effect of the collapsing will + // cause the parent item to move to be under the cursor + tv.resize(200, 200); + tv.show(); + QVERIFY(QTest::qWaitForWindowActive(&tv)); + tv.verticalScrollBar()->setValue(tv.verticalScrollBar()->maximum()); + + // We want to press specifically right around where a checkbox for the + // parent item could be when collapsing + QTreeViewPrivate *priv = static_cast<QTreeViewPrivate*>(qt_widget_private(&tv)); + const QModelIndex mi = lastTopLevel->child(0)->index(); + const QRect rect = priv->itemDecorationRect(mi); + const QPoint pos = rect.center(); + + QTest::mousePress(tv.viewport(), Qt::LeftButton, 0, pos); + if (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, &tv) == + QEvent::MouseButtonPress) + QTRY_VERIFY(!tv.isExpanded(mi)); + + QTest::mouseRelease(tv.viewport(), Qt::LeftButton, 0, pos); + QTRY_VERIFY(!tv.isExpanded(mi)); + QCOMPARE(lastTopLevel->checkState(), Qt::Checked); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/baselineserver/shared/baselineprotocol.cpp b/tests/baselineserver/shared/baselineprotocol.cpp index 80e269ee2a..c9f9cd9bd2 100644 --- a/tests/baselineserver/shared/baselineprotocol.cpp +++ b/tests/baselineserver/shared/baselineprotocol.cpp @@ -366,7 +366,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun, const Plat if (!socket.waitForConnected(Timeout)) { sysSleep(3000); // Wait a bit and try again, the server might just be restarting if (!socket.waitForConnected(Timeout)) { - errMsg += QLS("TCP connectToHost failed. Host:") + serverName + QLS(" port:") + QString::number(ServerPort); + errMsg += QLS("TCP connectToHost failed. Host:") + QLS(serverName) + QLS(" port:") + QString::number(ServerPort); return false; } } diff --git a/tests/manual/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp index cc0ff3e1aa..6e5b07bf18 100644 --- a/tests/manual/gestures/graphicsview/gestures.cpp +++ b/tests/manual/gestures/graphicsview/gestures.cpp @@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture switch (event->type()) { case QEvent::TouchBegin: result = QGestureRecognizer::MayBeGesture; + break; case QEvent::TouchEnd: if (d->gestureFired) result = QGestureRecognizer::FinishGesture; else result = QGestureRecognizer::CancelGesture; + break; case QEvent::TouchUpdate: if (d->state() != Qt::NoGesture) { QTouchEvent *ev = static_cast<QTouchEvent*>(event); diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp index b0e7a47cf8..ba9ed815fa 100644 --- a/tests/manual/qgraphicsitemgroup/widget.cpp +++ b/tests/manual/qgraphicsitemgroup/widget.cpp @@ -224,7 +224,7 @@ void Widget::updateUngroupButton() CustomItem * Widget::checkedItem() const { - CustomItem *item; + CustomItem *item = nullptr; if (ui->blue->isChecked()) item = rectBlue; diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp index 62d0c51416..1d39514236 100644 --- a/tests/manual/qsysinfo/main.cpp +++ b/tests/manual/qsysinfo/main.cpp @@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v) CASE_VERSION(WV_WINDOWS8_1); CASE_VERSION(WV_WINDOWS10); case QSysInfo::WV_NT_based: // shouldn't happen + case QSysInfo::WV_CE: + case QSysInfo::WV_CENET: + case QSysInfo::WV_CE_5: + case QSysInfo::WV_CE_6: + case QSysInfo::WV_CE_based: break; } @@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v) CASE_VERSION(MV_10_9); CASE_VERSION(MV_10_10); CASE_VERSION(MV_10_11); + CASE_VERSION(MV_10_12); CASE_VERSION(MV_IOS_4_3); CASE_VERSION(MV_IOS_5_0); @@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v) CASE_VERSION(MV_IOS_8_3); CASE_VERSION(MV_IOS_8_4); CASE_VERSION(MV_IOS_9_0); + CASE_VERSION(MV_IOS_9_1); + CASE_VERSION(MV_IOS_9_2); + CASE_VERSION(MV_IOS_9_3); + CASE_VERSION(MV_IOS_10_0); case QSysInfo::MV_IOS: // shouldn't happen: + case QSysInfo::MV_TVOS: + case QSysInfo::MV_WATCHOS: break; + + CASE_VERSION(MV_TVOS_9_0); + CASE_VERSION(MV_TVOS_9_1); + CASE_VERSION(MV_TVOS_9_2); + CASE_VERSION(MV_TVOS_10_0); + + CASE_VERSION(MV_WATCHOS_2_0); + CASE_VERSION(MV_WATCHOS_2_1); + CASE_VERSION(MV_WATCHOS_2_2); + CASE_VERSION(MV_WATCHOS_3_0); } if (v & QSysInfo::MV_IOS) { diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp index c0366dea63..4816e2f3b9 100644 --- a/tests/manual/qtabletevent/regular_widgets/main.cpp +++ b/tests/manual/qtabletevent/regular_widgets/main.cpp @@ -284,7 +284,7 @@ int main(int argc, char *argv[]) mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR)); EventReportWidget *widget = new EventReportWidget; QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged, - widget, QOverload<void>::of(&QWidget::update)); + widget, QOverload<>::of(&QWidget::update)); widget->setMinimumSize(640, 480); QMenu *fileMenu = mainWindow.menuBar()->addMenu("File"); fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints); diff --git a/tests/manual/widgets/widgets/widgets.pro b/tests/manual/widgets/widgets/widgets.pro new file mode 100644 index 0000000000..1fccb09d79 --- /dev/null +++ b/tests/manual/widgets/widgets/widgets.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = bigmenucreator \ + defaultUpMenuBar \ + multiscreen-menus \ + qtoolbutton/menuOnMultiScreens |