summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-04-02 19:49:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-05 21:48:31 +0200
commitcc57a2e90f18a39ce3c74b6ad0db9a64aa135ddf (patch)
treea05e8c31601d85710f00fe1d8ebb21cabe9f048f /tests/auto/other
parent39c5098dbb3dd547c315c5baf0f83ebe81b28756 (diff)
Accessibility text updates for QTextEdit
For Mac this makes QTextEdit work nicely with VoiceOver. Task-number: QTBUG-37204 Change-Id: I1326d24ca6a932ad667ee395f62881b6ec64e892 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 9f0540173a..fcc5581bea 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1711,6 +1711,48 @@ void tst_QAccessibility::textEditTest()
QCOMPARE(textIface->textAtOffset(28, QAccessible::CharBoundary, &start, &end), QLatin1String("\n"));
QCOMPARE(start, 28);
QCOMPARE(end, 29);
+
+ edit.clear();
+ QTestAccessibility::clearEvents();
+
+ // make sure we get notifications when typing text
+ QTestEventList keys;
+ keys.addKeyClick('A');
+ keys.simulate(&edit);
+ keys.clear();
+ QAccessibleTextInsertEvent insertA(&edit, 0, "A");
+ QVERIFY_EVENT(&insertA);
+ QAccessibleTextCursorEvent move1(&edit, 1);
+ QVERIFY_EVENT(&move1);
+
+
+ keys.addKeyClick('c');
+ keys.simulate(&edit);
+ keys.clear();
+ QAccessibleTextInsertEvent insertC(&edit, 1, "c");
+ QVERIFY_EVENT(&insertC);
+ QAccessibleTextCursorEvent move2(&edit, 2);
+ QVERIFY_EVENT(&move2);
+
+ keys.addKeyClick(Qt::Key_Backspace);
+ keys.simulate(&edit);
+ keys.clear();
+
+ // FIXME this should get a proper string instead of space
+ QAccessibleTextRemoveEvent del(&edit, 1, " ");
+ QVERIFY_EVENT(&del);
+ QVERIFY_EVENT(&move1);
+
+ // it would be nicer to get a text update event, but the current implementation
+ // instead does remove and insert which is also fine
+ edit.setText(QStringLiteral("Accessibility rocks"));
+ QAccessibleTextRemoveEvent remove(&edit, 0, " ");
+ QVERIFY_EVENT(&remove);
+
+ // FIXME the new text is not there yet
+ QEXPECT_FAIL("", "Inserting should always contain the new text", Continue);
+ QAccessibleTextInsertEvent insert(&edit, 0, "Accessibility rocks");
+ QVERIFY_EVENT(&insert);
}
QTestAccessibility::clearEvents();
}