diff options
author | Janne Anttila <janne.anttila@digia.com> | 2009-09-28 10:02:49 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2009-09-28 10:02:49 (GMT) |
commit | f8188b14493eb3d01263be5fef4ea086d3a542a0 (patch) | |
tree | b8b8a4f9af97bcdc135a974c6357090b3fa3f2fb /tests | |
parent | fcb270e961b0edd2f2fa33954e20f9a284048e4a (diff) | |
parent | 3e8592661f7607542c5a0df4c5f735716a0ec09d (diff) | |
download | Qt-f8188b14493eb3d01263be5fef4ea086d3a542a0.zip Qt-f8188b14493eb3d01263be5fef4ea086d3a542a0.tar.gz Qt-f8188b14493eb3d01263be5fef4ea086d3a542a0.tar.bz2 |
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcombobox/tst_qcombobox.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qlabel/tst_qlabel.cpp | 15 | ||||
-rw-r--r-- | tests/auto/qmdiarea/tst_qmdiarea.cpp | 30 | ||||
-rw-r--r-- | tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qtableview/tst_qtableview.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 20 | ||||
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 2 |
7 files changed, 35 insertions, 43 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index be1cb98..61aabaa 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2125,15 +2125,17 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); comboBox.show(); + QTest::qWaitForWindowShown(&comboBox); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); QTRY_VERIFY(comboBox.view()); + QTest::qWaitForWindowShown(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); #ifdef QT_BUILD_INTERNAL QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox); QVERIFY(container); - QVERIFY(desktop.screenGeometry(container).contains(container->geometry())); + QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); #endif } diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp index 8a5e344..dd03ef3 100644 --- a/tests/auto/qlabel/tst_qlabel.cpp +++ b/tests/auto/qlabel/tst_qlabel.cpp @@ -57,6 +57,8 @@ # define SRCDIR "" #endif +#include "../../shared/util.h" + class Widget : public QWidget { public: @@ -102,11 +104,11 @@ private slots: void eventPropagation_data(); void eventPropagation(); void focusPolicy(); - + void task190318_sizes(); void sizeHint(); - + void task226479_movieResize(); void emptyPixmap(); @@ -413,16 +415,17 @@ void tst_QLabel::task226479_movieResize() paintedRegion += e->region(); QLabel::paintEvent(e); } - + public: QRegion paintedRegion; }; - + Label label; label.resize(350,350); label.show(); QMovie *movie = new QMovie( &label ); label.setMovie(movie); + QTest::qWaitForWindowShown(&label); movie->setFileName(SRCDIR "red.png"); movie->start(); QTest::qWait(50); @@ -431,8 +434,8 @@ void tst_QLabel::task226479_movieResize() movie->setFileName(SRCDIR "green.png"); movie->start(); QTest::qWait(50); - - QCOMPARE(label.paintedRegion , QRegion(label.rect()) ); + + QTRY_COMPARE(label.paintedRegion , QRegion(label.rect()) ); } void tst_QLabel::emptyPixmap() diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp index 65f1937..b110114 100644 --- a/tests/auto/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp @@ -639,9 +639,7 @@ void tst_QMdiArea::changeWindowTitle() mw->setCentralWidget( ws ); mw->menuBar(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif + QTest::qWaitForWindowShown(mw); QWidget *widget = new QWidget( ws ); widget->setWindowTitle( wc ); @@ -655,22 +653,17 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif mw->hide(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); mw->show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(mw); -#endif qApp->processEvents(); + QTest::qWaitForWindowShown(mw); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); #endif #ifdef USE_SHOW @@ -688,7 +681,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) ); mw->setWindowTitle( mwc2 ); @@ -1697,11 +1690,8 @@ void tst_QMdiArea::tileSubWindows() workspace.setActiveSubWindow(windows.at(5)); workspace.resize(workspace.size() - QSize(10, 10)); workspace.setActiveSubWindow(0); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif QTest::qWait(250); // delayed re-arrange of minimized windows - QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); + QTRY_COMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); // Add another window and verify that the views are not tiled anymore. workspace.addSubWindow(new QPushButton(QLatin1String("I'd like to mess up tiled views")))->show(); @@ -1732,9 +1722,6 @@ void tst_QMdiArea::tileSubWindows() // Verify that we try to resize the area such that all sub-windows are visible. // It's important that tiled windows are NOT overlapping. workspace.resize(350, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(350, 150)); @@ -1761,13 +1748,10 @@ void tst_QMdiArea::tileSubWindows() #ifdef Q_OS_WINCE QSKIP("Not fixed yet! See task 197453", SkipAll); #endif - QCOMPARE(workspace.viewport()->rect().size(), expectedViewportSize); + QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Not enough space for all sub-windows to be visible -> provide scroll bars. workspace.resize(150, 150); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&workspace); -#endif qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(150, 150)); diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp index d5d125a..b897d8f 100644 --- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp @@ -1648,9 +1648,9 @@ void tst_QMdiSubWindow::resizeTimer() QMdiArea mdiArea; QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&mdiArea); -#endif + QTest::qWaitForWindowShown(&mdiArea); + QTest::qWait(250); + EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index f5d5040..71218a3 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -2339,6 +2339,7 @@ void tst_QTableView::scrollTo() // resizing to this size will ensure that there can ONLY_BE_ONE_CELL inside the view. QSize forcedSize(columnWidth * 2, rowHeight * 2); view.resize(forcedSize); + QTest::qWaitForWindowShown(&view); QTest::qWait(0); QTRY_COMPARE(view.size(), forcedSize); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 4536ed7..a9fa9bc 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -1756,11 +1756,11 @@ void tst_QWidget::setTabOrder() container.show(); container.activateWindow(); + qApp->setActiveWindow(&container); #ifdef Q_WS_X11 QTest::qWaitForWindowShown(&container); QTest::qWait(50); #endif - qApp->setActiveWindow(&container); QTest::qWait(100); @@ -2316,8 +2316,9 @@ void tst_QWidget::showMinimizedKeepsFocus() QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(0)); window.showNormal(); - QTest::qWait(30); qApp->setActiveWindow(&window); + QTest::qWaitForWindowShown(&window); + QTest::qWait(30); #ifdef Q_WS_MAC if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue); @@ -3116,7 +3117,7 @@ void tst_QWidget::saveRestoreGeometry() widget.resize(size); widget.show(); QTest::qWaitForWindowShown(&widget); - QTest::qWait(100); + QTest::qWait(200); QTRY_COMPARE(widget.geometry().size(), size); QRect geom; @@ -3126,15 +3127,15 @@ void tst_QWidget::saveRestoreGeometry() geom = widget.geometry(); widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen)); QTRY_COMPARE(widget.geometry(), geom); //Restore to full screen widget.setWindowState(widget.windowState() | Qt::WindowFullScreen); - QTest::qWait(20); + QTest::qWait(120); QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen)); QTest::qWait(200); savedGeometry = widget.saveGeometry(); @@ -3165,7 +3166,7 @@ void tst_QWidget::saveRestoreGeometry() QTest::qWait(20); QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized)); QTRY_VERIFY(widget.geometry() != geom); - QTest::qWait(100); + QTest::qWait(200); QVERIFY(widget.restoreGeometry(savedGeometry)); QTest::qWait(20); QTRY_COMPARE(widget.geometry(), geom); @@ -5388,7 +5389,7 @@ void tst_QWidget::showAndMoveChild() child.move(desktopDimensions.width()/2, desktopDimensions.height()/2); qApp->processEvents(); - verifyColor(child.geometry().translated(tlwOffset), Qt::blue); + verifyColor(child.geometry().translated(tlwOffset), Qt::blue); verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red); } @@ -6407,7 +6408,7 @@ void tst_QWidget::render() qApp->processEvents(); qApp->sendPostedEvents(); - QTest::qWait(100); + QTest::qWait(250); QImage sourceImage = QPixmap::grabWidget(&source).toImage(); qApp->processEvents(); @@ -6513,6 +6514,7 @@ void tst_QWidget::renderInvisible() dummyFocusWidget.show(); QTest::qWaitForWindowShown(&dummyFocusWidget); qApp->processEvents(); + QTest::qWait(100); // Create normal reference image. const QSize calendarSize = calendar->size(); diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 2c5ba72..0a6b7ad 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -230,7 +230,7 @@ void tst_QWindowSurface::grabWidget() parentWidget.show(); QTest::qWaitForWindowShown(&parentWidget); - QTest::qWait(20); + QTest::qWait(120); QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget); QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget); |