summaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickaccessible
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickaccessible')
-rw-r--r--tests/auto/quick/qquickaccessible/data/text.qml11
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp26
2 files changed, 36 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickaccessible/data/text.qml b/tests/auto/quick/qquickaccessible/data/text.qml
index 88f292a61f..6daeacfd81 100644
--- a/tests/auto/quick/qquickaccessible/data/text.qml
+++ b/tests/auto/quick/qquickaccessible/data/text.qml
@@ -46,4 +46,15 @@ Item {
text: "A multi-line text edit\nTesting Accessibility."
Accessible.role: Accessible.EditableText
}
+
+ Text {
+ x: 100
+ y: 160
+ width: 100
+ height: 40
+ text : "Hello 3"
+ Accessible.name: text
+ Accessible.description: "description"
+ }
+
}
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 243d87f212..c5fdb6c1b9 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -312,7 +312,7 @@ void tst_QQuickAccessible::basicPropertiesTest()
QAccessibleInterface *item = iface->child(0);
QVERIFY(item);
- QCOMPARE(item->childCount(), 4);
+ QCOMPARE(item->childCount(), 5);
QCOMPARE(item->rect().size(), QSize(400, 400));
QCOMPARE(item->role(), QAccessible::Client);
QCOMPARE(iface->indexOfChild(item), 0);
@@ -382,6 +382,30 @@ void tst_QQuickAccessible::basicPropertiesTest()
QEXPECT_FAIL("", "multi line is not implemented", Continue);
QCOMPARE(textInput->state().multiLine, 1);
+ // Text "Hello 3"
+ QAccessibleInterface *text3 = item->child(4);
+ QVERIFY(text3);
+ QCOMPARE(text3->childCount(), 0);
+ QCOMPARE(text3->text(QAccessible::Name), QLatin1String("Hello 3"));
+ QCOMPARE(text3->role(), QAccessible::StaticText);
+ QCOMPARE(item->indexOfChild(text3), 4);
+ QCOMPARE(text3->state().editable, 0);
+ QCOMPARE(text3->state().readOnly, 0);
+ // test implicit state values due to role change
+ QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(text3->object());
+ attached->setRole(QAccessible::StaticText);
+ QCOMPARE(text3->role(), QAccessible::StaticText);
+ QCOMPARE(text3->state().readOnly, 1);
+
+ // see if implicit changes back
+ attached->setRole(QAccessible::EditableText);
+ QEXPECT_FAIL("", "EditableText does not implicitly set readOnly to false", Continue);
+ QCOMPARE(text3->state().readOnly, 0);
+ // explicitly set state
+ attached->set_readOnly(false);
+ attached->setRole(QAccessible::StaticText);
+ QCOMPARE(text3->state().readOnly, 0);
+
delete window;
QTestAccessibility::clearEvents();
}