From 51ac037c2082a4f6681eda07795869f4c14488e1 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 15 Jul 2014 11:03:37 +0200 Subject: Implement accessible value interface Change-Id: I837d7f3041aec59ae83c0fe802bc83b746e62b76 Reviewed-by: Andras Becsi --- .../tst_qwebengineaccessibility.cpp | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests/auto/widgets/qwebengineaccessibility') diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp index 9bf4c69e2..8d98b06e0 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("" \ + "
" \ + "
" \ + ""); + 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" -- cgit v1.2.3