Merge lp:~gerboland/unity-2d/hud-a11y-fix into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 955
Merged at revision: 1006
Proposed branch: lp:~gerboland/unity-2d/hud-a11y-fix
Merge into: lp:unity-2d
Diff against target: 79 lines (+17/-1)
4 files modified
libunity-2d-private/src/hud.cpp (+7/-0)
libunity-2d-private/src/hud.h (+1/-0)
shell/hud/ResultItem.qml (+1/-1)
tests/manual-tests/hud.txt (+8/-0)
To merge this branch: bzr merge lp:~gerboland/unity-2d/hud-a11y-fix
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
Paweł Stołowski Pending
Review via email: mp+98395@code.launchpad.net

Commit message

[hud] [a11y] completionText not supplied by HUD for A11Y, so need to convert resultText html to plain text and use that as A11Y string

Description of the change

[hud] [a11y] completionText not supplied by HUD for A11Y, so need to convert resultText html to plain text and use that as A11Y string

Manual test added as infrastructure for Automated testing of A11Y has yet to be assembled.

To post a comment you must log in.
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

works great.
Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/hud.cpp'
2--- libunity-2d-private/src/hud.cpp 2012-02-20 09:12:49 +0000
3+++ libunity-2d-private/src/hud.cpp 2012-03-20 11:18:20 +0000
4@@ -28,6 +28,7 @@
5
6 // Qt
7 #include <QDateTime>
8+#include <QTextDocument>
9
10 static const char* HUD_DBUS_SERVICE = "com.canonical.hud";
11 static const char* HUD_DBUS_PATH = "/com/canonical/hud";
12@@ -39,6 +40,7 @@
13 QHash<int, QByteArray> names;
14 names[ResultIdRole] = "resultId";
15 names[FormattedTextRole] = "formattedText";
16+ names[PlainTextRole] = "plainText";
17 names[IconNameRole] = "iconName";
18 names[ItemIconRole] = "itemIcon";
19 names[CompletionTextRole] = "completionText";
20@@ -71,6 +73,7 @@
21 if (!index.isValid() || m_searchQuery.isEmpty()) {
22 return QVariant();
23 }
24+ QTextDocument formattedText;
25
26 std::shared_ptr<unity::hud::Query> result;
27
28@@ -86,6 +89,10 @@
29 return index.row();
30 case Hud::FormattedTextRole:
31 return QString::fromStdString(result->formatted_text);
32+ /* Work around the fact that HUD does not return plain text results for a11y */
33+ case Hud::PlainTextRole:
34+ formattedText.setHtml(QString::fromStdString(result->formatted_text));
35+ return formattedText.toPlainText();
36 case Hud::IconNameRole:
37 return QString::fromStdString(result->icon_name);
38 case Hud::ItemIconRole:
39
40=== modified file 'libunity-2d-private/src/hud.h'
41--- libunity-2d-private/src/hud.h 2012-02-15 18:48:53 +0000
42+++ libunity-2d-private/src/hud.h 2012-03-20 11:18:20 +0000
43@@ -41,6 +41,7 @@
44 enum Roles {
45 ResultIdRole = Qt::UserRole+1,
46 FormattedTextRole,
47+ PlainTextRole,
48 IconNameRole,
49 ItemIconRole,
50 CompletionTextRole,
51
52=== modified file 'shell/hud/ResultItem.qml'
53--- shell/hud/ResultItem.qml 2012-02-16 11:41:43 +0000
54+++ shell/hud/ResultItem.qml 2012-03-20 11:18:20 +0000
55@@ -23,7 +23,7 @@
56 id: delegate
57 property string icon: ""
58
59- Accessible.name: completionText
60+ Accessible.name: plainText
61 Accessible.role: Accessible.Button
62
63 Rectangle {
64
65=== modified file 'tests/manual-tests/hud.txt'
66--- tests/manual-tests/hud.txt 2012-02-17 15:18:47 +0000
67+++ tests/manual-tests/hud.txt 2012-03-20 11:18:20 +0000
68@@ -7,3 +7,11 @@
69 --> check tile is updated to reflect the app/indicator listed
70 --> click on one and ensure the action is performed
71 --> Check HUD closes
72+
73+----
74+ * Enable Accessibility and Orca speech output
75+ * Tap Alt key
76+ * Enter a few characters
77+ * Use arrow keys to navigate up/down through the options returned
78+
79+--> Check Orca speaks the contents of the results

Subscribers

People subscribed via source and target branches