diff options
author | José Millán Soto <fid@gpul.org> | 2012-01-22 12:43:36 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 15:11:54 (GMT) |
commit | c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa (patch) | |
tree | 5bfca4ad98a6b21435d8fbde20701494499bd398 /tests | |
parent | 0aa20342693a954edabdbd8387d57610d931c3b5 (diff) | |
download | Qt-c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa.zip Qt-c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa.tar.gz Qt-c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa.tar.bz2 |
Added QAccessibleGroupBox
Added a new accessible interface for QGroupBox, as QAccessibleDisplay
is not good enough when the QGroupBox is checkable.
AccessibleFactory was modified to return a QAccessibleGroupBox when
the accessible interface of a QGroupBox is requested.
Created tst_QAccessibility::groupBoxTest
Change-Id: I6c23dcf5562b3ea269b04102e78463b65827188a
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qaccessibility/tst_qaccessibility.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d09e796..b168e30 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -263,6 +263,7 @@ private slots: void mdiAreaTest(); void mdiSubWindowTest(); void lineEditTest(); + void groupBoxTest(); void workspaceTest(); void dialogButtonBoxTest(); void dialTest(); @@ -3145,6 +3146,50 @@ void tst_QAccessibility::lineEditTest() QTestAccessibility::clearEvents(); } +void tst_QAccessibility::groupBoxTest() +{ + QGroupBox *groupBox = new QGroupBox(); + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(groupBox); + + groupBox->setTitle(QLatin1String("Test QGroupBox")); + groupBox->setToolTip(QLatin1String("This group box will be used to test accessibility")); + QVBoxLayout *layout = new QVBoxLayout(); + QRadioButton *rbutton = new QRadioButton(); + layout->addWidget(rbutton); + groupBox->setLayout(layout); + QAccessibleInterface *rButtonIface = QAccessible::queryAccessibleInterface(rbutton); + + QCOMPARE(iface->childCount(), 1); + QCOMPARE(iface->role(0), QAccessible::Grouping); + QCOMPARE(iface->text(QAccessible::Name, 0), QLatin1String("Test QGroupBox")); + QCOMPARE(iface->text(QAccessible::Description, 0), QLatin1String("This group box will be used to test accessibility")); + QAccessible::Relation relation = iface->relationTo(0, rButtonIface, 0); + QVERIFY(relation & QAccessible::Label); + + delete rButtonIface; + delete iface; + delete groupBox; + + groupBox = new QGroupBox(); + iface = QAccessible::queryAccessibleInterface(groupBox); + + groupBox->setCheckable(true); + groupBox->setChecked(false); + + QCOMPARE(iface->role(0), QAccessible::CheckBox); + QAccessibleActionInterface *actionIface = iface->actionInterface(); + QVERIFY(actionIface); + QAccessible::State state = iface->state(0); + QVERIFY(!(state & QAccessible::Checked)); + actionIface->doAction(0); + QVERIFY(groupBox->isChecked()); + state = iface->state(0); + QVERIFY(state & QAccessible::Checked); + + delete iface; + delete groupBox; +} + void tst_QAccessibility::workspaceTest() { { |