summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-13 14:35:34 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-15 10:39:40 (GMT)
commitfc7a6a7f9f857c4745476213ee41d9a92ce82a9c (patch)
tree461d6531ff5917dc73712972e9e5e1b9f73cbb1c /tests/auto
parent0d721a3b390b3f542be594941430ecfcac29f0ac (diff)
downloadQt-fc7a6a7f9f857c4745476213ee41d9a92ce82a9c.zip
Qt-fc7a6a7f9f857c4745476213ee41d9a92ce82a9c.tar.gz
Qt-fc7a6a7f9f857c4745476213ee41d9a92ce82a9c.tar.bz2
Make Graphics View auto-tests less dependant on WS.
Several auto-tests failed on the Mac because the view get two paint events on the first show. This is a bug in QWidget, but shouldn't make graphics view auto-tests fail. Also, there's no difference between update() and repaint() on the Mac.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp27
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp18
2 files changed, 29 insertions, 16 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 3f41a90..f58cad2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4478,14 +4478,13 @@ void tst_QGraphicsItem::paint()
view.hide();
QGraphicsScene scene2;
+ QGraphicsView view2(&scene2);
+ view2.show();
+ QTest::qWait(250);
PaintTester tester2;
scene2.addItem(&tester2);
-
- QGraphicsView view2(&scene2);
- view2.show();
qApp->processEvents();
- QTest::qWait(250);
//First show one paint
QVERIFY(tester2.painted == 1);
@@ -5570,11 +5569,12 @@ public:
void tst_QGraphicsItem::ensureUpdateOnTextItem()
{
QGraphicsScene scene;
- TextItem *text1 = new TextItem(QLatin1String("123"));
- scene.addItem(text1);
QGraphicsView view(&scene);
view.show();
QTest::qWait(250);
+ TextItem *text1 = new TextItem(QLatin1String("123"));
+ scene.addItem(text1);
+ qApp->processEvents();
QCOMPARE(text1->updates,1);
//same bouding rect but we have to update
@@ -6034,14 +6034,15 @@ void tst_QGraphicsItem::itemStacksBehindParent()
scene.addItem(parent1);
scene.addItem(parent2);
- paintedItems.clear();
-
QGraphicsView view(&scene);
view.show();
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
QTest::qWait(250);
+ paintedItems.clear();
+ view.viewport()->update();
+ QTest::qWait(100);
QCOMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>()
<< grandChild111 << child11
@@ -7247,6 +7248,11 @@ void tst_QGraphicsItem::sorting()
_paintedItems.clear();
view.viewport()->repaint();
+#ifdef Q_WS_MAC
+ // There's no difference between repaint and update on the Mac,
+ // so we have to process events here to make sure we get the event.
+ QTest::qWait(100);
+#endif
QCOMPARE(_paintedItems, QList<QGraphicsItem *>()
<< grid[0][0] << grid[0][1] << grid[0][2] << grid[0][3]
@@ -7279,6 +7285,11 @@ void tst_QGraphicsItem::itemHasNoContents()
_paintedItems.clear();
view.viewport()->repaint();
+#ifdef Q_WS_MAC
+ // There's no difference between update() and repaint() on the Mac,
+ // so we have to process events here to make sure we get the event.
+ QTest::qWait(100);
+#endif
QCOMPARE(_paintedItems, QList<QGraphicsItem *>() << item2);
}
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 9a5089b..37c5967 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -3338,6 +3338,15 @@ void tst_QGraphicsView::render()
{
// ### This test can be much more thorough - see QGraphicsScene::render.
QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.setFrameStyle(0);
+ view.resize(200, 200);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(200);
+
RenderTester *r1 = new RenderTester(QRectF(0, 0, 50, 50));
RenderTester *r2 = new RenderTester(QRectF(50, 50, 50, 50));
RenderTester *r3 = new RenderTester(QRectF(0, 50, 50, 50));
@@ -3347,14 +3356,7 @@ void tst_QGraphicsView::render()
scene.addItem(r3);
scene.addItem(r4);
- QGraphicsView view(&scene);
- view.setFrameStyle(0);
- view.resize(200, 200);
- view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(200);
+ qApp->processEvents();
QCOMPARE(r1->paints, 1);
QCOMPARE(r2->paints, 1);