aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-09 01:00:17 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-05-09 09:31:24 +0200
commit90f85482bb0499a55993b94743266fedf4cefef1 (patch)
treea97a45390ace4b284d80a506e76d2e58bb24d29c /tests/auto
parentae8c798a0a01334d1af33a59acdaeda8898a9f5c (diff)
parent0a775ded35acf7172e3f852d55de7e28a5370653 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/qml/compiler/qqmlirbuilder.cpp Change-Id: I2cfda470515e2df778ad3c89105c07344af07c6d
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/qquickaccessible/data/text.qml (renamed from tests/auto/quick/qquickaccessible/data/statictext.qml)18
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp46
2 files changed, 61 insertions, 3 deletions
diff --git a/tests/auto/quick/qquickaccessible/data/statictext.qml b/tests/auto/quick/qquickaccessible/data/text.qml
index 1092f33daf..88f292a61f 100644
--- a/tests/auto/quick/qquickaccessible/data/statictext.qml
+++ b/tests/auto/quick/qquickaccessible/data/text.qml
@@ -28,4 +28,22 @@ Item {
Accessible.name: "The Hello 2 accessible text"
Accessible.description: "A text description"
}
+
+ TextInput {
+ x: 100
+ y: 80
+ width: 200
+ height: 40
+ text: "A text input"
+ Accessible.role: Accessible.EditableText
+ }
+
+ TextEdit {
+ x: 100
+ y: 120
+ width: 200
+ height: 100
+ text: "A multi-line text edit\nTesting Accessibility."
+ Accessible.role: Accessible.EditableText
+ }
}
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 1bfeb94161..243d87f212 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -130,7 +130,7 @@ void tst_QQuickAccessible::commonTests_data()
{
QTest::addColumn<QString>("accessibleRoleFileName");
- QTest::newRow("StaticText") << "statictext.qml";
+ QTest::newRow("Text") << "text.qml";
QTest::newRow("PushButton") << "pushbutton.qml";
}
@@ -302,7 +302,7 @@ void tst_QQuickAccessible::basicPropertiesTest()
QCOMPARE(app->childCount(), 0);
QQuickView *window = new QQuickView();
- window->setSource(testFileUrl("statictext.qml"));
+ window->setSource(testFileUrl("text.qml"));
window->show();
QCOMPARE(app->childCount(), 1);
@@ -312,7 +312,7 @@ void tst_QQuickAccessible::basicPropertiesTest()
QAccessibleInterface *item = iface->child(0);
QVERIFY(item);
- QCOMPARE(item->childCount(), 2);
+ QCOMPARE(item->childCount(), 4);
QCOMPARE(item->rect().size(), QSize(400, 400));
QCOMPARE(item->role(), QAccessible::Client);
QCOMPARE(iface->indexOfChild(item), 0);
@@ -338,10 +338,50 @@ void tst_QQuickAccessible::basicPropertiesTest()
QCOMPARE(text2->rect().y(), item->rect().y() + 40);
QCOMPARE(text2->role(), QAccessible::StaticText);
QCOMPARE(item->indexOfChild(text2), 1);
+ QCOMPARE(text2->state().editable, 0);
+ QCOMPARE(text2->state().readOnly, 1);
QCOMPARE(iface->indexOfChild(text2), -1);
QCOMPARE(text2->indexOfChild(item), -1);
+ // TextInput
+ QAccessibleInterface *textInput = item->child(2);
+ QVERIFY(textInput);
+ QCOMPARE(textInput->childCount(), 0);
+ QCOMPARE(textInput->role(), QAccessible::EditableText);
+ QCOMPARE(textInput->state().editable, 1);
+ QCOMPARE(textInput->state().readOnly, 0);
+ QCOMPARE(textInput->state().multiLine, 0);
+ QCOMPARE(textInput->state().focusable, 1);
+ QCOMPARE(textInput->text(QAccessible::Value), "A text input");
+ auto textInterface = textInput->textInterface();
+ QVERIFY(textInterface);
+ auto editableTextInterface = textInput->editableTextInterface();
+ QEXPECT_FAIL("", "EditableTextInterface is not implemented", Continue);
+ QVERIFY(editableTextInterface);
+ auto newText = QString("a new text");
+ textInput->setText(QAccessible::Value, newText);
+ QCOMPARE(textInput->text(QAccessible::Value), newText);
+
+ // TextEdit
+ QAccessibleInterface *textEdit = item->child(3);
+ QVERIFY(textEdit);
+ QCOMPARE(textEdit->childCount(), 0);
+ QCOMPARE(textEdit->role(), QAccessible::EditableText);
+ QCOMPARE(textEdit->state().editable, 1);
+ QCOMPARE(textEdit->state().readOnly, 0);
+ QCOMPARE(textEdit->state().focusable, 1);
+ QCOMPARE(textEdit->text(QAccessible::Value), "A multi-line text edit\nTesting Accessibility.");
+ auto textEditTextInterface = textEdit->textInterface();
+ QVERIFY(textEditTextInterface);
+ auto textEditEditableTextInterface = textEdit->editableTextInterface();
+ QEXPECT_FAIL("", "EditableTextInterface is not implemented", Continue);
+ QVERIFY(textEditEditableTextInterface);
+ textEdit->setText(QAccessible::Value, newText);
+ QCOMPARE(textEdit->text(QAccessible::Value), newText);
+ QEXPECT_FAIL("", "multi line is not implemented", Continue);
+ QCOMPARE(textInput->state().multiLine, 1);
+
delete window;
QTestAccessibility::clearEvents();
}