summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-15 11:03:37 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-15 16:34:03 +0200
commit51ac037c2082a4f6681eda07795869f4c14488e1 (patch)
tree238d9d58b826a055eb9c54973029867db7c3d16b /tests
parentd5fa096056b033203d9a54497e1554f153a19d93 (diff)
Implement accessible value interface
Change-Id: I837d7f3041aec59ae83c0fe802bc83b746e62b76 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
index 9bf4c69e..8d98b06e 100644
--- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
+++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
@@ -39,6 +39,7 @@ private Q_SLOTS:
void noPage();
void hierarchy();
void text();
+ void value();
};
// This will be called before the first test function is executed.
@@ -161,5 +162,43 @@ void tst_QWebEngineView::text()
QTRY_COMPARE(textInterface->cursorPosition(), 3);
}
+void tst_QWebEngineView::value()
+{
+ QWebEngineView webView;
+ webView.setHtml("<html><body>" \
+ "<div role='slider' aria-valuenow='4' aria-valuemin='1' aria-valuemax='10'></div>" \
+ "<div class='progress' role='progressbar' aria-valuenow='77' aria-valuemin='22' aria-valuemax='99'></div>" \
+ "</body></html>");
+ webView.show();
+ ::waitForSignal(&webView, SIGNAL(loadFinished(bool)));
+
+ QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView);
+ QTRY_COMPARE(view->child(0)->childCount(), 2);
+ QAccessibleInterface *document = view->child(0);
+ QCOMPARE(document->childCount(), 2);
+
+ QAccessibleInterface *slider = document->child(0);
+ QCOMPARE(slider->role(), QAccessible::Slider);
+ QCOMPARE(slider->text(QAccessible::Name), QString());
+ QCOMPARE(slider->text(QAccessible::Description), QString());
+ QCOMPARE(slider->text(QAccessible::Value), QString());
+ QAccessibleValueInterface *valueInterface = slider->valueInterface();
+ QVERIFY(valueInterface);
+ QCOMPARE(valueInterface->currentValue().toInt(), 4);
+ QCOMPARE(valueInterface->minimumValue().toInt(), 1);
+ QCOMPARE(valueInterface->maximumValue().toInt(), 10);
+
+ QAccessibleInterface *progressBar = document->child(1);
+ QCOMPARE(progressBar->role(), QAccessible::ProgressBar);
+ QCOMPARE(progressBar->text(QAccessible::Name), QString());
+ QCOMPARE(progressBar->text(QAccessible::Description), QString());
+ QCOMPARE(progressBar->text(QAccessible::Value), QString());
+ QAccessibleValueInterface *progressBarValueInterface = progressBar->valueInterface();
+ QVERIFY(progressBarValueInterface);
+ QCOMPARE(progressBarValueInterface->currentValue().toInt(), 77);
+ QCOMPARE(progressBarValueInterface->minimumValue().toInt(), 22);
+ QCOMPARE(progressBarValueInterface->maximumValue().toInt(), 99);
+}
+
QTEST_MAIN(tst_QWebEngineView)
#include "tst_qwebengineaccessibility.moc"