aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickaccessible
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2012-03-23 17:40:38 +0100
committerQt by Nokia <qt-info@nokia.com>2012-04-03 15:07:40 +0200
commit60b9151d36a9fb84b771f18d2c517e122b08ed70 (patch)
tree0358d2ef8c9a8a79e2b5ecaed1d4753274a33d1e /tests/auto/quick/qquickaccessible
parent330dbc6bba11f401c9f258aa6281dbdfebfc8602 (diff)
Do not automatically mark all text items as accessible.
This adds more confusion and fails more often due to invisible items and overlays that it helps. The test saw lots of "children" before that were text elements, these are gone now. With this the hack to make children based on item role invisible can go away. Change-Id: Ic5a3bba6e271747237e0e85168f4290bf596bc8a Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickaccessible')
-rw-r--r--tests/auto/quick/qquickaccessible/data/statictext.qml4
-rw-r--r--tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp40
2 files changed, 26 insertions, 18 deletions
diff --git a/tests/auto/quick/qquickaccessible/data/statictext.qml b/tests/auto/quick/qquickaccessible/data/statictext.qml
index a0821cfc4d..7cf1b707a0 100644
--- a/tests/auto/quick/qquickaccessible/data/statictext.qml
+++ b/tests/auto/quick/qquickaccessible/data/statictext.qml
@@ -10,6 +10,10 @@ Item {
width: 200
height: 50
text : "Hello Accessibility"
+
+ // Setting any value of the attached property
+ // makes an item accessible.
+ Accessible.name: text
}
Text {
diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
index 48c07c6e2c..ca04751aae 100644
--- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
+++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp
@@ -340,23 +340,23 @@ void tst_QQuickAccessible::hitTest()
canvas->setSource(testFileUrl("hittest.qml"));
canvas->show();
- QAI iface = QAI(QAccessible::queryAccessibleInterface(canvas));
- QVERIFY(iface.data());
- QAI rootItem = QAI(iface->child(0));
+ QAI canvasIface = QAI(QAccessible::queryAccessibleInterface(canvas));
+ QVERIFY(canvasIface.data());
+ QAI rootItem = QAI(canvasIface->child(0));
QRect rootRect = rootItem->rect();
// hit the root item
- QAI itemHit(iface->childAt(rootRect.x() + 200, rootRect.y() + 50));
- QVERIFY(itemHit);
- QCOMPARE(rootRect, itemHit->rect());
+ QAI rootItemIface(canvasIface->childAt(rootRect.x() + 200, rootRect.y() + 50));
+ QVERIFY(rootItemIface);
+ QCOMPARE(rootRect, rootItemIface->rect());
// hit rect1
- QAI rect1(rootItem->child(1));
+ QAI rect1(rootItem->child(0));
QRect rect1Rect = rect1->rect();
- itemHit = QAI(rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10));
- QVERIFY(itemHit);
- QCOMPARE(rect1Rect, itemHit->rect());
- QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect1"));
+ rootItemIface = QAI(rootItem->childAt(rect1Rect.x() + 10, rect1Rect.y() + 10));
+ QVERIFY(rootItemIface);
+ QCOMPARE(rect1Rect, rootItemIface->rect());
+ QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect1"));
// should also work from top level (app)
QAI app(QAccessible::queryAccessibleInterface(qApp));
@@ -366,16 +366,20 @@ void tst_QQuickAccessible::hitTest()
QCOMPARE(itemHit2->text(QAccessible::Name), QLatin1String("rect1"));
// hit rect201
- QAI rect2(rootItem->child(2));
- QAI rect20(rect2->child(1));
- QAI rect201(rect20->child(2));
+ QAI rect2(rootItem->child(1));
+ QVERIFY(rect2);
+ // FIXME: This is seems broken on mac
+ // QCOMPARE(rect2->rect().translated(rootItem->rect().x(), rootItem->rect().y()), QRect(0, 50, 100, 100));
+ QAI rect20(rect2->child(0));
+ QVERIFY(rect20);
+ QAI rect201(rect20->child(1));
QVERIFY(rect201);
QRect rect201Rect = rect201->rect();
- itemHit = QAI(iface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20));
- QVERIFY(itemHit);
- QCOMPARE(itemHit->rect(), rect201Rect);
- QCOMPARE(itemHit->text(QAccessible::Name), QLatin1String("rect201"));
+ rootItemIface = QAI(canvasIface->childAt(rect201Rect.x() + 20, rect201Rect.y() + 20));
+ QVERIFY(rootItemIface);
+ QCOMPARE(rootItemIface->rect(), rect201Rect);
+ QCOMPARE(rootItemIface->text(QAccessible::Name), QLatin1String("rect201"));
delete canvas;
}