diff options
author | Jan-Arve Saether <jan-arve.saether@nokia.com> | 2012-08-14 12:47:48 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-28 00:50:09 +0200 |
commit | b626b98b9552b459919f90496e60931e9f2071f1 (patch) | |
tree | f9bc6baafd658539b2355b9325cd412d5d2f2f62 /tests/auto/other | |
parent | 47459d33500b757386573cf802c4aac9a6be8e7e (diff) |
Implement QAccessibleLineEdit::characterRect()
It was probably not implemented because it needed to access
private APIs.
However, accessing those from this a11y plugin is unproblematic.
Forward-ported from Qt 4.8 with change
d2fb64d52fc6ec229d775f829a9a0cb3d251aad3 (and then slightly improved)
Change-Id: Ifa2d48c152fd75fc1fff49a05369787a7db3b902
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 80f52cbbff..1b8ac101bc 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1907,6 +1907,22 @@ void tst_QAccessibility::lineEditTest() } { + QLineEdit le(QStringLiteral("My characters have geometries."), toplevel); + // characterRect() + le.show(); + QTest::qWaitForWindowShown(&le); + QAIPtr iface(QAccessible::queryAccessibleInterface(&le)); + QAccessibleTextInterface* textIface = iface->textInterface(); + QVERIFY(textIface); + const QRect lineEditRect = iface->rect(); + // Only first 10 characters, check if they are within the bounds of line edit + for (int i = 0; i < 10; ++i) { + QVERIFY(lineEditRect.contains(textIface->characterRect(i))); + } + QTestAccessibility::clearEvents(); + } + + { // Test events: cursor movement, selection, text changes QString text = "Hello, world"; QLineEdit *lineEdit = new QLineEdit(text, toplevel); |