From c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Sun, 22 Jan 2012 13:43:36 +0100 Subject: Added QAccessibleGroupBox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'tests/auto/qaccessibility') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d09e7965a1..b168e30cad 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() { { -- cgit v1.2.3