diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-30 17:38:46 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-30 17:54:23 (GMT) |
commit | e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001 (patch) | |
tree | 17388605ed0567ffa80e65b2417d525b2468ea8f /tests/auto/qwindowsurface | |
parent | 1827669c08580ec309ac6e13c6684e6dbcf18ec4 (diff) | |
download | Qt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.zip Qt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.tar.gz Qt-e8fc662c4b5a0fa5da6f0d47e1dbb5b2640d7001.tar.bz2 |
Stabilize tests on X11
Diffstat (limited to 'tests/auto/qwindowsurface')
-rw-r--r-- | tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
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 ®ion, 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() |