summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorHarald Sitter <sitter@kde.org>2023-01-24 13:02:28 +0100
committerHarald Sitter <sitter@kde.org>2023-03-01 22:05:23 +0100
commit5317ff74fd2ff31e4bfb8e7e6c4a6e06a16fffc8 (patch)
tree9d2c893a0ab1ae7d20fa59f51858194de1c544cb /tests/auto/other
parent79578fd691820aad2c9be3827c376c62c182bb14 (diff)
a11y: even checkable buttons are pressable
otherwise there is no way to synthesize a "click" through the a11y API. toggleAction only leads to a toggled() signal but the user may be more discerning and only listen to clicked() (or QAction::triggered) to react to **user** events not all toggle events. as such pressAction is always superior to toggleAction when user input is meant to be synthesized through a11y tooling. Change-Id: I7f024d57087b545d3cfd1805026ea538b0b3e166 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 76d50b93e3..8c51022416 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1118,7 +1118,10 @@ void tst_QAccessibility::buttonTest()
interface = QAccessible::queryAccessibleInterface(&toggleButton);
actionInterface = interface->actionInterface();
QCOMPARE(interface->role(), QAccessible::CheckBox);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QCOMPARE(actionInterface->localizedActionDescription(QAccessibleActionInterface::toggleAction()), QString("Toggles the state"));
QVERIFY(!toggleButton.isChecked());
QVERIFY(!interface->state().checked);
@@ -1154,12 +1157,18 @@ void tst_QAccessibility::buttonTest()
interface = QAccessible::queryAccessibleInterface(&checkBox);
actionInterface = interface->actionInterface();
QCOMPARE(interface->role(), QAccessible::CheckBox);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QVERIFY(!interface->state().checked);
actionInterface->doAction(QAccessibleActionInterface::toggleAction());
QTest::qWait(500);
- QCOMPARE(actionInterface->actionNames(), QStringList() << QAccessibleActionInterface::toggleAction() << QAccessibleActionInterface::setFocusAction());
+ QCOMPARE(actionInterface->actionNames(),
+ QStringList() << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction()
+ << QAccessibleActionInterface::setFocusAction());
QVERIFY(interface->state().checked);
QVERIFY(checkBox.isChecked());
QAccessible::State st;