diff options
Diffstat (limited to 'tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp')
-rw-r--r-- | tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 899e2aa179..35356adcfc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -40,6 +40,8 @@ #include <QtGui/private/qeventpoint_p.h> +#include <QtWidgets/private/qapplication_p.h> + using AbstractGraphicsShapeItemPtr = QSharedPointer<QAbstractGraphicsShapeItem>; using GraphicsItems = QList<QGraphicsItem *>; using GraphicsItemsList = QList<QGraphicsItem *>; @@ -991,7 +993,6 @@ void tst_QGraphicsItem::inputMethodHints() scene.addItem(item); scene.addItem(item2); QGraphicsView view(&scene); - QApplication::setActiveWindow(&view); view.setWindowTitle(QLatin1String(QTest::currentTestFunction())); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -1048,7 +1049,6 @@ void tst_QGraphicsItem::toolTip() view.setWindowTitle(QLatin1String(QTest::currentTestFunction())); view.setFixedSize(200, 200); view.show(); - QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); { @@ -2206,7 +2206,7 @@ void tst_QGraphicsItem::setTransform() scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); item.setTransform(QTransform().rotate(qreal(12.34))); QRectF rotatedRect = scene.sceneRect(); @@ -2214,14 +2214,14 @@ void tst_QGraphicsItem::setTransform() scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); item.setTransform(QTransform()); scene.update(scene.sceneRect()); QCoreApplication::processEvents(); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.size(), 3); QList<QRectF> rlist = qvariant_cast<QList<QRectF> >(spy.last().at(0)); QCOMPARE(rlist.size(), 2); @@ -3374,7 +3374,7 @@ void tst_QGraphicsItem::childrenBoundingRect() childChild->setPos(500, 500); child->setTransform(QTransform().rotate(90), true); - scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));; + scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red)); QGraphicsView view(&scene); view.setWindowTitle(QLatin1String(QTest::currentTestFunction())); @@ -3601,7 +3601,7 @@ void tst_QGraphicsItem::group() view.fitInView(scene.itemsBoundingRect()); - for (QGraphicsItem *item : qAsConst(newItems)) { + for (QGraphicsItem *item : std::as_const(newItems)) { group->addToGroup(item); QCOMPARE(item->group(), group); } @@ -4944,7 +4944,6 @@ void tst_QGraphicsItem::sceneEventFilter() QGraphicsView view(&scene); view.setWindowTitle(QLatin1String(QTest::currentTestFunction())); view.show(); - QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(QTest::qWaitForWindowActive(&view)); @@ -5565,7 +5564,6 @@ void tst_QGraphicsItem::itemClipsChildrenToShape4() scene.addEllipse( 100, 100, 100, 50 ); // <-- this is important to trigger the right codepath* //now the label is shown outerWidget->setFlag(QGraphicsItem::ItemClipsChildrenToShape, false ); - QApplication::setActiveWindow(&view); view.setWindowTitle(QLatin1String(QTest::currentTestFunction())); view.show(); QTRY_COMPARE(QApplication::activeWindow(), &view); @@ -5681,7 +5679,7 @@ void tst_QGraphicsItem::itemClipsChildrenToShape5() } const QList<QGraphicsItem *> children = parent->childItems(); - const int childrenCount = children.count(); + const int childrenCount = children.size(); for (int i = 0; i < 5; ++i) { QString clipString; @@ -8222,11 +8220,11 @@ void tst_QGraphicsItem::sorting() view.setFrameStyle(0); view.show(); if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) { - qApp->setActiveWindow(&view); + view.window()->activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&view)); } QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(_paintedItems.count() > 0); + QTRY_VERIFY(_paintedItems.size() > 0); _paintedItems.clear(); @@ -10929,7 +10927,6 @@ void tst_QGraphicsItem::focusHandling() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QApplication::setActiveWindow(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QVERIFY(itemWithFocus->hasFocus()); @@ -11445,7 +11442,7 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2() view.show(); if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) { - qApp->setActiveWindow(&view); + QApplicationPrivate::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); } QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -11702,7 +11699,7 @@ public: QLatin1String wiseWords("AZ BUKI VEDI"); QString sentence(wiseWords); QStringList words = sentence.split(QLatin1Char(' '), Qt::SkipEmptyParts); - for (int i = 0; i < words.count(); ++i) { + for (int i = 0; i < words.size(); ++i) { QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget(this); QLabel *label = new QLabel(words.at(i)); proxy->setWidget(label); |