summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp81
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp52
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp40
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp49
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp39
8 files changed, 117 insertions, 157 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 18bec1da89..a43847264c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -179,10 +179,7 @@ void tst_QGraphicsEffectSource::initTestCase()
scene->addItem(item);
view = new QGraphicsView(scene);
view->show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(view);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowActive(view));
}
void tst_QGraphicsEffectSource::cleanupTestCase()
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 6c52dcbc38..c292e0feeb 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -986,7 +986,7 @@ void tst_QGraphicsItem::inputMethodHints()
QGraphicsView view(&scene);
QApplication::setActiveWindow(&view);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
item->setFocus();
QTRY_VERIFY(item->hasFocus());
QCOMPARE(view.inputMethodHints(), item->inputMethodHints());
@@ -1035,7 +1035,8 @@ void tst_QGraphicsItem::toolTip()
QGraphicsView view(&scene);
view.setFixedSize(200, 200);
view.show();
- QTest::qWait(250);
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
{
QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(),
view.viewport()->mapToGlobal(view.viewport()->rect().topLeft()));
@@ -2259,9 +2260,8 @@ void tst_QGraphicsItem::zValue()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
QApplication::processEvents();
#ifdef Q_WS_QWS
QApplication::sendPostedEvents(); //glib workaround
@@ -3238,8 +3238,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
- QTest::qWait(150);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
EventTester *tester = new EventTester;
scene.addItem(tester);
@@ -4952,8 +4951,7 @@ void tst_QGraphicsItem::sceneEventFilter()
QGraphicsView view(&scene);
view.show();
QApplication::setActiveWindow(&view);
- QTest::qWaitForWindowShown(&view);
- QTest::qWait(25);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QGraphicsTextItem *text1 = scene.addText(QLatin1String("Text1"));
QGraphicsTextItem *text2 = scene.addText(QLatin1String("Text2"));
@@ -6712,7 +6710,7 @@ void tst_QGraphicsItem::opacity2()
view.showFullScreen();
else
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.repaints >= 1);
#define RESET_REPAINT_COUNTERS \
@@ -6789,7 +6787,7 @@ void tst_QGraphicsItem::opacityZeroUpdates()
MyGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.repaints > 0);
view.reset();
@@ -7068,10 +7066,7 @@ void tst_QGraphicsItem::sceneTransformCache()
rect->translate(0, 50);
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
-
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
rect->translate(0, 100);
QTransform x;
x.translate(0, 150);
@@ -7144,8 +7139,7 @@ void tst_QGraphicsItem::tabChangesFocus()
QWidget widget;
widget.setLayout(layout);
widget.show();
- QTest::qWaitForWindowShown(&widget);
- QTest::qWait(2000);
+ QVERIFY(QTest::qWaitForWindowActive(&widget));
QTRY_VERIFY(scene.isActive());
@@ -7596,10 +7590,7 @@ void tst_QGraphicsItem::update()
topLevel.resize(300, 300);
topLevel.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
EventTester *item = new EventTester;
scene.addItem(item);
@@ -7961,10 +7952,7 @@ void tst_QGraphicsItem::moveItem()
MyGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
EventTester *parent = new EventTester;
EventTester *child = new EventTester(parent);
@@ -8040,10 +8028,7 @@ void tst_QGraphicsItem::moveLineItem()
MyGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(200);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
view.reset();
QRectF brect = item->boundingRect();
@@ -8104,14 +8089,15 @@ void tst_QGraphicsItem::sorting()
scene.addItem(item2);
QGraphicsView view(&scene);
+ // Use Qt::Tool as fully decorated windows have a minimum width of 160 on Windows.
+ view.setWindowFlags(view.windowFlags() | Qt::Tool);
view.setResizeAnchor(QGraphicsView::NoAnchor);
view.setTransformationAnchor(QGraphicsView::NoAnchor);
view.resize(120, 100);
view.setFrameStyle(0);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTest::qWait(100);
_paintedItems.clear();
@@ -8146,7 +8132,8 @@ void tst_QGraphicsItem::itemHasNoContents()
QGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(!_paintedItems.isEmpty());
_paintedItems.clear();
@@ -8168,10 +8155,7 @@ void tst_QGraphicsItem::hitTestUntransformableItem()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
// Confuse the BSP with dummy items.
QGraphicsRectItem *dummy = new QGraphicsRectItem(0, 0, 20, 20);
@@ -8221,10 +8205,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
QGraphicsView view(&scene, &toplevel);
toplevel.resize(300, 300);
toplevel.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&toplevel);
-#endif
- QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
// Confuse the BSP with dummy items.
QGraphicsRectItem *dummy = new QGraphicsRectItem(0, 0, 20, 20);
@@ -8992,10 +8973,7 @@ void tst_QGraphicsItem::moveWhileDeleting()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(125);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
delete rect;
@@ -10499,7 +10477,7 @@ void tst_QGraphicsItem::scroll()
MyGraphicsView view(&scene);
view.setFrameStyle(0);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.repaints > 0);
view.reset();
@@ -10877,7 +10855,8 @@ void tst_QGraphicsItem::QTBUG_6738_missingUpdateWithSetParent()
view.showFullScreen();
else
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.repaints > 0);
// test case #1
@@ -10928,7 +10907,7 @@ void tst_QGraphicsItem::QT_2653_fullUpdateDiscardingOpacityUpdate()
view.showFullScreen();
else
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
view.reset();
parentGreen->setOpacity(1.0);
@@ -10961,7 +10940,7 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2()
scene.addItem(parentGreen);
origView.show();
- QTest::qWaitForWindowShown(&origView);
+ QVERIFY(QTest::qWaitForWindowActive(&origView));
origView.setGeometry(origView.width() + 20, 20,
origView.width(), origView.height());
@@ -10973,8 +10952,8 @@ void tst_QGraphicsItem::QTBUG_7714_fullUpdateDiscardingOpacityUpdate2()
QTRY_COMPARE(origView.repaints, 1);
view.show();
-
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
view.reset();
origView.reset();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index d17a5a7b1f..53c8be4a61 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -406,9 +406,7 @@ void tst_QGraphicsProxyWidget::setWidget()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QPointer<SubQGraphicsProxyWidget> proxy = new SubQGraphicsProxyWidget;
SubQGraphicsProxyWidget parentProxy;
scene.addItem(proxy);
@@ -787,8 +785,7 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild()
QGraphicsView view(&scene);
view.show();
QApplication::setActiveWindow(&view);
- QTest::qWaitForWindowShown(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
if (hasScene) {
scene.addItem(proxy);
proxy->show();
@@ -835,7 +832,7 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
QApplication::setActiveWindow(&view);
view.activateWindow();
view.setFocus();
- QTest::qWaitForWindowShown(&view);
+ QTest::qWaitForWindowActive(&view);
QTRY_VERIFY(view.isVisible());
QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
@@ -968,9 +965,8 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
//do not let the window manager move the window while we are moving the mouse on it
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
EventLogger *widget = new EventLogger;
@@ -1314,9 +1310,7 @@ void tst_QGraphicsProxyWidget::wheelEvent()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
WheelWidget *wheelWidget = new WheelWidget();
wheelWidget->setFixedSize(400, 400);
@@ -1489,7 +1483,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
View view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.npaints >= 1);
QTest::qWait(20);
widget->paintEventRegion = QRegion();
@@ -2051,8 +2045,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
window.show();
QApplication::setActiveWindow(&window);
window.activateWindow();
- QTest::qWaitForWindowShown(&window);
- QTRY_COMPARE(QApplication::activeWindow(), &window);
+ QVERIFY(QTest::qWaitForWindowActive(&window));
leftDial->setFocus();
QApplication::processEvents();
@@ -2526,9 +2519,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
box->showPopup();
@@ -2609,7 +2600,8 @@ void tst_QGraphicsProxyWidget::tooltip_basic()
QGraphicsView view(&scene);
view.setFixedSize(200, 200);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
{
QHelpEvent helpEvent(QEvent::ToolTip, view.viewport()->rect().topLeft(),
view.viewport()->mapToGlobal(view.viewport()->rect().topLeft()));
@@ -2772,9 +2764,8 @@ void tst_QGraphicsProxyWidget::windowOpacity()
QApplication::setActiveWindow(&view);
view.show();
- QTest::qWaitForWindowShown(&view);
- QApplication::sendPostedEvents();
- QTRY_VERIFY(view.isActiveWindow());
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(view.isActiveWindow());
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy signalSpy(&scene, SIGNAL(changed(const QList<QRectF> &)));
@@ -3260,9 +3251,7 @@ void tst_QGraphicsProxyWidget::dragDrop()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QMimeData data;
data.setText("hei");
@@ -3367,9 +3356,7 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
QGraphicsProxyWidget *proxy = scene.addWidget(new QPushButton("Hello World"));
View view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(view.npaints > 0);
// Wait a bit to clear all pending paint events
QTest::qWait(10);
@@ -3450,8 +3437,8 @@ void tst_QGraphicsProxyWidget::inputMethod()
lineEdit->setAttribute(Qt::WA_InputMethodEnabled, true);
QGraphicsProxyWidget *proxy = scene.addWidget(w);
view.show();
- QTest::qWaitForWindowShown(&view);
- QTRY_VERIFY(!(proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod));
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(!(proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod));
lineEdit->setFocus();
QVERIFY((proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod));
}
@@ -3471,11 +3458,8 @@ void tst_QGraphicsProxyWidget::clickFocus()
view.setFrameStyle(0);
view.resize(300, 300);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
QApplication::setActiveWindow(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QVERIFY(!proxy->hasFocus());
QVERIFY(!proxy->widget()->hasFocus());
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 3686619fea..1c5702d15f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1277,7 +1277,8 @@ void tst_QGraphicsScene::removeItem()
QGraphicsView view(&scene);
view.setFixedSize(150, 150);
view.show();
- QTest::qWaitForWindowShown(view.windowHandle());
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTest::mouseMove(view.viewport(), QPoint(-1, -1));
{
QMouseEvent moveEvent(QEvent::MouseMove, view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)), Qt::NoButton, 0, 0);
@@ -1679,8 +1680,8 @@ void tst_QGraphicsScene::hoverEvents_parentChild()
view.rotate(10);
view.scale(1.7, 1.7);
view.show();
- QTest::qWaitForWindowShown(&view);
- QTest::qWait(70);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
mouseEvent.setScenePos(QPointF(-1000, -1000));
@@ -2842,7 +2843,8 @@ void tst_QGraphicsScene::update2()
CustomView view;
view.setScene(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.repaints >= 1);
view.repaints = 0;
@@ -3034,7 +3036,7 @@ void tst_QGraphicsScene::tabFocus_emptyScene()
widget.show();
qApp->setActiveWindow(&widget);
widget.activateWindow();
- QTest::qWait(125);
+ QVERIFY(QTest::qWaitForWindowActive(&widget));
dial1->setFocus();
QVERIFY(dial1->hasFocus());
@@ -3082,8 +3084,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
widget.show();
qApp->setActiveWindow(&widget);
widget.activateWindow();
- QTest::qWaitForWindowShown(&widget);
- QApplication::processEvents();
+ QVERIFY(QTest::qWaitForWindowActive(&widget));
dial1->setFocus();
QTRY_VERIFY(dial1->hasFocus());
@@ -3762,8 +3763,8 @@ void tst_QGraphicsScene::inputMethod()
view.show();
QApplication::setActiveWindow(&view);
view.setFocus();
- QTest::qWaitForWindowShown(&view);
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
inputContext.m_resetCallCount = 0;
inputContext.m_commitCallCount = 0;
@@ -4009,8 +4010,8 @@ void tst_QGraphicsScene::isActive()
toplevel1.show();
QApplication::setActiveWindow(&toplevel1);
- QTest::qWaitForWindowShown(&toplevel1);
- QTRY_COMPARE(QApplication::activeWindow(), &toplevel1);
+ QVERIFY(QTest::qWaitForWindowActive(&toplevel1));
+ QCOMPARE(QApplication::activeWindow(), &toplevel1);
QVERIFY(!scene1.isActive()); //it is hidden;
QVERIFY(scene2.isActive());
@@ -4039,8 +4040,8 @@ void tst_QGraphicsScene::isActive()
toplevel1.show();
QApplication::setActiveWindow(&toplevel1);
- QApplication::processEvents();
- QTRY_COMPARE(QApplication::activeWindow(), &toplevel1);
+ QVERIFY(QTest::qWaitForWindowActive(&toplevel1));
+ QCOMPARE(QApplication::activeWindow(), &toplevel1);
QTRY_VERIFY(scene1.isActive());
QTRY_VERIFY(!scene2.isActive());
@@ -4076,8 +4077,8 @@ void tst_QGraphicsScene::isActive()
toplevel2.show();
QApplication::setActiveWindow(&toplevel2);
- QTest::qWaitForWindowShown(&toplevel2);
- QTRY_COMPARE(QApplication::activeWindow(), &toplevel2);
+ QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
+ QCOMPARE(QApplication::activeWindow(), &toplevel2);
QVERIFY(scene1.isActive());
QVERIFY(!scene2.isActive());
@@ -4125,8 +4126,8 @@ void tst_QGraphicsScene::isActive()
topLevelView.show();
QApplication::setActiveWindow(&topLevelView);
topLevelView.setFocus();
- QTest::qWaitForWindowShown(&topLevelView);
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&topLevelView));
+ QVERIFY(QTest::qWaitForWindowActive(&topLevelView));
+ QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&topLevelView));
QVERIFY(!scene1.isActive());
QVERIFY(!scene2.isActive());
@@ -4152,7 +4153,7 @@ void tst_QGraphicsScene::isActive()
QVERIFY(!scene2.hasFocus());
QApplication::setActiveWindow(&toplevel2);
- QTRY_COMPARE(QApplication::activeWindow(), &toplevel2);
+ QVERIFY(QTest::qWaitForWindowActive(&toplevel2));
QVERIFY(!scene1.isActive());
QVERIFY(scene2.isActive());
@@ -4289,7 +4290,8 @@ void tst_QGraphicsScene::removeFullyTransparentItem()
CustomView view;
view.setScene(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
// NB! The parent has the ItemHasNoContents flag set, which means
// the parent itself doesn't generate any update requests, only the
diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
index dca93ae1a5..450b970958 100644
--- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp
@@ -309,10 +309,8 @@ void tst_QGraphicsSceneIndex::clear()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(250);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ qApp->setActiveWindow(&view);
scene.clear();
// Make sure the index is re-generated after QGraphicsScene::clear();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
index 49dca55863..6f07718f4d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro
@@ -7,3 +7,5 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
DEFINES += QT_NO_CAST_TO_ASCII
+
+mac:CONFIG+=insignificant_test # QTBUG-26580
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index d70d106f45..df15090150 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -430,10 +430,9 @@ void tst_QGraphicsView::interactive()
view.setFixedSize(300, 300);
QCOMPARE(item->events.size(), 0);
view.show();
- QTest::qWaitForWindowShown(&view);
view.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
- QApplication::processEvents();
QTRY_COMPARE(item->events.size(), 1); // activate
QPoint itemPoint = view.mapFromScene(item->scenePos());
@@ -1524,7 +1523,7 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust()
view.setFrameStyle(0);
view.resize(300, 300);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(rect->numPaints > 0);
rect->numPaints = 0;
@@ -2337,7 +2336,8 @@ void tst_QGraphicsView::viewportUpdateMode()
// Show the view, and initialize our test.
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(!view.lastUpdateRegions.isEmpty());
view.lastUpdateRegions.clear();
@@ -2639,9 +2639,7 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2()
view.rotate(45);
view.scale(1.5, 1.5);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
// Make sure the view is repainted; otherwise the tests below will fail.
view.viewport()->repaint();
@@ -2794,6 +2792,7 @@ void tst_QGraphicsView::scrollBarRanges()
view.setVerticalScrollBarPolicy(vbarpolicy);
view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QCOMPARE(view.horizontalScrollBar()->minimum(), hmin);
QCOMPARE(view.verticalScrollBar()->minimum(), vmin);
@@ -2997,7 +2996,8 @@ void tst_QGraphicsView::task187791_setSceneCausesUpdate()
QGraphicsScene scene(0, 0, 200, 200);
QGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowShown(&view));
EventSpy updateSpy(view.viewport(), QEvent::Paint);
QCOMPARE(updateSpy.count(), 0);
@@ -3173,7 +3173,8 @@ void tst_QGraphicsView::task239729_noViewUpdate()
QCOMPARE(spy.count(), 0);
view->show();
- QTest::qWaitForWindowShown(view);
+ qApp->setActiveWindow(view);
+ QVERIFY(QTest::qWaitForWindowActive(view));
QTRY_VERIFY(spy.count() >= 1);
spy.reset();
@@ -3752,7 +3753,9 @@ void tst_QGraphicsView::exposeRegion()
CustomView view;
view.setScene(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
QTRY_VERIFY(item->paints > 0);
item->paints = 0;
@@ -3904,7 +3907,8 @@ void tst_QGraphicsView::update2()
view.setFrameStyle(0);
view.resize(200, 200);
view.show();
- QTest::qWaitForWindowShown(&view) ;
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(rect->numPaints > 0);
// Calculate expected update region for the rect.
@@ -3972,7 +3976,8 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape()
CustomView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.painted);
view.lastUpdateRegions.clear();
@@ -4024,7 +4029,8 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape2()
CustomView view(&scene);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.painted);
view.lastUpdateRegions.clear();
@@ -4179,9 +4185,9 @@ void tst_QGraphicsView::inputContextReset()
QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
view.show();
- QTest::qWaitForWindowShown(&view);
QApplication::setActiveWindow(&view);
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+ QCOMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
QGraphicsItem *item1 = new QGraphicsRectItem;
item1->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod);
@@ -4329,9 +4335,8 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
VpGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.show();
-
- QTest::qWaitForWindowShown(&view);
- QTest::qWait(50);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QPoint mouseViewPos(20, 20);
sendMouseMove(view.viewport(), mouseViewPos);
@@ -4491,7 +4496,8 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint);
view.scale(4.15, 4.15);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
view.viewport()->repaint(10,10,20,20);
QApplication::processEvents();
@@ -4566,7 +4572,8 @@ void tst_QGraphicsView::hoverLeave()
QCursor::setPos(1,1);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QPoint pos = view.viewport()->mapToGlobal(view.mapFromScene(item->mapToScene(10, 10)));
QCursor::setPos(pos);
@@ -4613,7 +4620,7 @@ void tst_QGraphicsView::QTBUG_16063_microFocusRect()
view.setFixedSize(40, 40);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
scene.setFocusItem(item);
view.setFocus();
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 27ad4ff899..66d228a271 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1112,11 +1112,8 @@ void tst_QGraphicsWidget::initStyleOption()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
QApplication::setActiveWindow(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
@@ -1139,7 +1136,7 @@ void tst_QGraphicsWidget::initStyleOption()
if (underMouse) {
view.resize(300, 300);
view.show();
- QTest::qWaitForWindowShown(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center())));
}
@@ -1441,11 +1438,8 @@ void tst_QGraphicsWidget::setTabOrder()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
QApplication::setActiveWindow(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QGraphicsWidget *lastItem = 0;
QTest::ignoreMessage(QtWarningMsg, "QGraphicsWidget::setTabOrder(0, 0) is undefined");
@@ -1647,8 +1641,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
QGraphicsView view(&scene);
view.show();
QApplication::setActiveWindow(&view);
- QTest::qWaitForWindowShown(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
{
// parent/child focus
@@ -1722,7 +1715,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
scene.addItem(w1_2);
window->show();
QApplication::setActiveWindow(window);
- QTest::qWaitForWindowShown(window);
+ QVERIFY(QTest::qWaitForWindowActive(window));
lineEdit->setFocus();
QTRY_VERIFY(lineEdit->hasFocus());
@@ -1771,9 +1764,8 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
- QTest::qWaitForWindowExposed(view.windowHandle());
QApplication::setActiveWindow(&view);
- QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
// delete item in focus chain with no focus and verify chain
SubQGraphicsWidget *parent = new SubQGraphicsWidget(0, Qt::Window);
@@ -2080,9 +2072,7 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(!scene.itemAt(25, 25));
widget->setGeometry(0, 112, 360, 528);
@@ -2101,9 +2091,7 @@ void tst_QGraphicsWidget::defaultSize()
QGraphicsView view(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QSizeF initialSize = widget->size();
widget->resize(initialSize);
@@ -2975,7 +2963,7 @@ void tst_QGraphicsWidget::respectHFW()
view->show();
window->setGeometry(0, 0, 70, 70);
- QTest::qWaitForWindowShown(view);
+ QVERIFY(QTest::qWaitForWindowActive(view));
{ // here we go - simulate a interactive resize of the window
QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner
@@ -3141,7 +3129,8 @@ void tst_QGraphicsWidget::initialShow()
view.showFullScreen();
else
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
scene.addItem(widget);
@@ -3170,7 +3159,8 @@ void tst_QGraphicsWidget::initialShow2()
dummyView->setWindowFlags(Qt::X11BypassWindowManagerHint);
EventSpy paintSpy(dummyView->viewport(), QEvent::Paint);
dummyView->show();
- QTest::qWaitForWindowShown(dummyView);
+ qApp->setActiveWindow(dummyView);
+ QVERIFY(QTest::qWaitForWindowActive(dummyView));
const int expectedRepaintCount = paintSpy.count();
delete dummyView;
dummyView = 0;
@@ -3184,7 +3174,8 @@ void tst_QGraphicsWidget::initialShow2()
QGraphicsView view(&scene);
view.setWindowFlags(view.windowFlags()|Qt::X11BypassWindowManagerHint);
view.show();
- QTest::qWaitForWindowShown(&view);
+ qApp->setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
#if defined(Q_OS_WIN) || defined(UBUNTU_LUCID)
QEXPECT_FAIL("", "QTBUG-20778", Abort);