Unit test for characterRect in Accessible TextInterface.
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>
Tue, 22 Mar 2011 13:32:02 +0000 (14:32 +0100)
committerOlivier Goffart <olivier.goffart@nokia.com>
Tue, 10 May 2011 10:54:43 +0000 (12:54 +0200)
(cherry picked from commit 8888cef411ce1d1fc898970429e951f9ef623b0e)

tests/auto/qaccessibility/tst_qaccessibility.cpp

index 8d9603b..72254be 100644 (file)
@@ -2679,6 +2679,11 @@ void tst_QAccessibility::textEditTest()
     QCOMPARE(iface->text(QAccessible::Value, 4), QString("hello world"));
     QCOMPARE(iface->text(QAccessible::Value, 5), QString("how are you today?"));
     QCOMPARE(iface->text(QAccessible::Value, 6), QString());
+    QCOMPARE(iface->textInterface()->characterCount(), 31);
+    QFontMetrics fm(edit.font());
+    QCOMPARE(iface->textInterface()->characterRect(0, QAccessible2::RelativeToParent).size(), QSize(fm.width("h"), fm.height()));
+    QCOMPARE(iface->textInterface()->characterRect(5, QAccessible2::RelativeToParent).size(), QSize(fm.width(" "), fm.height()));
+    QCOMPARE(iface->textInterface()->characterRect(6, QAccessible2::RelativeToParent).size(), QSize(fm.width("w"), fm.height()));
     }
     QTestAccessibility::clearEvents();
 #else