summaryrefslogtreecommitdiffstats
path: root/tests/auto/q3table
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-24 07:36:35 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-24 09:47:41 (GMT)
commitd57e2f4d01534f44dde629b71398783777fdad4e (patch)
tree21661f0c2efaafdfbe4919327a0c632d541bdfe8 /tests/auto/q3table
parent6d21ee6269a40c0d70e358cc1149d332ca84f868 (diff)
downloadQt-d57e2f4d01534f44dde629b71398783777fdad4e.zip
Qt-d57e2f4d01534f44dde629b71398783777fdad4e.tar.gz
Qt-d57e2f4d01534f44dde629b71398783777fdad4e.tar.bz2
Stabilize Q3Table test
If there is no focus widget while doing keyClick, the test crashes
Diffstat (limited to 'tests/auto/q3table')
-rw-r--r--tests/auto/q3table/tst_q3table.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp
index f911dd4..770bf4d 100644
--- a/tests/auto/q3table/tst_q3table.cpp
+++ b/tests/auto/q3table/tst_q3table.cpp
@@ -523,6 +523,7 @@ void tst_Q3Table::simpleKeyboardNavigation()
// After the first keyevent, the table starts editing the item
w = testWidget->cellWidget(0, 0);
+ QVERIFY(w);
#ifdef WAITS
QTest::qWait(50);
@@ -1205,12 +1206,17 @@ void tst_Q3Table::editCheck()
EditCheckQ3Table table(10, 10, 0);
table.show();
+ QApplication::setActiveWindow(&table);
QTest::qWaitForWindowShown(&table);
+ QTRY_COMPARE(QApplication::activeWindow(), &table);
table.setCurrentCell(0, 0);
#ifdef WAITS
QTest::qWait(50);
#endif
QTest::keyClick(table.viewport(), Qt::Key_T);
+#ifdef WAITS
+ QTest::qWait(50);
+#endif
// After the first keyevent, the table starts editing the item
QLineEdit *le = qFindChild<QLineEdit *>(testWidget->viewport(), "qt_lineeditor");
#ifdef WAITS
@@ -1337,6 +1343,9 @@ void tst_Q3Table::valueChanged()
testWidget->setItem(0, 0, ti);
connect(testWidget,SIGNAL(valueChanged(int,int)),this,SLOT(onValueChanged(int,int)));
testWidget->show();
+ QApplication::setActiveWindow(testWidget);
+ QTest::qWaitForWindowShown(testWidget);
+ QTRY_COMPARE(QApplication::activeWindow(), testWidget);
#ifdef WAITS
QTest::qWait(50);
#endif
@@ -1344,6 +1353,7 @@ void tst_Q3Table::valueChanged()
#ifdef WAITS
QTest::qWait(50);
#endif
+ QTRY_VERIFY(qApp->focusWidget());
QTest::keyClick(qApp->focusWidget(), Qt::Key_Enter);
#ifdef WAITS
QTest::qWait(50);
@@ -1383,7 +1393,9 @@ void tst_Q3Table::dateTimeEdit()
TimeTableItem *ti = new TimeTableItem(testWidget);
testWidget->setItem(0, 0, ti);
testWidget->show();
+ QApplication::setActiveWindow(testWidget);
QTest::qWaitForWindowShown(testWidget);
+ QTRY_COMPARE(QApplication::activeWindow(), testWidget);
#ifdef WAITS
QTest::qWait(50);
#endif
@@ -1391,6 +1403,7 @@ void tst_Q3Table::dateTimeEdit()
#ifdef WAITS
QTest::qWait(50);
#endif
+ QTRY_VERIFY(qApp->focusWidget());
QTest::keyClick(qApp->focusWidget(), Qt::Key_Enter);
#ifdef WAITS
QTest::qWait(50);