summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-30 17:38:46 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-30 17:54:23 (GMT)
commite8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001 (patch)
tree17388605ed0567ffa80e65b2417d525b2468ea8f /tests
parent1827669c08580ec309ac6e13c6684e6dbcf18ec4 (diff)
downloadQt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.zip
Qt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.tar.gz
Qt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.tar.bz2
Stabilize tests on X11
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp2
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp4
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp44
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp32
4 files changed, 45 insertions, 37 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index b6750ea..0b73733 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1456,7 +1456,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
scene.addItem(w1_4);
QTRY_VERIFY(w1_3->hasFocus());
QTest::qWait(25);
- QVERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
+ QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
QTest::qWait(25);
QTRY_VERIFY(lineEdit->hasFocus());
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 112bcc8..91b2cc5 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -3113,7 +3113,7 @@ void tst_QTreeView::task224091_appendColumns()
treeView->show();
treeView->resize(50,50);
- QTest::qWait(50);
+ QTest::qWaitForWindowShown(treeView);
qApp->processEvents();
QList<QStandardItem *> projlist;
@@ -3125,7 +3125,7 @@ void tst_QTreeView::task224091_appendColumns()
QTest::qWait(50);
qApp->processEvents();
- QVERIFY(treeView->verticalScrollBar()->isVisible());
+ QTRY_VERIFY(treeView->verticalScrollBar()->isVisible());
delete treeView;
delete model;
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 019887d..c08d601 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -3127,7 +3127,7 @@ void tst_QWidget::saveRestoreGeometry()
geom = widget.geometry();
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
- QTest::qWait(200);
+ QTest::qWait(500);
QVERIFY(widget.restoreGeometry(savedGeometry));
QTest::qWait(120);
QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
@@ -3137,55 +3137,55 @@ void tst_QWidget::saveRestoreGeometry()
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
- QTest::qWait(200);
+ QTest::qWait(400);
savedGeometry = widget.saveGeometry();
geom = widget.geometry();
widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
- QTest::qWait(200);
+ QTest::qWait(400);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
QTRY_COMPARE(widget.geometry(), geom);
QVERIFY((widget.windowState() & Qt::WindowFullScreen));
widget.setWindowState(widget.windowState() ^ Qt::WindowFullScreen);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
- QTest::qWait(20);
+ QTest::qWait(120);
//Restore from Maximised
widget.move(position);
widget.resize(size);
- QTest::qWait(20);
+ QTest::qWait(10);
QTRY_COMPARE(widget.size(), size);
- QTest::qWait(200);
+ QTest::qWait(400);
savedGeometry = widget.saveGeometry();
geom = widget.geometry();
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
QTRY_VERIFY(widget.geometry() != geom);
- QTest::qWait(200);
+ QTest::qWait(400);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_COMPARE(widget.geometry(), geom);
QVERIFY(!(widget.windowState() & Qt::WindowMaximized));
//Restore to maximised
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
- QTest::qWait(200);
+ QTest::qWait(400);
geom = widget.geometry();
savedGeometry = widget.saveGeometry();
widget.setWindowState(widget.windowState() ^ Qt::WindowMaximized);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY(!(widget.windowState() & Qt::WindowMaximized));
- QTest::qWait(200);
+ QTest::qWait(400);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
QTRY_COMPARE(widget.geometry(), geom);
}
@@ -8683,7 +8683,7 @@ void tst_QWidget::setClearAndResizeMask()
QTRY_COMPARE(child.numPaintEvents, 1);
#else
// and ensure that we don't get any updates at all.
- QCOMPARE(child.numPaintEvents, 0);
+ QTRY_COMPARE(child.numPaintEvents, 0);
#endif
QCOMPARE(topLevel.numPaintEvents, 0);
@@ -8720,9 +8720,9 @@ void tst_QWidget::setClearAndResizeMask()
QTest::qWait(200);
#ifdef Q_WS_MAC
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
- QCOMPARE(resizeChild.paintedRegion, resizeChild.mask());
+ QTRY_COMPARE(resizeChild.paintedRegion, resizeChild.mask());
#else
- QCOMPARE(resizeChild.paintedRegion, QRegion());
+ QTRY_COMPARE(resizeChild.paintedRegion, QRegion());
#endif
resizeChild.paintedRegion = QRegion();
@@ -8731,9 +8731,9 @@ void tst_QWidget::setClearAndResizeMask()
QTest::qWait(100);
#ifdef Q_WS_MAC
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
- QCOMPARE(resizeChild.paintedRegion, resizeChild.mask());
+ QTRY_COMPARE(resizeChild.paintedRegion, resizeChild.mask());
#else
- QCOMPARE(resizeChild.paintedRegion, resizeChild.mask() - oldMask);
+ QTRY_COMPARE(resizeChild.paintedRegion, resizeChild.mask() - oldMask);
#endif
}
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index e96bcf9..2490a65 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -106,18 +106,26 @@ public:
QRegion r;
};
-#define VERIFY_COLOR(region, color) { \
- const QRegion r = QRegion(region); \
- for (int i = 0; i < r.rects().size(); ++i) { \
- const QRect rect = r.rects().at(i); \
- const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), \
- rect.left(), rect.top(), \
- rect.width(), rect.height()); \
- QCOMPARE(pixmap.size(), rect.size()); \
- QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \
- expectedPixmap.fill(color); \
- QCOMPARE(pixmap, expectedPixmap); \
- } \
+//from tst_qwidget.cpp
+static void VERIFY_COLOR(const QRegion &region, const QColor &color)
+{
+ const QRegion r = QRegion(region);
+ for (int i = 0; i < r.rects().size(); ++i) {
+ const QRect rect = r.rects().at(i);
+ for (int t = 0; t < 5; t++) {
+ const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(),
+ rect.left(), rect.top(),
+ rect.width(), rect.height());
+ QCOMPARE(pixmap.size(), rect.size());
+ QPixmap expectedPixmap(pixmap); /* ensure equal formats */
+ expectedPixmap.fill(color);
+ if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 )
+ { QTest::qWait(200); continue; }
+ QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb());
+ QCOMPARE(pixmap, expectedPixmap);
+ break;
+ }
+ }
}
void tst_QWindowSurface::getSetWindowSurface()