summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-12-06 11:13:45 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-12-06 18:30:52 +0000
commit85d8975bc999d65d04db9027f66c030574a5caf0 (patch)
tree4e3266a2346a1fffd95822ec3479a46937e54141 /tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
parent28fbd13e22935483d9ebcf2f088681f3d649cf2a (diff)
tst_QWidget: port away from QRegion::rects()
Drop the useless copy 'r' of 'region', reuse 'r' for the rects in 'region', to clean up the region handling in verifyColor(). Change-Id: I8e159976b4b0152823be864488d2ef25d7cb0078 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 715e0f2181..5a9c5dd175 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5145,13 +5145,12 @@ static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, unsigned int callerLine)
{
- const QRegion r = QRegion(region);
QWindow *window = child.window()->windowHandle();
Q_ASSERT(window);
const QPoint offset = child.mapTo(child.window(), QPoint(0,0));
bool grabBackingStore = false;
- for (int i = 0; i < r.rects().size(); ++i) {
- QRect rect = r.rects().at(i).translated(offset);
+ for (QRect r : region) {
+ QRect rect = r.translated(offset);
for (int t = 0; t < 6; t++) {
const QPixmap pixmap = grabBackingStore
? child.grab(rect)
@@ -5176,7 +5175,7 @@ bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, uns
} else {
if (t == 4) {
grabBackingStore = true;
- rect = r.rects().at(i);
+ rect = r;
} else {
QTest::qWait(200);
}