summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-09-23 10:28:51 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-27 05:15:23 +0200
commiteddd87826e5b5c37f3391f1196be4a8c08bc46de (patch)
treeb9d635b80d8f846e4a6afc909983e10dc9ad0527 /tests
parenta8dc1b15dcc9aebb57d91d8fbb8a374e2765891c (diff)
Simplify QAccessibleDial and make it inherit QAccessibleAbstractSlider.
This adds the value interface and removes the children of the dial. Change-Id: I47eac77c01dce36db077f553054ef37353242f77 Reviewed-on: http://codereview.qt-project.org/4821 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp53
1 files changed, 21 insertions, 32 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 64e1ceca4f..f08c8e9c30 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -845,11 +845,11 @@ void tst_QAccessibility::accessibleName()
QString name = tr("Widget Name %1").arg(i);
child->setAccessibleName(name);
QAccessibleInterface *acc = QAccessible::queryAccessibleInterface(child);
- QCOMPARE(acc->text(QAccessible::Name, 0), name);
+ QCOMPARE(acc->text(QAccessible::Name), name);
QString desc = tr("Widget Description %1").arg(i);
child->setAccessibleDescription(desc);
- QCOMPARE(acc->text(QAccessible::Description, 0), desc);
+ QCOMPARE(acc->text(QAccessible::Description), desc);
}
@@ -2350,43 +2350,32 @@ void tst_QAccessibility::dialTest()
{
{
QDial dial;
- dial.setValue(20);
- QCOMPARE(dial.value(), 20);
+ dial.setMinimum(23);
+ dial.setMaximum(121);
+ dial.setValue(42);
+ QCOMPARE(dial.value(), 42);
dial.show();
-#if defined(Q_OS_UNIX)
- QCoreApplication::processEvents();
- QTest::qWait(100);
-#endif
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&dial);
QVERIFY(interface);
-
- // Child count; 1 = SpeedoMeter, 2 = SliderHandle.
- QCOMPARE(interface->childCount(), 2);
-
- QCOMPARE(interface->role(0), QAccessible::Dial);
- QCOMPARE(interface->role(1), QAccessible::Slider);
- QCOMPARE(interface->role(2), QAccessible::Indicator);
+ QCOMPARE(interface->childCount(), 0);
QCOMPARE(interface->text(QAccessible::Value, 0), QString::number(dial.value()));
- QCOMPARE(interface->text(QAccessible::Value, 1), QString::number(dial.value()));
- QCOMPARE(interface->text(QAccessible::Value, 2), QString::number(dial.value()));
- QCOMPARE(interface->text(QAccessible::Name, 0), QLatin1String("QDial"));
- QCOMPARE(interface->text(QAccessible::Name, 1), QLatin1String("SpeedoMeter"));
- QCOMPARE(interface->text(QAccessible::Name, 2), QLatin1String("SliderHandle"));
- QCOMPARE(interface->text(QAccessible::Name, 3), QLatin1String(""));
-
- QCOMPARE(interface->state(1), interface->state(0));
- QCOMPARE(interface->state(2), interface->state(0) | QAccessible::HotTracked);
-
- // Rect
- QCOMPARE(interface->rect(0), dial.geometry());
- QVERIFY(interface->rect(1).isValid());
- QVERIFY(dial.geometry().contains(interface->rect(1)));
- QVERIFY(interface->rect(2).isValid());
- QVERIFY(interface->rect(1).contains(interface->rect(2)));
- QVERIFY(!interface->rect(3).isValid());
+ QCOMPARE(interface->rect(), dial.geometry());
+ QAccessibleValueInterface *valueIface = interface->valueInterface();
+ QVERIFY(valueIface != 0);
+ QCOMPARE(valueIface->minimumValue().toInt(), dial.minimum());
+ QCOMPARE(valueIface->maximumValue().toInt(), dial.maximum());
+ QCOMPARE(valueIface->currentValue().toInt(), 42);
+ dial.setValue(50);
+ QCOMPARE(valueIface->currentValue().toInt(), dial.value());
+ dial.setValue(0);
+ QCOMPARE(valueIface->currentValue().toInt(), dial.value());
+ dial.setValue(100);
+ QCOMPARE(valueIface->currentValue().toInt(), dial.value());
+ valueIface->setCurrentValue(77);
+ QCOMPARE(77, dial.value());
}
QTestAccessibility::clearEvents();
}