Remove all references to QAccessible::(Covers|Covered)

These were not used in any bridges, and none of the bridges
(MSAA, Cocoa, AT-SPI/IA2) can hardly make use of this information.

Change-Id: If3cad6b6c1928535dd932f46c9ec6883a4a19c76
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Jan-Arve Saether 2012-01-18 14:02:23 +01:00 committed by Qt by Nokia
parent f4ea85f8fe
commit 67a3698b3c
3 changed files with 2 additions and 203 deletions

View File

@ -307,11 +307,6 @@ public:
enum RelationFlag { enum RelationFlag {
Unrelated = 0x00000000, Unrelated = 0x00000000,
Self = 0x00000001, Self = 0x00000001,
Covers = 0x00001000,
Covered = 0x00002000,
GeometryMask = 0x0000ff00,
FocusChild = 0x00010000, FocusChild = 0x00010000,
Label = 0x00020000, Label = 0x00020000,
Labelled = 0x00040000, Labelled = 0x00040000,

View File

@ -361,34 +361,8 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
if (inverse & QAccessible::Label) if (inverse & QAccessible::Label)
relation |= QAccessible::Labelled; relation |= QAccessible::Labelled;
if(o == object()) { if(o == object())
return relation | QAccessible::Self; relation |= QAccessible::Self;
}
QObject *parent = object()->parent();
if (o->parent() == parent) {
QAccessibleInterface *sibIface = QAccessible::queryAccessibleInterface(o);
Q_ASSERT(sibIface);
QRect wg = rect();
QRect sg = sibIface->rect();
if (wg.intersects(sg)) {
QAccessibleInterface *pIface = 0;
pIface = sibIface->parent();
if (pIface && !(sibIface->state().invisible | state().invisible)) {
int wi = pIface->indexOfChild(this);
int si = pIface->indexOfChild(sibIface);
if (wi > si)
relation |= QAccessible::Covers;
else
relation |= QAccessible::Covered;
}
delete pIface;
}
delete sibIface;
return relation;
}
return relation; return relation;
} }
@ -422,69 +396,6 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QObject *targetObject = 0; QObject *targetObject = 0;
switch (relation) { switch (relation) {
case QAccessible::Covers:
if (entry > 0) {
QAccessibleInterface *pIface = parent();
if (!pIface)
return -1;
QRect r = rect();
int sibCount = pIface->childCount();
QAccessibleInterface *sibling = 0;
// 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;
sibling = 0;
continue;
}
if (sibling->rect().intersects(r))
--entry;
if (!entry)
break;
delete sibling;
sibling = 0;
}
delete pIface;
*target = sibling;
if (*target)
return 0;
}
break;
case QAccessible::Covered:
if (entry > 0) {
QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
if (!pIface)
return -1;
QRect r = rect();
int index = pIface->indexOfChild(this);
QAccessibleInterface *sibling = 0;
// 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;
sibling = 0;
continue;
}
if (sibling->rect().intersects(r))
--entry;
if (!entry)
break;
delete sibling;
sibling = 0;
}
delete pIface;
*target = sibling;
if (*target)
return 0;
}
break;
// Logical // Logical
case QAccessible::FocusChild: case QAccessible::FocusChild:
{ {

View File

@ -233,7 +233,6 @@ private slots:
void statesStructTest(); void statesStructTest();
void navigateHierarchy(); void navigateHierarchy();
void sliderTest(); void sliderTest();
void navigateCovered();
void textAttributes(); void textAttributes();
void hideShowTest(); void hideShowTest();
@ -515,112 +514,6 @@ void tst_QAccessibility::sliderTest()
QTestAccessibility::clearEvents(); QTestAccessibility::clearEvents();
} }
void tst_QAccessibility::navigateCovered()
{
{
QWidget *w = new QWidget(0);
w->setObjectName(QString("Harry"));
QWidget *w1 = new QWidget(w);
w1->setObjectName(QString("1"));
QWidget *w2 = new QWidget(w);
w2->setObjectName(QString("2"));
w->show();
#if defined(Q_OS_UNIX)
QCoreApplication::processEvents();
QTest::qWait(100);
#endif
w->setFixedSize(6, 6);
w1->setFixedSize(5, 5);
w2->setFixedSize(5, 5);
w2->move(0, 0);
w1->raise();
QAccessibleInterface *iface1 = QAccessible::queryAccessibleInterface(w1);
QVERIFY(iface1 != 0);
QVERIFY(iface1->isValid());
QAccessibleInterface *iface2 = QAccessible::queryAccessibleInterface(w2);
QVERIFY(iface2 != 0);
QVERIFY(iface2->isValid());
QAccessibleInterface *iface3 = 0;
QCOMPARE(iface1->navigate(QAccessible::Covers, -42, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface1->navigate(QAccessible::Covers, 0, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface1->navigate(QAccessible::Covers, 2, &iface3), -1);
QVERIFY(iface3 == 0);
for (int loop = 0; loop < 2; ++loop) {
for (int x = 0; x < w->width(); ++x) {
for (int y = 0; y < w->height(); ++y) {
w1->move(x, y);
if (w1->geometry().intersects(w2->geometry())) {
QVERIFY(iface1->relationTo(iface2) & QAccessible::Covers);
QVERIFY(iface2->relationTo(iface1) & QAccessible::Covered);
QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), 0);
QVERIFY(iface3 != 0);
QVERIFY(iface3->isValid());
QCOMPARE(iface3->object(), iface2->object());
delete iface3; iface3 = 0;
QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), 0);
QVERIFY(iface3 != 0);
QVERIFY(iface3->isValid());
QCOMPARE(iface3->object(), iface1->object());
delete iface3; iface3 = 0;
} else {
QVERIFY(!(iface1->relationTo(iface2) & QAccessible::Covers));
QVERIFY(!(iface2->relationTo(iface1) & QAccessible::Covered));
QCOMPARE(iface1->navigate(QAccessible::Covered, 1, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface2->navigate(QAccessible::Covers, 1, &iface3), -1);
QVERIFY(iface3 == 0);
}
}
}
if (!loop) {
// switch children for second loop
w2->raise();
QAccessibleInterface *temp = iface1;
iface1 = iface2;
iface2 = temp;
}
}
delete iface1; iface1 = 0;
delete iface2; iface2 = 0;
iface1 = QAccessible::queryAccessibleInterface(w1);
QVERIFY(iface1 != 0);
QVERIFY(iface1->isValid());
iface2 = QAccessible::queryAccessibleInterface(w2);
QVERIFY(iface2 != 0);
QVERIFY(iface2->isValid());
w1->move(0,0);
w2->move(0,0);
w1->raise();
QVERIFY(iface1->relationTo(iface2) & QAccessible::Covers);
QVERIFY(iface2->relationTo(iface1) & QAccessible::Covered);
QVERIFY(!iface1->state().invisible);
w1->hide();
QVERIFY(iface1->state().invisible);
QVERIFY(!(iface1->relationTo(iface2) & QAccessible::Covers));
QVERIFY(!(iface2->relationTo(iface1) & QAccessible::Covered));
QCOMPARE(iface2->navigate(QAccessible::Covered, 1, &iface3), -1);
QVERIFY(iface3 == 0);
QCOMPARE(iface1->navigate(QAccessible::Covers, 1, &iface3), -1);
QVERIFY(iface3 == 0);
delete iface1; iface1 = 0;
delete iface2; iface2 = 0;
delete w;
}
QTestAccessibility::clearEvents();
}
void tst_QAccessibility::navigateHierarchy() void tst_QAccessibility::navigateHierarchy()
{ {
{ {