Make QAccessibleInterface::indexOfChild() 0-based.

Makes the code nicer and more consistent with the rest of the world.

Change-Id: I5ba0ee39f5b0afd1a079a3cea9990d123955ed3f
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
bb10
Frederik Gladhorn 2012-01-09 13:13:33 +01:00 committed by Qt by Nokia
parent 630131d585
commit 30ad53a0a6
10 changed files with 80 additions and 100 deletions

View File

@ -799,9 +799,8 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
/*!
\fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const
Returns the 1-based index of the object \a child in this object's
children list, or -1 if \a child is not a child of this object. 0
is not a possible return value.
Returns the 0-based index of the object \a child in this object's
children list, or -1 if \a child is not a child of this object.
All objects provide this information about their children.

View File

@ -221,10 +221,7 @@ int QAccessibleApplication::childCount() const
int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const
{
const QObjectList tlw(topLevelObjects());
int index = tlw.indexOf(child->object());
if (index != -1)
++index;
return index;
return tlw.indexOf(child->object());
}
/*! \reimp */

View File

@ -187,11 +187,13 @@ QAccessibleInterface* QAccessibleTabBar::child(int index) const
int QAccessibleTabBar::indexOfChild(const QAccessibleInterface *child) const
{
// FIXME this looks broken
if (child->object() && child->object() == tabBar()->d_func()->leftB)
return tabBar()->count() + 1; // fixme - one based
return tabBar()->count();
if (child->object() && child->object() == tabBar()->d_func()->rightB)
return tabBar()->count() + 2; // fixme - one based
return 0;
return tabBar()->count() + 1;
return -1;
}
int QAccessibleTabBar::childCount() const
@ -404,10 +406,7 @@ int QAccessibleAbstractScrollArea::indexOfChild(const QAccessibleInterface *chil
{
if (!child || !child->object())
return -1;
int index = accessibleChildren().indexOf(qobject_cast<QWidget *>(child->object()));
if (index >= 0)
return ++index;
return -1;
return accessibleChildren().indexOf(qobject_cast<QWidget *>(child->object()));
}
bool QAccessibleAbstractScrollArea::isValid() const

View File

@ -393,15 +393,15 @@ int QAccessibleTable::indexOfChild(const QAccessibleInterface *iface) const
Q_ASSERT(iface->role() != QAccessible::TreeItem); // should be handled by tree class
if (iface->role() == QAccessible::Cell || iface->role() == QAccessible::ListItem) {
const QAccessibleTableCell* cell = static_cast<const QAccessibleTableCell*>(iface);
return logicalIndex(cell->m_index);
return logicalIndex(cell->m_index) - 1;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
return cell->index + (verticalHeader() ? 1 : 0) + 1;
return cell->index + (verticalHeader() ? 1 : 0);
} else if (iface->role() == QAccessible::RowHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
return (cell->index+1) * (view->model()->rowCount()+1) + 1;
return (cell->index+1) * (view->model()->rowCount()+1);
} else if (iface->role() == QAccessible::Pane) {
return 1; // corner button
return 0; // corner button
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild Fix my children..."
<< iface->role() << iface->text(QAccessible::Name);
@ -543,14 +543,14 @@ int QAccessibleTree::indexOfChild(const QAccessibleInterface *iface) const
int row = treeView->d_func()->viewIndex(cell->m_index) + (horizontalHeader() ? 1 : 0);
int column = cell->m_index.column();
int index = row * view->model()->columnCount() + column + 1;
int index = row * view->model()->columnCount() + column;
//qDebug() << "QAccessibleTree::indexOfChild r " << row << " c " << column << "index " << index;
Q_ASSERT(index > treeView->model()->columnCount());
Q_ASSERT(index >= treeView->model()->columnCount());
return index;
} else if (iface->role() == QAccessible::ColumnHeader){
const QAccessibleTableHeaderCell* cell = static_cast<const QAccessibleTableHeaderCell*>(iface);
//qDebug() << "QAccessibleTree::indexOfChild header " << cell->index << "is: " << cell->index + 1;
return cell->index + 1;
return cell->index;
} else {
qWarning() << "WARNING QAccessibleTable::indexOfChild invalid child"
<< iface->role() << iface->text(QAccessible::Name);

View File

@ -113,14 +113,11 @@ QAccessibleInterface *QAccessibleMenu::parent() const
int QAccessibleMenu::indexOfChild( const QAccessibleInterface *child) const
{
int index = -1;
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menu()) {
index = menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
if (index != -1)
++index;
return menu()->actions().indexOf(qobject_cast<QAction*>(child->object()));
}
return index;
return -1;
}
#ifndef QT_NO_MENUBAR
@ -149,14 +146,11 @@ QAccessibleInterface *QAccessibleMenuBar::child(int index) const
int QAccessibleMenuBar::indexOfChild(const QAccessibleInterface *child) const
{
int index = -1;
QAccessible::Role r = child->role();
if ((r == QAccessible::MenuItem || r == QAccessible::Separator) && menuBar()) {
index = menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
if (index != -1)
++index;
return menuBar()->actions().indexOf(qobject_cast<QAction*>(child->object()));
}
return index;
return -1;
}
#endif // QT_NO_MENUBAR
@ -188,10 +182,8 @@ int QAccessibleMenuItem::childCount() const
int QAccessibleMenuItem::indexOfChild(const QAccessibleInterface * child) const
{
Q_ASSERT(child == 0);
if (child->role() == QAccessible::PopupMenu && child->object() == m_action->menu())
return 1;
if (child && child->role() == QAccessible::PopupMenu && child->object() == m_action->menu())
return 0;
return -1;
}
@ -227,7 +219,8 @@ int QAccessibleMenuItem::navigate(QAccessible::RelationFlag relation, int entry,
int index = parentIface->indexOfChild(this);
if (index != -1) {
index += (relation == QAccessible::Down ? +1 : -1);
*target = parentIface->child(index - 1);
if (index >= 0)
*target = parentIface->child(index);
}
}
delete parentIface;

View File

@ -727,10 +727,7 @@ int QAccessibleStackedWidget::indexOfChild(const QAccessibleInterface *child) co
return -1;
QWidget* widget = qobject_cast<QWidget*>(child->object());
int index = stackedWidget()->indexOf(widget);
if (index >= 0) // one based counting of children
return index + 1;
return -1;
return stackedWidget()->indexOf(widget);
}
QAccessibleInterface *QAccessibleStackedWidget::child(int index) const
@ -788,9 +785,7 @@ int QAccessibleMdiArea::indexOfChild(const QAccessibleInterface *child) const
if (!child || !child->object() || mdiArea()->subWindowList().isEmpty())
return -1;
if (QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(child->object())) {
int index = mdiArea()->subWindowList().indexOf(window);
if (index != -1)
return ++index;
return mdiArea()->subWindowList().indexOf(window);
}
return -1;
}
@ -882,7 +877,7 @@ QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const
int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) const
{
if (child && child->object() && child->object() == mdiSubWindow()->widget())
return 1;
return 0;
return -1;
}
@ -967,9 +962,7 @@ int QAccessibleWorkspace::indexOfChild(const QAccessibleInterface *child) const
if (!child || !child->object() || workspace()->windowList().isEmpty())
return -1;
if (QWidget *window = qobject_cast<QWidget *>(child->object())) {
int index = workspace()->windowList().indexOf(window);
if (index != -1)
return ++index;
return workspace()->windowList().indexOf(window);
}
return -1;
}
@ -1048,8 +1041,8 @@ int QAccessibleCalendarWidget::indexOfChild(const QAccessibleInterface *child) c
if (!child || !child->object() || childCount() <= 0)
return -1;
if (qobject_cast<QAbstractItemView *>(child->object()))
return childCount();
return 1;
return childCount() - 1; // FIXME
return 0;
}
QAccessibleInterface *QAccessibleCalendarWidget::child(int index) const
@ -1135,9 +1128,9 @@ int QAccessibleDockWidget::indexOfChild(const QAccessibleInterface *child) const
{
if (child) {
if (child->role() == QAccessible::TitleBar) {
return 1;
return 0;
} else {
return 2; //###
return 1; // FIXME
}
}
return -1;
@ -1414,8 +1407,7 @@ int QAccessibleMainWindow::childCount() const
int QAccessibleMainWindow::indexOfChild(const QAccessibleInterface *iface) const
{
QList<QWidget*> kids = childWidgets(mainWindow(), true);
int childIndex = kids.indexOf(static_cast<QWidget*>(iface->object()));
return childIndex == -1 ? -1 : ++childIndex;
return kids.indexOf(static_cast<QWidget*>(iface->object()));
}
QAccessibleInterface *QAccessibleMainWindow::childAt(int x, int y) const

View File

@ -232,7 +232,7 @@ static QAccessibleInterface *acast(void *ptr)
// hit a child, forward to child accessible interface.
int childIndex = acast(accessibleInterface)->indexOfChild(childInterface);
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex -1 parent:self accessibleInterface: childInterface];
QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex parent:self accessibleInterface: childInterface];
return [accessibleElement accessibilityHitTest:point];
}

View File

@ -676,8 +676,8 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::accNavigate(long navDir, VARIANT v
if (parent) {
int index = parent->indexOfChild(accessible);
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
if (index > 0 && index <= parent->childCount())
acc = parent->child(index - 1);
if (index >= 0 && index < parent->childCount())
acc = parent->child(index);
delete parent;
}
} else {

View File

@ -424,14 +424,16 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
switch (relation) {
case QAccessible::Covers:
if (entry > 0) {
QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
QAccessibleInterface *pIface = parent();
if (!pIface)
return -1;
QRect r = rect();
int sibCount = pIface->childCount();
QAccessibleInterface *sibling = 0;
for (int i = pIface->indexOfChild(this) + 1; i <= sibCount && entry; ++i) {
// FIXME: this code looks very suspicious
// why start at this index?
for (int i = pIface->indexOfChild(this) + 2; i <= sibCount && entry; ++i) {
sibling = pIface->child(i - 1);
if (!sibling || (sibling->state().invisible)) {
delete sibling;
@ -460,8 +462,9 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QRect r = rect();
int index = pIface->indexOfChild(this);
QAccessibleInterface *sibling = 0;
for (int i = 1; i < index && entry; ++i) {
sibling = pIface->child(i - 1);
// FIXME: why end at index?
for (int i = 0; i < index && entry; ++i) {
sibling = pIface->child(i);
Q_ASSERT(sibling);
if (!sibling || (sibling->state().invisible)) {
delete sibling;
@ -595,10 +598,7 @@ int QAccessibleWidget::childCount() const
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
QWidgetList cl = childWidgets(widget());
int index = cl.indexOf(qobject_cast<QWidget *>(child->object()));
if (index != -1)
++index;
return index;
return cl.indexOf(qobject_cast<QWidget *>(child->object()));
}
// from qwidget.cpp

View File

@ -99,7 +99,7 @@ static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
}
// Navigate to child, compare its object and role with the interface from queryAccessibleInterface(child).
QAccessibleInterface *navigatedChildInterface = interface->child(index - 1);
QAccessibleInterface *navigatedChildInterface = interface->child(index);
if (navigatedChildInterface == 0)
return false;
@ -2218,14 +2218,14 @@ void tst_QAccessibility::abstractScrollAreaTest()
QCOMPARE(interface->childCount(), 1);
QWidget *viewport = abstractScrollArea.viewport();
QVERIFY(viewport);
QVERIFY(verifyChild(viewport, interface, 1, globalGeometry));
QVERIFY(verifyChild(viewport, interface, 0, globalGeometry));
// Horizontal scrollBar.
abstractScrollArea.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
QCOMPARE(interface->childCount(), 2);
QWidget *horizontalScrollBar = abstractScrollArea.horizontalScrollBar();
QWidget *horizontalScrollBarContainer = horizontalScrollBar->parentWidget();
QVERIFY(verifyChild(horizontalScrollBarContainer, interface, 2, globalGeometry));
QVERIFY(verifyChild(horizontalScrollBarContainer, interface, 1, globalGeometry));
// Horizontal scrollBar widgets.
QLabel *secondLeftLabel = new QLabel(QLatin1String("L2"));
@ -2249,7 +2249,7 @@ void tst_QAccessibility::abstractScrollAreaTest()
QCOMPARE(interface->childCount(), 3);
QWidget *verticalScrollBar = abstractScrollArea.verticalScrollBar();
QWidget *verticalScrollBarContainer = verticalScrollBar->parentWidget();
QVERIFY(verifyChild(verticalScrollBarContainer, interface, 3, globalGeometry));
QVERIFY(verifyChild(verticalScrollBarContainer, interface, 2, globalGeometry));
// Vertical scrollBar widgets.
QLabel *secondTopLabel = new QLabel(QLatin1String("T2"));
@ -2272,7 +2272,7 @@ void tst_QAccessibility::abstractScrollAreaTest()
abstractScrollArea.setCornerWidget(new QLabel(QLatin1String("C")));
QCOMPARE(interface->childCount(), 4);
QWidget *cornerWidget = abstractScrollArea.cornerWidget();
QVERIFY(verifyChild(cornerWidget, interface, 4, globalGeometry));
QVERIFY(verifyChild(cornerWidget, interface, 3, globalGeometry));
// Test navigate.
QAccessibleInterface *target = 0;
@ -2290,58 +2290,58 @@ void tst_QAccessibility::abstractScrollAreaTest()
// viewport -> Down -> horizontalScrollBarContainer
const int horizontalScrollBarContainerIndex = indexOfChild(interface, horizontalScrollBarContainer);
QVERIFY(horizontalScrollBarContainerIndex != -1);
QCOMPARE(interface->navigate(QAccessible::Down, viewportIndex, &target), 0);
QCOMPARE(interface->navigate(QAccessible::Down, viewportIndex + 1, &target), 0);
QVERIFY(target);
QCOMPARE(target->object(), static_cast<QObject *>(horizontalScrollBarContainer));
delete target;
target = 0;
// horizontalScrollBarContainer -> Left -> NOTHING
QCOMPARE(interface->navigate(QAccessible::Left, horizontalScrollBarContainerIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Left, horizontalScrollBarContainerIndex + 1, &target), -1);
QVERIFY(!target);
// horizontalScrollBarContainer -> Down -> NOTHING
QVERIFY(horizontalScrollBarContainerIndex != -1);
QCOMPARE(interface->navigate(QAccessible::Down, horizontalScrollBarContainerIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Down, horizontalScrollBarContainerIndex + 1, &target), -1);
QVERIFY(!target);
// horizontalScrollBarContainer -> Right -> cornerWidget
const int cornerWidgetIndex = indexOfChild(interface, cornerWidget);
QVERIFY(cornerWidgetIndex != -1);
QCOMPARE(interface->navigate(QAccessible::Right, horizontalScrollBarContainerIndex, &target), 0);
QCOMPARE(interface->navigate(QAccessible::Right, horizontalScrollBarContainerIndex + 1, &target), 0);
QVERIFY(target);
QCOMPARE(target->object(), static_cast<QObject *>(cornerWidget));
delete target;
target = 0;
// cornerWidget -> Down -> NOTHING
QCOMPARE(interface->navigate(QAccessible::Down, cornerWidgetIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Down, cornerWidgetIndex + 1, &target), -1);
QVERIFY(!target);
// cornerWidget -> Right -> NOTHING
QVERIFY(cornerWidgetIndex != -1);
QCOMPARE(interface->navigate(QAccessible::Right, cornerWidgetIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Right, cornerWidgetIndex + 1, &target), -1);
QVERIFY(!target);
// cornerWidget -> Up -> verticalScrollBarContainer
const int verticalScrollBarContainerIndex = indexOfChild(interface, verticalScrollBarContainer);
QVERIFY(verticalScrollBarContainerIndex != -1);
QCOMPARE(interface->navigate(QAccessible::Up, cornerWidgetIndex, &target), 0);
QCOMPARE(interface->navigate(QAccessible::Up, cornerWidgetIndex + 1, &target), 0);
QVERIFY(target);
QCOMPARE(target->object(), static_cast<QObject *>(verticalScrollBarContainer));
delete target;
target = 0;
// verticalScrollBarContainer -> Right -> NOTHING
QCOMPARE(interface->navigate(QAccessible::Right, verticalScrollBarContainerIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Right, verticalScrollBarContainerIndex + 1, &target), -1);
QVERIFY(!target);
// verticalScrollBarContainer -> Up -> NOTHING
QCOMPARE(interface->navigate(QAccessible::Up, verticalScrollBarContainerIndex, &target), -1);
QCOMPARE(interface->navigate(QAccessible::Up, verticalScrollBarContainerIndex + 1, &target), -1);
QVERIFY(!target);
// verticalScrollBarContainer -> Left -> viewport
QCOMPARE(interface->navigate(QAccessible::Left, verticalScrollBarContainerIndex, &target), 0);
QCOMPARE(interface->navigate(QAccessible::Left, verticalScrollBarContainerIndex + 1, &target), 0);
QVERIFY(target);
QCOMPARE(target->object(), static_cast<QObject *>(viewport));
delete target;
@ -2394,18 +2394,18 @@ void tst_QAccessibility::listTest()
{
QAIPtr child1 = QAIPtr(iface->child(0));
QVERIFY(child1);
QCOMPARE(iface->indexOfChild(child1.data()), 1);
QCOMPARE(iface->indexOfChild(child1.data()), 0);
QCOMPARE(child1->text(QAccessible::Name), QString("Oslo"));
QCOMPARE(child1->role(), QAccessible::ListItem);
QAIPtr child2 = QAIPtr(iface->child(1));
QVERIFY(child2);
QCOMPARE(iface->indexOfChild(child2.data()), 2);
QCOMPARE(iface->indexOfChild(child2.data()), 1);
QCOMPARE(child2->text(QAccessible::Name), QString("Berlin"));
QAIPtr child3 = QAIPtr(iface->child(2));
QVERIFY(child3);
QCOMPARE(iface->indexOfChild(child3.data()), 3);
QCOMPARE(iface->indexOfChild(child3.data()), 2);
QCOMPARE(child3->text(QAccessible::Name), QString("Brisbane"));
}
QTestAccessibility::clearEvents();
@ -2514,7 +2514,7 @@ void tst_QAccessibility::treeTest()
QAccessibleInterface *header1 = 0;
header1 = iface->child(0);
QVERIFY(header1);
QCOMPARE(iface->indexOfChild(header1), 1);
QCOMPARE(iface->indexOfChild(header1), 0);
QCOMPARE(header1->text(QAccessible::Name), QString("Artist"));
QCOMPARE(header1->role(), QAccessible::ColumnHeader);
delete header1;
@ -2522,7 +2522,7 @@ void tst_QAccessibility::treeTest()
QAccessibleInterface *child1 = 0;
child1 = iface->child(2);
QVERIFY(child1);
QCOMPARE(iface->indexOfChild(child1), 3);
QCOMPARE(iface->indexOfChild(child1), 2);
QCOMPARE(child1->text(QAccessible::Name), QString("Spain"));
QCOMPARE(child1->role(), QAccessible::TreeItem);
QVERIFY(!(child1->state().expanded));
@ -2531,7 +2531,7 @@ void tst_QAccessibility::treeTest()
QAccessibleInterface *child2 = 0;
child2 = iface->child(4);
QVERIFY(child2);
QCOMPARE(iface->indexOfChild(child2), 5);
QCOMPARE(iface->indexOfChild(child2), 4);
QCOMPARE(child2->text(QAccessible::Name), QString("Austria"));
delete child2;
@ -2552,7 +2552,7 @@ void tst_QAccessibility::treeTest()
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 1);
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 0);
QVERIFY(cell2->state().expandable);
QCOMPARE(iface->indexOfChild(cell2), 5);
QCOMPARE(iface->indexOfChild(cell2), 4);
QVERIFY(!(cell2->state().expanded));
QCOMPARE(table2->columnDescription(1), QString("Work"));
delete cell2;
@ -2568,7 +2568,7 @@ void tst_QAccessibility::treeTest()
QCOMPARE(table2->rowCount(), 5);
cell1 = table2->cellAt(1,0);
QCOMPARE(cell1->text(QAccessible::Name), QString("Picasso"));
QCOMPARE(iface->indexOfChild(cell1), 5); // 1 based + 2 header + 2 for root item
QCOMPARE(iface->indexOfChild(cell1), 4); // 2 header + 2 for root item
cell2 = table2->cellAt(4,0);
QCOMPARE(cell2->text(QAccessible::Name), QString("Klimt"));
@ -2576,7 +2576,7 @@ void tst_QAccessibility::treeTest()
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 4);
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 0);
QVERIFY(!(cell2->state().expandable));
QCOMPARE(iface->indexOfChild(cell2), 11);
QCOMPARE(iface->indexOfChild(cell2), 10);
QCOMPARE(table2->columnDescription(0), QString("Artist"));
QCOMPARE(table2->columnDescription(1), QString("Work"));
@ -2618,13 +2618,13 @@ void tst_QAccessibility::tableTest()
QAccessibleInterface *cornerButton = iface->child(0);
QVERIFY(cornerButton);
QCOMPARE(iface->indexOfChild(cornerButton), 1);
QCOMPARE(iface->indexOfChild(cornerButton), 0);
QCOMPARE(cornerButton->role(), QAccessible::Pane);
delete cornerButton;
QAccessibleInterface *child1 = iface->child(2);
QVERIFY(child1);
QCOMPARE(iface->indexOfChild(child1), 3);
QCOMPARE(iface->indexOfChild(child1), 2);
QCOMPARE(child1->text(QAccessible::Name), QString("h2"));
QCOMPARE(child1->role(), QAccessible::ColumnHeader);
QVERIFY(!(child1->state().expanded));
@ -2632,7 +2632,7 @@ void tst_QAccessibility::tableTest()
QAccessibleInterface *child2 = iface->child(10);
QVERIFY(child2);
QCOMPARE(iface->indexOfChild(child2), 11);
QCOMPARE(iface->indexOfChild(child2), 10);
QCOMPARE(child2->text(QAccessible::Name), QString("1.1"));
QAccessibleTableCellInterface *cell2Iface = child2->tableCellInterface();
QCOMPARE(cell2Iface->rowIndex(), 1);
@ -2640,7 +2640,7 @@ void tst_QAccessibility::tableTest()
delete child2;
QAccessibleInterface *child3 = iface->child(11);
QCOMPARE(iface->indexOfChild(child3), 12);
QCOMPARE(iface->indexOfChild(child3), 11);
QCOMPARE(child3->text(QAccessible::Name), QString("1.2"));
delete child3;
@ -2654,7 +2654,7 @@ void tst_QAccessibility::tableTest()
QAccessibleInterface *cell1;
QVERIFY(cell1 = table2->cellAt(0,0));
QCOMPARE(cell1->text(QAccessible::Name), QString("0.0"));
QCOMPARE(iface->indexOfChild(cell1), 6);
QCOMPARE(iface->indexOfChild(cell1), 5);
QAccessibleInterface *cell2;
QVERIFY(cell2 = table2->cellAt(0,1));
@ -2662,7 +2662,7 @@ void tst_QAccessibility::tableTest()
QCOMPARE(cell2->role(), QAccessible::Cell);
QCOMPARE(cell2->tableCellInterface()->rowIndex(), 0);
QCOMPARE(cell2->tableCellInterface()->columnIndex(), 1);
QCOMPARE(iface->indexOfChild(cell2), 7);
QCOMPARE(iface->indexOfChild(cell2), 6);
delete cell2;
QAccessibleInterface *cell3;
@ -2671,7 +2671,7 @@ void tst_QAccessibility::tableTest()
QCOMPARE(cell3->role(), QAccessible::Cell);
QCOMPARE(cell3->tableCellInterface()->rowIndex(), 1);
QCOMPARE(cell3->tableCellInterface()->columnIndex(), 2);
QCOMPARE(iface->indexOfChild(cell3), 12);
QCOMPARE(iface->indexOfChild(cell3), 11);
delete cell3;
QCOMPARE(table2->columnDescription(0), QString("h1"));
@ -2722,7 +2722,7 @@ void tst_QAccessibility::calendarWidgetTest()
}
}
QVERIFY(navigationBar);
QVERIFY(verifyChild(navigationBar, interface, 1, globalGeometry));
QVERIFY(verifyChild(navigationBar, interface, 0, globalGeometry));
QAbstractItemView *calendarView = 0;
foreach (QObject *child, calendarWidget.children()) {
@ -2732,14 +2732,14 @@ void tst_QAccessibility::calendarWidgetTest()
}
}
QVERIFY(calendarView);
QVERIFY(verifyChild(calendarView, interface, 2, globalGeometry));
QVERIFY(verifyChild(calendarView, interface, 1, globalGeometry));
// Hide navigation bar.
calendarWidget.setNavigationBarVisible(false);
QCOMPARE(interface->childCount(), 1);
QVERIFY(!navigationBar->isVisible());
QVERIFY(verifyChild(calendarView, interface, 1, globalGeometry));
QVERIFY(verifyChild(calendarView, interface, 0, globalGeometry));
// Show navigation bar.
calendarWidget.setNavigationBarVisible(true);
@ -2838,10 +2838,10 @@ void tst_QAccessibility::dockWidgetTest()
QCOMPARE(childAt->role(), QAccessible::TitleBar);
int index = accDock1->indexOfChild(childAt);
delete childAt;
QAccessibleInterface *accTitleBar = accDock1->child(index - 1);
QAccessibleInterface *accTitleBar = accDock1->child(index);
QCOMPARE(accTitleBar->role(), QAccessible::TitleBar);
QCOMPARE(accDock1->indexOfChild(accTitleBar), 1);
QCOMPARE(accDock1->indexOfChild(accTitleBar), 0);
QAccessibleInterface *acc;
acc = accTitleBar->parent();
QVERIFY(acc);