diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2012-12-13 18:12:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-22 14:11:14 +0100 |
commit | 15a32435561a668e69764d12edfa2b5c564c6505 (patch) | |
tree | f56d1306f6fbd95a63fc5d9396c0798d3029d2b5 /tests | |
parent | ffeaff9a267f31f202578457d0fae96634a4ec2b (diff) |
Accessibility Linux: Make dbus registration async
Change-Id: I74043be04f4ee17089353304fdc007a7f22cdea0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index fd157dd834..15b8089525 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -67,11 +67,8 @@ class AccessibleTestWindow : public QWidget public: AccessibleTestWindow() { - DBusConnection c; - m_address = c.connection().baseService().toLatin1().data(); new QHBoxLayout(this); } - QString dbusAddress() const { return m_address; } void addWidget(QWidget* widget) { @@ -85,10 +82,6 @@ public: qDeleteAll(children()); new QHBoxLayout(this); } - -private: - QString m_address; - QString m_bus; }; @@ -116,7 +109,6 @@ private: AccessibleTestWindow *m_window; - QString bus; QString address; QDBusInterface *root; // the root object on dbus (for the app) QDBusInterface *rootApplication; @@ -129,10 +121,12 @@ private: QStringList tst_QAccessibilityLinux::getChildren(QDBusInterface *interface) { QSpiObjectReferenceArray list; - interface->call(QDBus::Block, "GetChildren").arguments().first().value<QDBusArgument>() >> list; + const QList<QVariant> args = interface->call(QDBus::Block, "GetChildren").arguments(); + Q_ASSERT(args.size() == 1); + Q_ASSERT(args.first().isValid()); + args.first().value<QDBusArgument>() >> list; Q_ASSERT(interface->property("ChildCount").toInt() == list.count()); - QStringList children; Q_FOREACH (const QSpiObjectReference &ref, list) children << ref.path.path(); @@ -164,26 +158,18 @@ QDBusInterface *tst_QAccessibilityLinux::getInterface(const QString &path, const void tst_QAccessibilityLinux::initTestCase() { // Oxygen style creates many extra items, it's simply unusable here - qDebug() << "Using fusion style..."; qApp->setStyle("fusion"); qApp->setApplicationName("tst_QAccessibilityLinux app"); - dbus = DBusConnection(); + + QTRY_VERIFY(dbus.isEnabled()); + QTRY_VERIFY(dbus.connection().isConnected()); + address = dbus.connection().baseService().toLatin1().data(); m_window = new AccessibleTestWindow(); m_window->show(); - // this has the side-effect of immediately activating accessibility - qDebug() << "Explicitly activating accessibility..."; - delete QAccessible::queryAccessibleInterface(m_window); - QTest::qWaitForWindowExposed(m_window); - - address = m_window->dbusAddress(); registerDbus(); - - QStringList appChildren = getChildren(root); - QString window = appChildren.at(0); - mainWindow = getInterface(window, "org.a11y.atspi.Accessible"); } void tst_QAccessibilityLinux::cleanupTestCase() |