diff options
author | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2012-02-09 11:20:34 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 15:21:46 +0100 |
commit | ff2886db6a3308c1f4ee0879af497a5d43c33133 (patch) | |
tree | 50bfc43dbcb2bb34898e7723519abde2181d0347 /tests | |
parent | 482d96a0c5d523ace63f56bda6851926b4469dd0 (diff) |
Move all usages of Relation enum values to QAccessible::relations()
Next step is to remove navigate(), but that has to be done in
qtdeclarative first.
Change-Id: I01ea1386c092446be04cc19d0f70adf53f094adc
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 63770f14cb..b2a4b1cca2 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -846,6 +846,17 @@ public Q_SLOTS: } }; +static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAccessible::RelationFlag flag) +{ + typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair; + QVector<RelationPair> rels = iface->relations(flag); + + for (int i = 1; i < rels.count(); ++i) + delete rels.at(i).first; + + return rels.value(0).first; +} + void tst_QAccessibility::buttonTest() { QWidget window; @@ -879,6 +890,30 @@ void tst_QAccessibility::buttonTest() toggletool.setText("Toggle"); toggletool.setMinimumSize(20,20); + // test Controller/Controlled relations + { + QCheckBox toggler("Toggle me!", &window); + bool ok = connect(&pushButton, SIGNAL(clicked()), &toggler, SLOT(toggle())); + QCOMPARE(ok, true); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&toggler); + QVERIFY(iface); + QCOMPARE(iface->role(), QAccessible::CheckBox); + QAccessibleInterface *buttonIFace = relatedInterface(iface, QAccessible::Controller); + QVERIFY(buttonIFace); + QCOMPARE(buttonIFace->role(), QAccessible::Button); + QCOMPARE(buttonIFace->object(), &pushButton); + delete buttonIFace; + delete iface; + + buttonIFace = QAccessible::queryAccessibleInterface(&pushButton); + QVERIFY(buttonIFace); + QCOMPARE(buttonIFace->role(), QAccessible::Button); + iface = relatedInterface(buttonIFace, QAccessible::Controlled); + QVERIFY(iface); + QCOMPARE(iface->object(), &toggler); + + } + // test push button QAccessibleInterface* interface = QAccessible::queryAccessibleInterface(&pushButton); QAccessibleActionInterface* actionInterface = interface->actionInterface(); |