aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-20 12:41:55 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-21 15:33:51 +0000
commitbc546e14688c7056ac36b6f478fde852b5afaf46 (patch)
tree75cf4ed7146a362b11a9531d5314f03d738a3a96 /tests
parent8e1df766cf9e74661b50de4f4ed489af5b4edfc8 (diff)
QQuickControl: dynamically create a11y attached object
Using QAccessible::ActivationObserver approach. Change-Id: Ib99c1f9b7b0c37a3e8a4747db265c9df77acc1f8 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/accessibility/data/textarea-2.qml13
-rw-r--r--tests/auto/accessibility/data/textarea.qml1
-rw-r--r--tests/auto/accessibility/data/textfield-2.qml13
-rw-r--r--tests/auto/accessibility/data/textfield.qml1
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp15
5 files changed, 10 insertions, 33 deletions
diff --git a/tests/auto/accessibility/data/textarea-2.qml b/tests/auto/accessibility/data/textarea-2.qml
deleted file mode 100644
index 31330fa8..00000000
--- a/tests/auto/accessibility/data/textarea-2.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import QtQuick 2.5
-import QtQuick.Window 2.2
-import Qt.labs.controls 1.0
-
-Window {
- visible: true
-
- TextArea {
- id: textarea
- objectName: "textarea"
- text: "TextArea"
- }
-}
diff --git a/tests/auto/accessibility/data/textarea.qml b/tests/auto/accessibility/data/textarea.qml
index 2108a5bf..31330fa8 100644
--- a/tests/auto/accessibility/data/textarea.qml
+++ b/tests/auto/accessibility/data/textarea.qml
@@ -9,6 +9,5 @@ Window {
id: textarea
objectName: "textarea"
text: "TextArea"
- Accessible.name: text
}
}
diff --git a/tests/auto/accessibility/data/textfield-2.qml b/tests/auto/accessibility/data/textfield-2.qml
deleted file mode 100644
index 29c7b62b..00000000
--- a/tests/auto/accessibility/data/textfield-2.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import QtQuick 2.5
-import QtQuick.Window 2.2
-import Qt.labs.controls 1.0
-
-Window {
- visible: true
-
- TextField {
- id: textfield
- objectName: "textfield"
- text: "TextField"
- }
-}
diff --git a/tests/auto/accessibility/data/textfield.qml b/tests/auto/accessibility/data/textfield.qml
index d25b325b..29c7b62b 100644
--- a/tests/auto/accessibility/data/textfield.qml
+++ b/tests/auto/accessibility/data/textfield.qml
@@ -9,6 +9,5 @@ Window {
id: textfield
objectName: "textfield"
text: "TextField"
- Accessible.name: text
}
}
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 7baec700..873a86c1 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -86,8 +86,8 @@ void tst_accessibility::a11y_data()
QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button
QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList
QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab
- QTest::newRow("TextArea") << "textarea" << 0x0000002A << "TextArea"; //QAccessible::Accessible.EditableText
- QTest::newRow("TextField") << "textfield" << 0x0000002A << "TextField"; //QAccessible::Accessible.EditableText
+ QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
+ QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar
QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button
@@ -110,9 +110,7 @@ void tst_accessibility::a11y()
QQmlComponent component(&engine);
QString fn = name;
#ifdef QT_NO_ACCESSIBILITY
- if (name == QLatin1Literal("textarea")
- || name == QLatin1Literal("textfield")
- || name == QLatin1Literal("dayofweekrow")
+ if (name == QLatin1Literal("dayofweekrow")
|| name == QLatin1Literal("monthgrid")
|| name == QLatin1Literal("weeknumbercolumn"))
fn += QLatin1Literal("-2");
@@ -133,6 +131,13 @@ void tst_accessibility::a11y()
#ifndef QT_NO_ACCESSIBILITY
QQuickAccessibleAttached *acc = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false));
+ if (name != QLatin1Literal("dayofweekrow")
+ && name != QLatin1Literal("monthgrid")
+ && name != QLatin1Literal("weeknumbercolumn")) {
+ QVERIFY(!acc);
+ QAccessible::setActive(true);
+ acc = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(item, false));
+ }
QVERIFY(acc);
QCOMPARE(acc->role(), (QAccessible::Role)role);
QCOMPARE(acc->name(), text);