summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2011-10-04 16:46:45 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-06 01:28:15 +0200
commit887eec67815083a9d01d2f186898c338b6b5e565 (patch)
tree5bf6db2729a274cf26b82521f6df19b2850b769d /tests
parentb4ea7762c50b281fbde29a76f0507f51150b52c9 (diff)
Clean up accessible spin box test.
Change-Id: Ic56f5a99ee57a23d43a81d66af82324ecba8964c Reviewed-on: http://codereview.qt-project.org/5994 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index e0bcb30f71..4bb7a97a71 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -1658,21 +1658,32 @@ void tst_QAccessibility::menuTest()
void tst_QAccessibility::spinBoxTest()
{
QSpinBox * const spinBox = new QSpinBox();
+ spinBox->setValue(3);
spinBox->show();
QAccessibleInterface * const interface = QAccessible::queryAccessibleInterface(spinBox);
QVERIFY(interface);
+ QCOMPARE(interface->role(), QAccessible::SpinBox);
const QRect widgetRect = spinBox->geometry();
- const QRect accessibleRect = interface->rect(0);
+ const QRect accessibleRect = interface->rect();
QCOMPARE(accessibleRect, widgetRect);
+ QCOMPARE(interface->text(QAccessible::Value, 0), QLatin1String("3"));
- // Test that we get valid rects for all the spinbox child interfaces.
+ // one child, the line edit
const int numChildren = interface->childCount();
- for (int i = 1; i <= numChildren; ++i) {
- const QRect childRect = interface->rect(i);
- QVERIFY(childRect.isNull() == false);
- }
+ QCOMPARE(numChildren, 1);
+ QAccessibleInterface *lineEdit = interface->child(0);
+
+ QCOMPARE(lineEdit->role(), QAccessible::EditableText);
+ QCOMPARE(lineEdit->text(QAccessible::Value, 0), QLatin1String("3"));
+ delete lineEdit;
+
+ QVERIFY(interface->valueInterface());
+ QCOMPARE(interface->valueInterface()->currentValue().toInt(), 3);
+ interface->valueInterface()->setCurrentValue(23);
+ QCOMPARE(interface->valueInterface()->currentValue().toInt(), 23);
+ QCOMPARE(spinBox->value(), 23);
spinBox->setFocus();
QTestAccessibility::clearEvents();