diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2012-10-15 14:22:25 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-27 14:22:52 +0200 |
commit | 596f23554ab82a87a05f9c5c7a6752448345a769 (patch) | |
tree | f3d2996649123ef2b63013b77b5c5b4291033886 /tests/auto/other | |
parent | 0ceb6541d7ae4958684422083e30fd9c222aa857 (diff) |
Clean up index handling in itemviews accessibility.
Change-Id: Icc017c7df9cb0dc4bf17e5168c1e3acda6af7523
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.cpp | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index ab9473302a..80f52cbbff 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -2543,13 +2543,27 @@ void tst_QAccessibility::treeTest() QVERIFY(!(cell2->state().expandable)); QCOMPARE(iface->indexOfChild(cell2), 10); + QPoint pos = treeView->mapToGlobal(QPoint(0,0)); + QModelIndex index = treeView->model()->index(0, 0, treeView->model()->index(1, 0)); + pos += treeView->visualRect(index).center(); + pos += QPoint(0, treeView->header()->height()); + QAIPtr childAt2(iface->childAt(pos.x(), pos.y())); + QVERIFY(childAt2); + QCOMPARE(childAt2->text(QAccessible::Name), QString("Klimt")); + QCOMPARE(table2->columnDescription(0), QString("Artist")); QCOMPARE(table2->columnDescription(1), QString("Work")); delete iface; + delete treeView; QTestAccessibility::clearEvents(); } +// The table used below is this: +// Button (0) | h1 (1) | h2 (2) | h3 (3) +// v1 (4) | 0.0 (5) | 1.0 (6) | 2.0 (7) +// v2 (8) | 0.1 (9) | 1.1 (10) | 2.1 (11) +// v3 (12) | 0.2 (13) | 1.2 (14) | 2.2 (15) void tst_QAccessibility::tableTest() { QTableWidget *tableView = new QTableWidget(3, 3); @@ -2584,24 +2598,38 @@ void tst_QAccessibility::tableTest() QCOMPARE(iface->indexOfChild(cornerButton.data()), 0); QCOMPARE(cornerButton->role(), QAccessible::Pane); - QAIPtr child1(iface->child(2)); - QVERIFY(child1); - QCOMPARE(iface->indexOfChild(child1.data()), 2); - QCOMPARE(child1->text(QAccessible::Name), QString("h2")); - QCOMPARE(child1->role(), QAccessible::ColumnHeader); - QVERIFY(!(child1->state().expanded)); + QAIPtr h2(iface->child(2)); + QVERIFY(h2); + QCOMPARE(iface->indexOfChild(h2.data()), 2); + QCOMPARE(h2->text(QAccessible::Name), QString("h2")); + QCOMPARE(h2->role(), QAccessible::ColumnHeader); + QVERIFY(!(h2->state().expanded)); + + QAIPtr v3(iface->child(12)); + QVERIFY(v3); + QCOMPARE(iface->indexOfChild(v3.data()), 12); + QCOMPARE(v3->text(QAccessible::Name), QString("v3")); + QCOMPARE(v3->role(), QAccessible::RowHeader); + QVERIFY(!(v3->state().expanded)); + + + QAIPtr child10(iface->child(10)); + QVERIFY(child10); + QCOMPARE(iface->indexOfChild(child10.data()), 10); + QCOMPARE(child10->text(QAccessible::Name), QString("1.1")); + QAccessibleTableCellInterface *cell10Iface = child10->tableCellInterface(); + QCOMPARE(cell10Iface->rowIndex(), 1); + QCOMPARE(cell10Iface->columnIndex(), 1); + QPoint pos = tableView->mapToGlobal(QPoint(0,0)); + pos += tableView->visualRect(tableView->model()->index(1, 1)).center(); + pos += QPoint(tableView->verticalHeader()->width(), tableView->horizontalHeader()->height()); + QAIPtr childAt10(iface->childAt(pos.x(), pos.y())); + QCOMPARE(childAt10->text(QAccessible::Name), QString("1.1")); + + QAIPtr child11(iface->child(11)); + QCOMPARE(iface->indexOfChild(child11.data()), 11); + QCOMPARE(child11->text(QAccessible::Name), QString("1.2")); - QAIPtr child2(iface->child(10)); - QVERIFY(child2); - QCOMPARE(iface->indexOfChild(child2.data()), 10); - QCOMPARE(child2->text(QAccessible::Name), QString("1.1")); - QAccessibleTableCellInterface *cell2Iface = child2->tableCellInterface(); - QCOMPARE(cell2Iface->rowIndex(), 1); - QCOMPARE(cell2Iface->columnIndex(), 1); - - QAIPtr child3(iface->child(11)); - QCOMPARE(iface->indexOfChild(child3.data()), 11); - QCOMPARE(child3->text(QAccessible::Name), QString("1.2")); QTestAccessibility::clearEvents(); |