tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp	Fri Sep 17 08:34:18 2010 +0300
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp	Mon Oct 04 01:19:32 2010 +0300
@@ -590,7 +590,7 @@
     QCOMPARE(gridview->currentIndex(), 35);
     QCOMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 35));
     QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y());
-    QCOMPARE(gridview->contentY(), 399.0);
+    QCOMPARE(gridview->contentY(), 400.0);
 
     gridview->moveCurrentIndexRight();
     QCOMPARE(gridview->currentIndex(), 36);
@@ -629,7 +629,7 @@
     gridview->moveCurrentIndexLeft();
     QCOMPARE(gridview->currentIndex(), model.count()-1);
 
-    QTRY_COMPARE(gridview->contentY(), 879.0);
+    QTRY_COMPARE(gridview->contentY(), 880.0);
 
     gridview->moveCurrentIndexRight();
     QCOMPARE(gridview->currentIndex(), 0);
@@ -655,6 +655,15 @@
 
     gridview->setFlow(QDeclarativeGridView::TopToBottom);
 
+    qApp->setActiveWindow(canvas);
+#ifdef Q_WS_X11
+    // to be safe and avoid failing setFocus with window managers
+    qt_x11_wait_for_window_manager(canvas);
+#endif
+    QTRY_VERIFY(canvas->hasFocus());
+    QTRY_VERIFY(canvas->scene()->hasFocus());
+    qApp->processEvents();
+
     QTest::keyClick(canvas, Qt::Key_Right);
     QCOMPARE(gridview->currentIndex(), 5);