qtextboundaryfinder.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qtextboundaryfinder.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5class QTextBoundaryFinderPrivate-
6{-
7public:-
8 QCharAttributes attributes[1];-
9};-
10-
11static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int length, QCharAttributes *attributes)-
12{-
13 const ushort *string = reinterpret_cast<const ushort *>(chars);-
14-
15 QVarLengthArray<QUnicodeTools::ScriptItem> scriptItems;-
16 {-
17 QVarLengthArray<uchar> scripts(length);-
18-
19 QUnicodeTools::initScripts(string, length, scripts.data());-
20-
21 int start = 0;-
22 for (int i = start + 1; i <= length
i <= lengthDescription
TRUEevaluated 160347 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 8846 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
; ++i) {
8846-160347
23 if (i == length
i == lengthDescription
TRUEevaluated 8846 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 151501 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
|| scripts[i] != scripts[start]
scripts[i] != scripts[start]Description
TRUEevaluated 373 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 151128 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
) {
373-151501
24 QUnicodeTools::ScriptItem item;-
25 item.position = start;-
26 item.script = scripts[start];-
27 scriptItems.append(item);-
28 start = i;-
29 }
executed 9219 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
9219
30 }
executed 160347 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
160347
31 }-
32-
33 QUnicodeTools::CharAttributeOptions options = 0;-
34 switch (type) {-
35 case
executed 434 times by 2 tests: case QTextBoundaryFinder::Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
QTextBoundaryFinder::Grapheme:
executed 434 times by 2 tests: case QTextBoundaryFinder::Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
options |= QUnicodeTools::GraphemeBreaks; break;
executed 434 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
434
36 case
executed 1553 times by 3 tests: case QTextBoundaryFinder::Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
QTextBoundaryFinder::Word:
executed 1553 times by 3 tests: case QTextBoundaryFinder::Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
options |= QUnicodeTools::WordBreaks; break;
executed 1553 times by 3 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
1553
37 case
executed 521 times by 2 tests: case QTextBoundaryFinder::Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
QTextBoundaryFinder::Sentence:
executed 521 times by 2 tests: case QTextBoundaryFinder::Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
options |= QUnicodeTools::SentenceBreaks; break;
executed 521 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
521
38 case
executed 6338 times by 1 test: case QTextBoundaryFinder::Line:
Executed by:
  • tst_QTextBoundaryFinder
QTextBoundaryFinder::Line:
executed 6338 times by 1 test: case QTextBoundaryFinder::Line:
Executed by:
  • tst_QTextBoundaryFinder
options |= QUnicodeTools::LineBreaks; break;
executed 6338 times by 1 test: break;
Executed by:
  • tst_QTextBoundaryFinder
6338
39 default
never executed: default:
:
never executed: default:
break;
never executed: break;
0
40 }-
41 QUnicodeTools::initCharAttributes(string, length, scriptItems.data(), scriptItems.count(), attributes, options);-
42}
executed 8846 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
8846
43QTextBoundaryFinder::QTextBoundaryFinder()-
44 : t(Grapheme)-
45 , chars(0)-
46 , length(0)-
47 , freePrivate(true)-
48 , d(0)-
49{-
50}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
1
51-
52-
53-
54-
55QTextBoundaryFinder::QTextBoundaryFinder(const QTextBoundaryFinder &other)-
56 : t(other.t)-
57 , s(other.s)-
58 , chars(other.chars)-
59 , length(other.length)-
60 , pos(other.pos)-
61 , freePrivate(true)-
62 , d(0)-
63{-
64 if (other.d
other.dDescription
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
0-15
65 ((!(length > 0)) ? qt_assert("length > 0",__FILE__,184) : qt_noop());-
66 d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes));-
67 do { if (!(d)
!(d)Description
TRUEnever evaluated
FALSEnever evaluated
) qBadAlloc();
never executed: qBadAlloc();
} while (0);
0
68 memcpy(d, other.d, (length + 1) * sizeof(QCharAttributes));-
69 }
never executed: end of block
0
70}
executed 15 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
15
71-
72-
73-
74-
75QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &other)-
76{-
77 if (&other == this
&other == thisDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
0-4
78 return
never executed: return *this;
*this;
never executed: return *this;
0
79-
80 if (other.d
other.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
2
81 ((!(other.length > 0)) ? qt_assert("other.length > 0",__FILE__,200) : qt_noop());-
82 uint newCapacity = (other.length + 1) * sizeof(QCharAttributes);-
83 QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) realloc(freePrivate ? d : 0, newCapacity);-
84 do { if (!(newD)
!(newD)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) qBadAlloc();
never executed: qBadAlloc();
} while (0);
0-2
85 freePrivate = true;-
86 d = newD;-
87 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
2
88-
89 t = other.t;-
90 s = other.s;-
91 chars = other.chars;-
92 length = other.length;-
93 pos = other.pos;-
94-
95 if (other.d
other.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
2
96 memcpy(d, other.d, (length + 1) * sizeof(QCharAttributes));-
97 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
else {
2
98 if (freePrivate
freePrivateDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEnever evaluated
)
0-2
99 free(d);
executed 2 times by 1 test: free(d);
Executed by:
  • tst_QTextBoundaryFinder
2
100 d = 0;-
101 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
2
102-
103 return
executed 4 times by 1 test: return *this;
Executed by:
  • tst_QTextBoundaryFinder
*this;
executed 4 times by 1 test: return *this;
Executed by:
  • tst_QTextBoundaryFinder
4
104}-
105-
106-
107-
108-
109QTextBoundaryFinder::~QTextBoundaryFinder()-
110{-
111 (void)unused;;-
112 if (freePrivate
freePrivateDescription
TRUEevaluated 8867 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEnever evaluated
)
0-8867
113 free(d);
executed 8867 times by 3 tests: free(d);
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
8867
114}
executed 8867 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
8867
115-
116-
117-
118-
119QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QString &string)-
120 : t(type)-
121 , s(string)-
122 , chars(string.unicode())-
123 , length(string.length())-
124 , pos(0)-
125 , freePrivate(true)-
126 , d(0)-
127{-
128 if (length > 0
length > 0Description
TRUEevaluated 8843 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
1-8843
129 d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes));-
130 do { if (!(d)
!(d)Description
TRUEnever evaluated
FALSEevaluated 8843 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
) qBadAlloc();
never executed: qBadAlloc();
} while (0);
0-8843
131 init(t, chars, length, d->attributes);-
132 }
executed 8843 times by 2 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
8843
133}
executed 8844 times by 2 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
8844
134QTextBoundaryFinder::QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer, int bufferSize)-
135 : t(type)-
136 , chars(chars)-
137 , length(length)-
138 , pos(0)-
139 , freePrivate(true)-
140 , d(0)-
141{-
142 if (!chars
!charsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
) {
2-5
143 length = 0;-
144 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
else if (length > 0
length > 0Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
2-3
145 if (buffer
bufferDescription
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
&& (
(uint)bufferSi...harAttributes)Description
TRUEnever evaluated
FALSEnever evaluated
uint)bufferSize >= (length + 1) * sizeof(QCharAttributes)
(uint)bufferSi...harAttributes)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0-3
146 d = (QTextBoundaryFinderPrivate *)buffer;-
147 freePrivate = false;-
148 }
never executed: end of block
else {
0
149 d = (QTextBoundaryFinderPrivate *) malloc((length + 1) * sizeof(QCharAttributes));-
150 do { if (!(d)
!(d)Description
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
) qBadAlloc();
never executed: qBadAlloc();
} while (0);
0-3
151 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
3
152 init(t, chars, length, d->attributes);-
153 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
3
154}
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
7
155-
156-
157-
158-
159-
160-
161void QTextBoundaryFinder::toStart()-
162{-
163 pos = 0;-
164}
never executed: end of block
0
165-
166-
167-
168-
169-
170-
171void QTextBoundaryFinder::toEnd()-
172{-
173 pos = length;-
174}
executed 8797 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
8797
175int QTextBoundaryFinder::position() const-
176{-
177 return
executed 195130 times by 3 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
pos;
executed 195130 times by 3 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
195130
178}-
179void QTextBoundaryFinder::setPosition(int position)-
180{-
181 pos = qBound(0, position, length);-
182}
executed 39074 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
39074
183QString QTextBoundaryFinder::string() const-
184{-
185 if (chars == s.unicode()
chars == s.unicode()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
&& length == s.length()
length == s.length()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEnever evaluated
)
0-2
186 return
executed 2 times by 1 test: return s;
Executed by:
  • tst_QTextBoundaryFinder
s;
executed 2 times by 1 test: return s;
Executed by:
  • tst_QTextBoundaryFinder
2
187 return
executed 2 times by 1 test: return QString(chars, length);
Executed by:
  • tst_QTextBoundaryFinder
QString(chars, length);
executed 2 times by 1 test: return QString(chars, length);
Executed by:
  • tst_QTextBoundaryFinder
2
188}-
189-
190-
191-
192-
193-
194-
195-
196int QTextBoundaryFinder::toNextBoundary()-
197{-
198 if (!d
!dDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 24931 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
|| pos < 0
pos < 0Description
TRUEnever evaluated
FALSEevaluated 24931 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
|| pos >= length
pos >= lengthDescription
TRUEevaluated 8800 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 16131 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
) {
0-24931
199 pos = -1;-
200 return
executed 8807 times by 2 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
pos;
executed 8807 times by 2 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
8807
201 }-
202-
203 ++pos;-
204 switch(t) {-
205 case
executed 826 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Grapheme:
executed 826 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
826
206 while (pos < length
pos < lengthDescription
TRUEevaluated 713 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 408 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].graphemeBoundary
!d->attributes...aphemeBoundaryDescription
TRUEevaluated 295 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 418 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
295-713
207 ++
executed 295 times by 1 test: ++pos;
Executed by:
  • tst_QTextBoundaryFinder
pos;
executed 295 times by 1 test: ++pos;
Executed by:
  • tst_QTextBoundaryFinder
295
208 break;
executed 826 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
826
209 case
executed 4027 times by 3 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
Word:
executed 4027 times by 3 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
4027
210 while (pos < length
pos < lengthDescription
TRUEevaluated 132701 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 1543 times by 2 tests
Evaluated by:
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
&& !d->attributes[pos].wordBreak
!d->attributes[pos].wordBreakDescription
TRUEevaluated 130217 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 2484 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
)
1543-132701
211 ++
executed 130217 times by 3 tests: ++pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
pos;
executed 130217 times by 3 tests: ++pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
130217
212 break;
executed 4027 times by 3 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
4027
213 case
executed 663 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Sentence:
executed 663 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
663
214 while (pos < length
pos < lengthDescription
TRUEevaluated 1585 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 518 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].sentenceBoundary
!d->attributes...ntenceBoundaryDescription
TRUEevaluated 1440 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 145 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
145-1585
215 ++
executed 1440 times by 2 tests: ++pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
pos;
executed 1440 times by 2 tests: ++pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
1440
216 break;
executed 663 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
663
217 case
executed 10615 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
Line:
executed 10615 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
10615
218 while (pos < length
pos < lengthDescription
TRUEevaluated 14608 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 6337 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].lineBreak
!d->attributes[pos].lineBreakDescription
TRUEevaluated 10330 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 4278 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
4278-14608
219 ++
executed 10330 times by 1 test: ++pos;
Executed by:
  • tst_QTextBoundaryFinder
pos;
executed 10330 times by 1 test: ++pos;
Executed by:
  • tst_QTextBoundaryFinder
10330
220 break;
executed 10615 times by 1 test: break;
Executed by:
  • tst_QTextBoundaryFinder
10615
221 }-
222-
223 return
executed 16131 times by 3 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
pos;
executed 16131 times by 3 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
16131
224}-
225-
226-
227-
228-
229-
230-
231int QTextBoundaryFinder::toPreviousBoundary()-
232{-
233 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 24899 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
|| pos <= 0
pos <= 0Description
TRUEevaluated 8797 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 16102 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
|| pos > length
pos > lengthDescription
TRUEnever evaluated
FALSEevaluated 16102 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
) {
0-24899
234 pos = -1;-
235 return
executed 8797 times by 1 test: return pos;
Executed by:
  • tst_QTextBoundaryFinder
pos;
executed 8797 times by 1 test: return pos;
Executed by:
  • tst_QTextBoundaryFinder
8797
236 }-
237-
238 --pos;-
239 switch(t) {-
240 case
executed 809 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Grapheme:
executed 809 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
809
241 while (pos > 0
pos > 0Description
TRUEevaluated 700 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 404 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].graphemeBoundary
!d->attributes...aphemeBoundaryDescription
TRUEevaluated 295 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 405 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
295-700
242 --
executed 295 times by 1 test: --pos;
Executed by:
  • tst_QTextBoundaryFinder
pos;
executed 295 times by 1 test: --pos;
Executed by:
  • tst_QTextBoundaryFinder
295
243 break;
executed 809 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
809
244 case
executed 4015 times by 2 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Word:
executed 4015 times by 2 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
4015
245 while (pos > 0
pos > 0Description
TRUEevaluated 4659 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 1540 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].wordBreak
!d->attributes[pos].wordBreakDescription
TRUEevaluated 2184 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 2475 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
1540-4659
246 --
executed 2184 times by 2 tests: --pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
pos;
executed 2184 times by 2 tests: --pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
2184
247 break;
executed 4015 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
4015
248 case
executed 663 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Sentence:
executed 663 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
663
249 while (pos > 0
pos > 0Description
TRUEevaluated 1537 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 520 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].sentenceBoundary
!d->attributes...ntenceBoundaryDescription
TRUEevaluated 1394 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 143 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
143-1537
250 --
executed 1394 times by 2 tests: --pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
pos;
executed 1394 times by 2 tests: --pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
1394
251 break;
executed 663 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
663
252 case
executed 10615 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
Line:
executed 10615 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
10615
253 while (pos > 0
pos > 0Description
TRUEevaluated 14608 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 6337 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
&& !d->attributes[pos].lineBreak
!d->attributes[pos].lineBreakDescription
TRUEevaluated 10330 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 4278 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
4278-14608
254 --
executed 10330 times by 1 test: --pos;
Executed by:
  • tst_QTextBoundaryFinder
pos;
executed 10330 times by 1 test: --pos;
Executed by:
  • tst_QTextBoundaryFinder
10330
255 break;
executed 10615 times by 1 test: break;
Executed by:
  • tst_QTextBoundaryFinder
10615
256 }-
257-
258 return
executed 16102 times by 2 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
pos;
executed 16102 times by 2 tests: return pos;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
16102
259}-
260-
261-
262-
263-
264bool QTextBoundaryFinder::isAtBoundary() const-
265{-
266 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 67350 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
|| pos < 0
pos < 0Description
TRUEevaluated 17594 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 49756 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
|| pos > length
pos > lengthDescription
TRUEnever evaluated
FALSEevaluated 49756 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
0-67350
267 return
executed 17594 times by 1 test: return false;
Executed by:
  • tst_QTextBoundaryFinder
false;
executed 17594 times by 1 test: return false;
Executed by:
  • tst_QTextBoundaryFinder
17594
268-
269 switch(t) {-
270 case
executed 2400 times by 1 test: case Grapheme:
Executed by:
  • tst_QTextBoundaryFinder
Grapheme:
executed 2400 times by 1 test: case Grapheme:
Executed by:
  • tst_QTextBoundaryFinder
2400
271 return
executed 2400 times by 1 test: return d->attributes[pos].graphemeBoundary;
Executed by:
  • tst_QTextBoundaryFinder
d->attributes[pos].graphemeBoundary;
executed 2400 times by 1 test: return d->attributes[pos].graphemeBoundary;
Executed by:
  • tst_QTextBoundaryFinder
2400
272 case
executed 11096 times by 1 test: case Word:
Executed by:
  • tst_QTextBoundaryFinder
Word:
executed 11096 times by 1 test: case Word:
Executed by:
  • tst_QTextBoundaryFinder
11096
273 return
executed 11096 times by 1 test: return d->attributes[pos].wordBreak;
Executed by:
  • tst_QTextBoundaryFinder
d->attributes[pos].wordBreak;
executed 11096 times by 1 test: return d->attributes[pos].wordBreak;
Executed by:
  • tst_QTextBoundaryFinder
11096
274 case
executed 2356 times by 1 test: case Sentence:
Executed by:
  • tst_QTextBoundaryFinder
Sentence:
executed 2356 times by 1 test: case Sentence:
Executed by:
  • tst_QTextBoundaryFinder
2356
275 return
executed 2356 times by 1 test: return d->attributes[pos].sentenceBoundary;
Executed by:
  • tst_QTextBoundaryFinder
d->attributes[pos].sentenceBoundary;
executed 2356 times by 1 test: return d->attributes[pos].sentenceBoundary;
Executed by:
  • tst_QTextBoundaryFinder
2356
276 case
executed 33904 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
Line:
executed 33904 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
33904
277-
278 return
executed 33904 times by 1 test: return d->attributes[pos].lineBreak || pos == 0;
Executed by:
  • tst_QTextBoundaryFinder
d->attributes[pos].lineBreak || pos == 0;
executed 33904 times by 1 test: return d->attributes[pos].lineBreak || pos == 0;
Executed by:
  • tst_QTextBoundaryFinder
33904
279 }-
280 return
never executed: return false;
false;
never executed: return false;
0
281}-
282-
283-
284-
285-
286QTextBoundaryFinder::BoundaryReasons QTextBoundaryFinder::boundaryReasons() const-
287{-
288 BoundaryReasons reasons = NotAtBoundary;-
289 if (!d
!dDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 106479 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
|| pos < 0
pos < 0Description
TRUEevaluated 17597 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 88882 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
|| pos > length
pos > lengthDescription
TRUEnever evaluated
FALSEevaluated 88882 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
)
0-106479
290 return
executed 17611 times by 2 tests: return reasons;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
reasons;
executed 17611 times by 2 tests: return reasons;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
17611
291-
292 const QCharAttributes attr = d->attributes[pos];-
293 switch (t) {-
294 case
executed 3951 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Grapheme:
executed 3951 times by 2 tests: case Grapheme:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
3951
295 if (attr.graphemeBoundary
attr.graphemeBoundaryDescription
TRUEevaluated 3656 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 295 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
295-3656
296 reasons |= BreakOpportunity | StartOfItem | EndOfItem;-
297 if (pos == 0
pos == 0Description
TRUEevaluated 1209 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 2447 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
1209-2447
298 reasons &= (~EndOfItem);
executed 1209 times by 2 tests: reasons &= (~EndOfItem);
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
1209
299 else if (pos == length
pos == lengthDescription
TRUEevaluated 1214 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 1233 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
1214-1233
300 reasons &= (~StartOfItem);
executed 1214 times by 2 tests: reasons &= (~StartOfItem);
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
1214
301 }
executed 3656 times by 2 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
3656
302 break;
executed 3951 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
3951
303 case
executed 18853 times by 3 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
Word:
executed 18853 times by 3 tests: case Word:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
18853
304 if (attr.wordBreak
attr.wordBreakDescription
TRUEevaluated 16675 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 2178 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
) {
2178-16675
305 reasons |= BreakOpportunity;-
306 if (attr.wordStart
attr.wordStartDescription
TRUEevaluated 4571 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 12104 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
)
4571-12104
307 reasons |= StartOfItem;
executed 4571 times by 3 tests: reasons |= StartOfItem;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
4571
308 if (attr.wordEnd
attr.wordEndDescription
TRUEevaluated 4569 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
FALSEevaluated 12106 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
)
4569-12106
309 reasons |= EndOfItem;
executed 4569 times by 3 tests: reasons |= EndOfItem;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
4569
310 }
executed 16675 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
16675
311 break;
executed 18853 times by 3 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
18853
312 case
executed 4892 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
Sentence:
executed 4892 times by 2 tests: case Sentence:
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
4892
313 if (attr.sentenceBoundary
attr.sentenceBoundaryDescription
TRUEevaluated 3538 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
FALSEevaluated 1354 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
) {
1354-3538
314 reasons |= BreakOpportunity | StartOfItem | EndOfItem;-
315 if (pos == 0
pos == 0Description
TRUEevaluated 1554 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 1984 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
1554-1984
316 reasons &= (~EndOfItem);
executed 1554 times by 1 test: reasons &= (~EndOfItem);
Executed by:
  • tst_QTextBoundaryFinder
1554
317 else if (pos == length
pos == lengthDescription
TRUEevaluated 1554 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 430 times by 2 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
)
430-1554
318 reasons &= (~StartOfItem);
executed 1554 times by 1 test: reasons &= (~StartOfItem);
Executed by:
  • tst_QTextBoundaryFinder
1554
319 }
executed 3538 times by 2 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
3538
320 break;
executed 4892 times by 2 tests: break;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
4892
321 case
executed 61186 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
Line:
executed 61186 times by 1 test: case Line:
Executed by:
  • tst_QTextBoundaryFinder
61186
322-
323 if (attr.lineBreak
attr.lineBreakDescription
TRUEevaluated 31845 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 29341 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
|| pos == 0
pos == 0Description
TRUEevaluated 19011 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 10330 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
10330-31845
324 reasons |= BreakOpportunity;-
325 if (attr.mandatoryBreak
attr.mandatoryBreakDescription
TRUEevaluated 20952 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 29904 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
|| pos == 0
pos == 0Description
TRUEevaluated 19011 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 10893 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
10893-29904
326 reasons |= MandatoryBreak | StartOfItem | EndOfItem;-
327 if (pos == 0
pos == 0Description
TRUEevaluated 19011 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 20952 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
19011-20952
328 reasons &= (~EndOfItem);
executed 19011 times by 1 test: reasons &= (~EndOfItem);
Executed by:
  • tst_QTextBoundaryFinder
19011
329 else if (pos == length
pos == lengthDescription
TRUEevaluated 19011 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 1941 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
)
1941-19011
330 reasons &= (~StartOfItem);
executed 19011 times by 1 test: reasons &= (~StartOfItem);
Executed by:
  • tst_QTextBoundaryFinder
19011
331 }
executed 39963 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
else if (pos > 0
pos > 0Description
TRUEevaluated 10893 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEnever evaluated
&& chars[pos - 1].unicode() == QChar::SoftHyphen
chars[pos - 1]...ar::SoftHyphenDescription
TRUEevaluated 45 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
FALSEevaluated 10848 times by 1 test
Evaluated by:
  • tst_QTextBoundaryFinder
) {
0-39963
332 reasons |= SoftHyphen;-
333 }
executed 45 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
45
334 }
executed 50856 times by 1 test: end of block
Executed by:
  • tst_QTextBoundaryFinder
50856
335 break;
executed 61186 times by 1 test: break;
Executed by:
  • tst_QTextBoundaryFinder
61186
336 default
never executed: default:
:
never executed: default:
0
337 break;
never executed: break;
0
338 }-
339-
340 return
executed 88882 times by 3 tests: return reasons;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
reasons;
executed 88882 times by 3 tests: return reasons;
Executed by:
  • tst_QAccessibility
  • tst_QTextBoundaryFinder
  • tst_QTextLayout
88882
341}-
342-
343-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9