Linux Accessibility: Fix expandable state

The state was forgotten from the translation layer, this is important for tree views.

Fixes: QTBUG-71223
Change-Id: Ief4004fe455889f9d5a7eb018bf34d37c36a6bd9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
This commit is contained in:
Frederik Gladhorn 2018-10-18 16:02:19 +02:00
parent 1c614d07fb
commit a87f85dbf9
2 changed files with 10 additions and 0 deletions

View File

@ -83,6 +83,8 @@ quint64 spiStatesFromQState(QAccessible::State state)
// if (state.HotTracked)
if (state.defaultButton)
setSpiStateBit(&spiState, ATSPI_STATE_IS_DEFAULT);
if (state.expandable)
setSpiStateBit(&spiState, ATSPI_STATE_EXPANDABLE);
if (state.expanded)
setSpiStateBit(&spiState, ATSPI_STATE_EXPANDED);
if (state.collapsed)

View File

@ -374,13 +374,21 @@ void tst_QAccessibilityLinux::testTreeWidget()
QDBusInterface *cell3 = getInterface(tableChildren.at(2), "org.a11y.atspi.Accessible");
QCOMPARE(cell3->property("Name").toString(), QLatin1String("0.0"));
QVERIFY(!hasState(cell3, ATSPI_STATE_EXPANDABLE));
QVERIFY(!hasState(cell3, ATSPI_STATE_EXPANDED));
QDBusInterface *cell4 = getInterface(tableChildren.at(3), "org.a11y.atspi.Accessible");
QCOMPARE(cell4->property("Name").toString(), QLatin1String("0.1"));
QDBusInterface *dbus_top2 = getInterface(tableChildren.at(4), "org.a11y.atspi.Accessible");
QCOMPARE(dbus_top2->property("Name").toString(), QLatin1String("1.0"));
QVERIFY(hasState(dbus_top2, ATSPI_STATE_EXPANDABLE));
QVERIFY(!hasState(dbus_top2, ATSPI_STATE_EXPANDED));
tree->expandItem(top2);
tableChildren = getChildren(treeIface);
QCOMPARE(tableChildren.size(), 8);
QVERIFY(hasState(dbus_top2, ATSPI_STATE_EXPANDED));
QDBusInterface *cell5 = getInterface(tableChildren.at(6), "org.a11y.atspi.Accessible");
QCOMPARE(cell5->property("Name").toString(), QLatin1String("1.0 0.0"));