Accessibility: Implement invisible and checkable state
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Tue, 15 May 2012 12:26:09 +0000 (14:26 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 22 May 2012 04:10:22 +0000 (06:10 +0200)
Change-Id: I3a079b4171e611b0136ef1582f6f16f71cf8f340
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
src/plugins/accessible/quick/qaccessiblequickitem.cpp
tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp

index 61dcbcf..f02128c 100644 (file)
@@ -152,6 +152,9 @@ QAccessible::State QAccessibleQuickItem::state() const
     if (item()->hasActiveFocus())
         state.focused = true;
 
+    if (!item()->canvas() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
+        state.invisible = true;
+
     QAccessible::Role r = role();
     switch (r) {
     case QAccessible::Button: {
@@ -162,7 +165,7 @@ QAccessible::State QAccessibleQuickItem::state() const
     }
     case QAccessible::CheckBox:
     case QAccessible::RadioButton: {
-        // FIXME when states are extended: state.checkable = true;
+        state.checkable = true;
         state.checked = item()->property("checked").toBool();
         break;
     }
index 45a9d11..fa2c1cf 100644 (file)
@@ -399,16 +399,24 @@ void tst_QQuickAccessible::checkableTest()
     QAI button1 = QAI(root->child(0));
     QCOMPARE(button1->role(), QAccessible::Button);
     QVERIFY(!(button1->state().checked));
+    QVERIFY(!(button1->state().checkable));
+
     QAI button2 = QAI(root->child(1));
     QVERIFY(!(button2->state().checked));
+    QVERIFY(button2->state().checkable);
+
     QAI button3 = QAI(root->child(2));
     QVERIFY(button3->state().checked);
+    QVERIFY(button3->state().checkable);
 
     QAI checkBox1 = QAI(root->child(3));
     QCOMPARE(checkBox1->role(), QAccessible::CheckBox);
     QVERIFY((checkBox1->state().checked));
+    QVERIFY(checkBox1->state().checkable);
+
     QAI checkBox2 = QAI(root->child(4));
     QVERIFY(!(checkBox2->state().checked));
+    QVERIFY(checkBox2->state().checkable);
 }
 
 QTEST_MAIN(tst_QQuickAccessible)