From d45bc23cd519f81aff60a7a090557ca8406b6a58 Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Fri, 13 Jul 2012 09:45:37 +0200 Subject: Relax the reqirement in which order events are delivered. When the pushbutton is shown, it will generate both a ShowEvent and a StateChange with active=1 (because it is a top level window). This patch relaxes the reqirement in which order events are delivered. Ideally the order should also relied on, but I'm not sure if that is feasible due to differences among window managers across all platforms. This got provoked by codereview.qt-project.org/#change,26014 Change-Id: I96159fbb1b64f0ca8d13833d8a4c6799c655afc2 Reviewed-by: Friedemann Kleint Reviewed-by: Frederik Gladhorn --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index df7588465d..fef81008a7 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -386,7 +386,8 @@ void tst_QAccessibility::eventTest() button->show(); QAccessibleEvent showEvent(button, QAccessible::ObjectShow); - QVERIFY_EVENT(&showEvent); + // some platforms might send other events first, (such as state change event active=1) + QVERIFY(QTestAccessibility::containsEvent(&showEvent)); button->setFocus(Qt::MouseFocusReason); QTestAccessibility::clearEvents(); QTest::mouseClick(button, Qt::LeftButton, 0); @@ -400,7 +401,8 @@ void tst_QAccessibility::eventTest() button->hide(); QAccessibleEvent hideEvent(button, QAccessible::ObjectHide); - QVERIFY_EVENT(&hideEvent); + // some platforms might send other events first, (such as state change event active=1) + QVERIFY(QTestAccessibility::containsEvent(&hideEvent)); delete button; } @@ -800,18 +802,20 @@ void tst_QAccessibility::mainWindowTest() QLatin1String name = QLatin1String("I am the main window"); mw->setWindowTitle(name); QTest::qWaitForWindowShown(mw); + + // The order of events is not really that important. QAccessibleEvent show(mw, QAccessible::ObjectShow); - QVERIFY_EVENT(&show); + QVERIFY(QTestAccessibility::containsEvent(&show)); + QAccessible::State activeState; + activeState.active = true; + QAccessibleStateChangeEvent active(mw, activeState); + QVERIFY(QTestAccessibility::containsEvent(&active)); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(mw); QCOMPARE(iface->text(QAccessible::Name), name); QCOMPARE(iface->role(), QAccessible::Window); QVERIFY(iface->state().active); - QAccessible::State activeState; - activeState.active = true; - QAccessibleStateChangeEvent active(mw, activeState); - QVERIFY_EVENT(&active); delete iface; delete mw; -- cgit v1.2.3