summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp4
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp9
-rw-r--r--tests/auto/qgroupbox/tst_qgroupbox.cpp1
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp1
-rw-r--r--tests/auto/qtoolbar/tst_qtoolbar.cpp8
5 files changed, 19 insertions, 4 deletions
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index e7bb93f..502e983 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -775,9 +775,11 @@ void tst_QDoubleSpinBox::editingFinished()
layout->addWidget(box2);
testFocusWidget->show();
+ QApplication::setActiveWindow(testFocusWidget);
QTest::qWait(10);
- QTRY_VERIFY(box->isActiveWindow());
+ QTRY_VERIFY(testFocusWidget->isActiveWindow());
box->setFocus();
+ QTRY_VERIFY(box->hasFocus());
QSignalSpy editingFinishedSpy1(box, SIGNAL(editingFinished()));
QSignalSpy editingFinishedSpy2(box2, SIGNAL(editingFinished()));
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index c86d9e3..32b4420 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -1316,6 +1316,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
//make sure we flush all the paint events
QTest::qWait(250);
+ QTRY_VERIFY(proxy.paintCount > 1);
proxy.paintCount = 0;
w->update();
@@ -2071,6 +2072,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
QApplication::setActiveWindow(&window);
window.activateWindow();
QTest::qWait(125);
+ QTRY_COMPARE(QApplication::activeWindow(), &window);
leftDial->setFocus();
QTest::qWait(125);
@@ -2207,6 +2209,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleWidget()
QApplication::setActiveWindow(&window);
window.activateWindow();
QTest::qWait(125);
+ QTRY_COMPARE(QApplication::activeWindow(), &window);
leftDial->setFocus();
QTest::qWait(125);
@@ -2279,6 +2282,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleTwoWidgets()
QApplication::setActiveWindow(&window);
window.activateWindow();
QTest::qWait(125);
+ QTRY_COMPARE(QApplication::activeWindow(), &window);
leftDial->setFocus();
QTest::qWait(125);
@@ -2358,6 +2362,7 @@ void tst_QGraphicsProxyWidget::setFocus_complexTwoWidgets()
QApplication::setActiveWindow(&window);
window.activateWindow();
QTest::qWait(125);
+ QTRY_COMPARE(QApplication::activeWindow(), &window);
leftDial->setFocus();
QTest::qWait(125);
@@ -3350,7 +3355,9 @@ void tst_QGraphicsProxyWidget::clickFocus()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(250);
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
QVERIFY(!proxy->hasFocus());
QVERIFY(!proxy->widget()->hasFocus());
diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp
index 5773804..20eec7e 100644
--- a/tests/auto/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp
@@ -467,6 +467,7 @@ void tst_QGroupBox::propagateFocus()
QGroupBox box;
QLineEdit lineEdit(&box);
box.show();
+ QApplication::setActiveWindow(&box);
box.setFocus();
QTest::qWait(250);
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit));
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 3a81212..1417e69 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -339,6 +339,7 @@ void tst_QLineEdit::initTestCase()
testWidget->resize(200,50);
testWidget->show();
+ QApplication::setActiveWindow(testWidget);
#ifdef Q_WS_X11
// to be safe and avoid failing setFocus with window managers
qt_x11_wait_for_window_manager(testWidget);
diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp
index 90d7cf4..e4f317c 100644
--- a/tests/auto/qtoolbar/tst_qtoolbar.cpp
+++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp
@@ -55,6 +55,8 @@
#include <qlineedit.h>
#include <qkeysequence.h>
+#include "../../shared/util.h"
+
//TESTED_FILES=
QT_FORWARD_DECLARE_CLASS(QAction)
@@ -973,12 +975,14 @@ void tst_QToolBar::accel()
QSignalSpy spy(action, SIGNAL(triggered(bool)));
mw.show();
- QTest::qWait(1000);
+ QApplication::setActiveWindow(&mw);
+ QTest::qWait(100);
+ QTRY_COMPARE(QApplication::activeWindow(), &mw);
QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier);
QTest::qWait(300);
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 1);
#ifdef Q_WS_MAC
qt_set_sequence_auto_mnemonic(false);
#endif