summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsscene
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2010-03-18 10:57:58 (GMT)
committerYoann Lopes <yoann.lopes@nokia.com>2010-03-18 11:00:17 (GMT)
commit7a9d7a7ad225589d8815f91e07228a0beb74465b (patch)
tree6446a5f1deb95ae41195407004d7535d68b9959f /tests/auto/qgraphicsscene
parentcb1cdc16c424ba3e4fb332969df5b3f2cbe5eeff (diff)
downloadQt-7a9d7a7ad225589d8815f91e07228a0beb74465b.zip
Qt-7a9d7a7ad225589d8815f91e07228a0beb74465b.tar.gz
Qt-7a9d7a7ad225589d8815f91e07228a0beb74465b.tar.bz2
Stabilize taskQTBUG_7863_paintIntoCacheWithTransparentParts auto-test.
Diffstat (limited to 'tests/auto/qgraphicsscene')
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 9cd86a6..43ce46d 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -4355,7 +4355,8 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts()
w->setGeometry(0, 0, 50, 50);
QGraphicsScene *scene = new QGraphicsScene();
- QGraphicsView *view = new QGraphicsView(scene);
+ CustomView *view = new CustomView;
+ view->setScene(scene);
QGraphicsProxyWidget *proxy = scene->addWidget(w);
proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
@@ -4363,13 +4364,14 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts()
view->show();
QTest::qWaitForWindowShown(view);
- w->update(10, 10, 10, 10);
+ view->repaints = 0;
+ proxy->update(10, 10, 10, 10);
QTest::qWait(50);
+ QTRY_VERIFY(view->repaints > 0);
QPixmap pix;
QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(proxy);
- QPixmapCache::Key key = itemp->extraItemCache()->deviceData.value(view->viewport()).key;
- QVERIFY(QPixmapCache::find(key, &pix));
+ QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix));
QTransform t = proxy->sceneTransform();
// Map from scene coordinates to pixmap coordinates.
@@ -4399,7 +4401,8 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
rectItem->setParentItem(backItem);
QGraphicsScene *scene = new QGraphicsScene();
- QGraphicsView *view = new QGraphicsView(scene);
+ CustomView *view = new CustomView;
+ view->setScene(scene);
scene->addItem(backItem);
rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
@@ -4407,13 +4410,14 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
view->show();
QTest::qWaitForWindowShown(view);
+ view->repaints = 0;
rectItem->update(10, 10, 10, 10);
QTest::qWait(50);
+ QTRY_VERIFY(view->repaints > 0);
QPixmap pix;
QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem);
- QPixmapCache::Key key = itemp->extraItemCache()->deviceData.value(view->viewport()).key;
- QVERIFY(QPixmapCache::find(key, &pix));
+ QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix));
QTransform t = rectItem->sceneTransform();
// Map from scene coordinates to pixmap coordinates.
@@ -4439,7 +4443,8 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
rectItem->setBrush(QColor(0, 0, 255));
QGraphicsScene *scene = new QGraphicsScene();
- QGraphicsView *view = new QGraphicsView(scene);
+ CustomView *view = new CustomView;
+ view->setScene(scene);
scene->addItem(rectItem);
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
@@ -4447,13 +4452,14 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
view->show();
QTest::qWaitForWindowShown(view);
+ view->repaints = 0;
rectItem->update(10, 10, 10, 10);
QTest::qWait(50);
+ QTRY_VERIFY(view->repaints > 0);
QPixmap pix;
QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem);
- QPixmapCache::Key key = itemp->extraItemCache()->key;
- QVERIFY(QPixmapCache::find(key, &pix));
+ QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix));
QTransform t = rectItem->sceneTransform();
// Map from scene coordinates to pixmap coordinates.
@@ -4478,7 +4484,8 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
rectItem->setBrush(QColor(0, 0, 255, 125));
QGraphicsScene *scene = new QGraphicsScene();
- QGraphicsView *view = new QGraphicsView(scene);
+ CustomView *view = new CustomView;
+ view->setScene(scene);
scene->addItem(rectItem);
rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
@@ -4486,13 +4493,14 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
view->show();
QTest::qWaitForWindowShown(view);
+ view->repaints = 0;
rectItem->update(10, 10, 10, 10);
QTest::qWait(50);
+ QTRY_VERIFY(view->repaints > 0);
QPixmap pix;
QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem);
- QPixmapCache::Key key = itemp->extraItemCache()->key;
- QVERIFY(QPixmapCache::find(key, &pix));
+ QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix));
QTransform t = rectItem->sceneTransform();
// Map from scene coordinates to pixmap coordinates.