Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, | - |
6 | int *startOffset, int *endOffset) const | - |
7 | { | - |
8 | const QString txt = text(0, characterCount()); | - |
9 | | - |
10 | if (txt.isEmpty() || offset < 0 || offset > txt.length()) { partially evaluated: txt.isEmpty() no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: offset < 0 no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: offset > txt.length() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
11 | *startOffset = *endOffset = -1; | - |
12 | return QString(); never executed: return QString(); | 0 |
13 | } | - |
14 | if (offset == 0) { evaluated: offset == 0 yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
15 | *startOffset = *endOffset = offset; | - |
16 | return QString(); executed: return QString(); Execution Count:1 | 1 |
17 | } | - |
18 | | - |
19 | QTextBoundaryFinder::BoundaryType type; | - |
20 | switch (boundaryType) { | - |
21 | case QAccessible2::CharBoundary: | - |
22 | type = QTextBoundaryFinder::Grapheme; | - |
23 | break; executed: break; Execution Count:1 | 1 |
24 | case QAccessible2::WordBoundary: | - |
25 | type = QTextBoundaryFinder::Word; | - |
26 | break; executed: break; Execution Count:1 | 1 |
27 | case QAccessible2::SentenceBoundary: | - |
28 | type = QTextBoundaryFinder::Sentence; | - |
29 | break; executed: break; Execution Count:1 | 1 |
30 | default: | - |
31 | | - |
32 | *startOffset = 0; | - |
33 | *endOffset = txt.length(); | - |
34 | return txt; never executed: return txt; | 0 |
35 | } | - |
36 | | - |
37 | | - |
38 | | - |
39 | QTextBoundaryFinder boundary(type, txt); | - |
40 | boundary.setPosition(offset); | - |
41 | | - |
42 | do { | - |
43 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
44 | break; executed: break; Execution Count:3 | 3 |
45 | } while (boundary.toPreviousBoundary() > 0); partially evaluated: boundary.toPreviousBoundary() > 0 yes Evaluation Count:2 | no Evaluation Count:0 |
executed: } Execution Count:2 | 0-2 |
46 | qt_noop(); | - |
47 | *endOffset = boundary.position(); | - |
48 | | - |
49 | while (boundary.toPreviousBoundary() > 0) { evaluated: boundary.toPreviousBoundary() > 0 yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
50 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) partially evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
51 | break; executed: break; Execution Count:2 | 2 |
52 | } | 0 |
53 | qt_noop(); | - |
54 | *startOffset = boundary.position(); | - |
55 | | - |
56 | return txt.mid(*startOffset, *endOffset - *startOffset); executed: return txt.mid(*startOffset, *endOffset - *startOffset); Execution Count:3 | 3 |
57 | } | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, | - |
66 | int *startOffset, int *endOffset) const | - |
67 | { | - |
68 | const QString txt = text(0, characterCount()); | - |
69 | | - |
70 | if (txt.isEmpty() || offset < 0 || offset > txt.length()) { partially evaluated: txt.isEmpty() no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: offset < 0 no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: offset > txt.length() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
71 | *startOffset = *endOffset = -1; | - |
72 | return QString(); never executed: return QString(); | 0 |
73 | } | - |
74 | if (offset == txt.length()) { partially evaluated: offset == txt.length() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
75 | *startOffset = *endOffset = offset; | - |
76 | return QString(); never executed: return QString(); | 0 |
77 | } | - |
78 | | - |
79 | QTextBoundaryFinder::BoundaryType type; | - |
80 | switch (boundaryType) { | - |
81 | case QAccessible2::CharBoundary: | - |
82 | type = QTextBoundaryFinder::Grapheme; | - |
83 | break; executed: break; Execution Count:2 | 2 |
84 | case QAccessible2::WordBoundary: | - |
85 | type = QTextBoundaryFinder::Word; | - |
86 | break; executed: break; Execution Count:1 | 1 |
87 | case QAccessible2::SentenceBoundary: | - |
88 | type = QTextBoundaryFinder::Sentence; | - |
89 | break; executed: break; Execution Count:1 | 1 |
90 | default: | - |
91 | | - |
92 | *startOffset = 0; | - |
93 | *endOffset = txt.length(); | - |
94 | return txt; never executed: return txt; | 0 |
95 | } | - |
96 | | - |
97 | | - |
98 | | - |
99 | QTextBoundaryFinder boundary(type, txt); | - |
100 | boundary.setPosition(offset); | - |
101 | | - |
102 | while (boundary.toNextBoundary() < txt.length()) { partially evaluated: boundary.toNextBoundary() < txt.length() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
103 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) partially evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
104 | break; executed: break; Execution Count:4 | 4 |
105 | } | 0 |
106 | qt_noop(); | - |
107 | *startOffset = boundary.position(); | - |
108 | | - |
109 | while (boundary.toNextBoundary() < txt.length()) { partially evaluated: boundary.toNextBoundary() < txt.length() yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
110 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) partially evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
111 | break; executed: break; Execution Count:4 | 4 |
112 | } | 0 |
113 | qt_noop(); | - |
114 | *endOffset = boundary.position(); | - |
115 | | - |
116 | return txt.mid(*startOffset, *endOffset - *startOffset); executed: return txt.mid(*startOffset, *endOffset - *startOffset); Execution Count:4 | 4 |
117 | } | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, | - |
126 | int *startOffset, int *endOffset) const | - |
127 | { | - |
128 | const QString txt = text(0, characterCount()); | - |
129 | | - |
130 | if (txt.isEmpty() || offset < 0 || offset > txt.length()) { partially evaluated: txt.isEmpty() no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: offset < 0 no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: offset > txt.length() no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
131 | *startOffset = *endOffset = -1; | - |
132 | return QString(); never executed: return QString(); | 0 |
133 | } | - |
134 | if (offset == txt.length()) { partially evaluated: offset == txt.length() no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
135 | *startOffset = *endOffset = offset; | - |
136 | return QString(); never executed: return QString(); | 0 |
137 | } | - |
138 | | - |
139 | QTextBoundaryFinder::BoundaryType type; | - |
140 | switch (boundaryType) { | - |
141 | case QAccessible2::CharBoundary: | - |
142 | type = QTextBoundaryFinder::Grapheme; | - |
143 | break; executed: break; Execution Count:2 | 2 |
144 | case QAccessible2::WordBoundary: | - |
145 | type = QTextBoundaryFinder::Word; | - |
146 | break; executed: break; Execution Count:7 | 7 |
147 | case QAccessible2::SentenceBoundary: | - |
148 | type = QTextBoundaryFinder::Sentence; | - |
149 | break; executed: break; Execution Count:1 | 1 |
150 | default: | - |
151 | | - |
152 | *startOffset = 0; | - |
153 | *endOffset = txt.length(); | - |
154 | return txt; executed: return txt; Execution Count:3 | 3 |
155 | } | - |
156 | | - |
157 | | - |
158 | | - |
159 | QTextBoundaryFinder boundary(type, txt); | - |
160 | boundary.setPosition(offset); | - |
161 | | - |
162 | do { | - |
163 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:9 | yes Evaluation Count:6 |
| 6-9 |
164 | break; executed: break; Execution Count:9 | 9 |
165 | } while (boundary.toPreviousBoundary() > 0); executed: } Execution Count:6 evaluated: boundary.toPreviousBoundary() > 0 yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-6 |
166 | qt_noop(); | - |
167 | *startOffset = boundary.position(); | - |
168 | | - |
169 | while (boundary.toNextBoundary() < txt.length()) { partially evaluated: boundary.toNextBoundary() < txt.length() yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
170 | if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) evaluated: (boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem)) yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
171 | break; executed: break; Execution Count:10 | 10 |
172 | } executed: } Execution Count:3 | 3 |
173 | qt_noop(); | - |
174 | *endOffset = boundary.position(); | - |
175 | | - |
176 | return txt.mid(*startOffset, *endOffset - *startOffset); executed: return txt.mid(*startOffset, *endOffset - *startOffset); Execution Count:10 | 10 |
177 | } | - |
178 | struct QAccessibleActionStrings | - |
179 | { | - |
180 | QAccessibleActionStrings() : | - |
181 | pressAction(QString::fromUtf8("" "Press" "", sizeof("Press") - 1)), | - |
182 | increaseAction(QString::fromUtf8("" "Increase" "", sizeof("Increase") - 1)), | - |
183 | decreaseAction(QString::fromUtf8("" "Decrease" "", sizeof("Decrease") - 1)), | - |
184 | showMenuAction(QString::fromUtf8("" "ShowMenu" "", sizeof("ShowMenu") - 1)), | - |
185 | setFocusAction(QString::fromUtf8("" "SetFocus" "", sizeof("SetFocus") - 1)), | - |
186 | toggleAction(QString::fromUtf8("" "Toggle" "", sizeof("Toggle") - 1)) {} executed: } Execution Count:1 | 1 |
187 | | - |
188 | const QString pressAction; | - |
189 | const QString increaseAction; | - |
190 | const QString decreaseAction; | - |
191 | const QString showMenuAction; | - |
192 | const QString setFocusAction; | - |
193 | const QString toggleAction; | - |
194 | }; | - |
195 | | - |
196 | static QAccessibleActionStrings *accessibleActionStrings() { static QGlobalStatic<QAccessibleActionStrings > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QAccessibleActionStrings *x = new QAccessibleActionStrings; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QAccessibleActionStrings > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load(); Execution Count:108 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x) no Evaluation Count:0 | yes Evaluation Count:1 |
evaluated: !thisGlobalStatic.pointer.load() yes Evaluation Count:1 | yes Evaluation Count:107 |
partially evaluated: !thisGlobalStatic.destroyed yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-108 |
197 | | - |
198 | QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const | - |
199 | { | - |
200 | return QAccessibleActionInterface::tr(QString(actionName).toLocal8Bit().constData()); never executed: return QAccessibleActionInterface::tr(QString(actionName).toLocal8Bit().constData()); | 0 |
201 | } | - |
202 | | - |
203 | QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const | - |
204 | { | - |
205 | const QAccessibleActionStrings *strings = accessibleActionStrings(); | - |
206 | if (actionName == strings->pressAction) partially evaluated: actionName == strings->pressAction no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
207 | return tr("Triggers the action"); never executed: return tr("Triggers the action"); | 0 |
208 | else if (actionName == strings->increaseAction) partially evaluated: actionName == strings->increaseAction no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
209 | return tr("Increase the value"); never executed: return tr("Increase the value"); | 0 |
210 | else if (actionName == strings->decreaseAction) partially evaluated: actionName == strings->decreaseAction no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
211 | return tr("Decrease the value"); never executed: return tr("Decrease the value"); | 0 |
212 | else if (actionName == strings->showMenuAction) partially evaluated: actionName == strings->showMenuAction no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
213 | return tr("Shows the menu"); never executed: return tr("Shows the menu"); | 0 |
214 | else if (actionName == strings->setFocusAction) partially evaluated: actionName == strings->setFocusAction no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
215 | return tr("Sets the focus"); never executed: return tr("Sets the focus"); | 0 |
216 | else if (actionName == strings->toggleAction) partially evaluated: actionName == strings->toggleAction yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
217 | return tr("Toggles the state"); executed: return tr("Toggles the state"); Execution Count:1 | 1 |
218 | | - |
219 | return QString(); never executed: return QString(); | 0 |
220 | } | - |
221 | | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | const QString &QAccessibleActionInterface::pressAction() | - |
227 | { | - |
228 | return accessibleActionStrings()->pressAction; executed: return accessibleActionStrings()->pressAction; Execution Count:32 | 32 |
229 | } | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | const QString &QAccessibleActionInterface::increaseAction() | - |
236 | { | - |
237 | return accessibleActionStrings()->increaseAction; never executed: return accessibleActionStrings()->increaseAction; | 0 |
238 | } | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | const QString &QAccessibleActionInterface::decreaseAction() | - |
245 | { | - |
246 | return accessibleActionStrings()->decreaseAction; never executed: return accessibleActionStrings()->decreaseAction; | 0 |
247 | } | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | const QString &QAccessibleActionInterface::showMenuAction() | - |
254 | { | - |
255 | return accessibleActionStrings()->showMenuAction; executed: return accessibleActionStrings()->showMenuAction; Execution Count:28 | 28 |
256 | } | - |
257 | | - |
258 | | - |
259 | | - |
260 | | - |
261 | | - |
262 | const QString &QAccessibleActionInterface::setFocusAction() | - |
263 | { | - |
264 | return accessibleActionStrings()->setFocusAction; executed: return accessibleActionStrings()->setFocusAction; Execution Count:23 | 23 |
265 | } | - |
266 | | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | const QString &QAccessibleActionInterface::toggleAction() | - |
272 | { | - |
273 | return accessibleActionStrings()->toggleAction; executed: return accessibleActionStrings()->toggleAction; Execution Count:24 | 24 |
274 | } | - |
275 | | - |
276 | | - |
277 | | - |
| | |