OpenCoverage

qquickstyledtext.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickstyledtext.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include <QStack>-
41#include <QVector>-
42#include <QPainter>-
43#include <QTextLayout>-
44#include <QDebug>-
45#include <qmath.h>-
46#include "qquickstyledtext_p.h"-
47#include <QQmlContext>-
48-
49/*-
50 QQuickStyledText supports few tags:-
51-
52 <b></b> - bold-
53 <strong></strong> - bold-
54 <i></i> - italic-
55 <br> - new line-
56 <p> - paragraph-
57 <u> - underlined text-
58 <font color="color_name" size="1-7"></font>-
59 <h1> to <h6> - headers-
60 <a href=""> - anchor-
61 <ol type="">, <ul type=""> and <li> - ordered and unordered lists-
62 <pre></pre> - preformated-
63 <img src=""> - images-
64-
65 The opening and closing tags must be correctly nested.-
66*/-
67-
68QT_BEGIN_NAMESPACE-
69-
70Q_GUI_EXPORT int qt_defaultDpi();-
71-
72class QQuickStyledTextPrivate-
73{-
74public:-
75 enum ListType { Ordered, Unordered };-
76 enum ListFormat { Bullet, Disc, Square, Decimal, LowerAlpha, UpperAlpha, LowerRoman, UpperRoman };-
77-
78 struct List {-
79 int level;-
80 ListType type;-
81 ListFormat format;-
82 };-
83-
84 QQuickStyledTextPrivate(const QString &t, QTextLayout &l,-
85 QList<QQuickStyledTextImgTag*> &imgTags,-
86 const QUrl &baseUrl,-
87 QQmlContext *context,-
88 bool preloadImages,-
89 bool *fontSizeModified)-
90 : text(t), layout(l), imgTags(&imgTags), baseFont(layout.font()), baseUrl(baseUrl), hasNewLine(true), nbImages(0), updateImagePositions(false)-
91 , preFormat(false), prependSpace(false), hasSpace(true), preloadImages(preloadImages), fontSizeModified(fontSizeModified), context(context)-
92 {-
93 }
executed 2146 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146
94-
95 void parse();-
96 void appendText(const QString &textIn, int start, int length, QString &textOut);-
97 bool parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format);-
98 bool parseCloseTag(const QChar *&ch, const QString &textIn, QString &textOut);-
99 void parseEntity(const QChar *&ch, const QString &textIn, QString &textOut);-
100 bool parseFontAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format);-
101 bool parseOrderedListAttributes(const QChar *&ch, const QString &textIn);-
102 bool parseUnorderedListAttributes(const QChar *&ch, const QString &textIn);-
103 bool parseAnchorAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format);-
104 void parseImageAttributes(const QChar *&ch, const QString &textIn, QString &textOut);-
105 QPair<QStringRef,QStringRef> parseAttribute(const QChar *&ch, const QString &textIn);-
106 QStringRef parseValue(const QChar *&ch, const QString &textIn);-
107 void setFontSize(int size, QTextCharFormat &format);-
108-
109 inline void skipSpace(const QChar *&ch) {-
110 while (ch->isSpace() && !ch->isNull())
ch->isSpace()Description
TRUEevaluated 1046 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6806 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
!ch->isNull()Description
TRUEevaluated 1046 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-6806
111 ++ch;
executed 1046 times by 3 tests: ++ch;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
1046
112 }
executed 6806 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
6806
113-
114 static QString toAlpha(int value, bool upper);-
115 static QString toRoman(int value, bool upper);-
116-
117 QString text;-
118 QTextLayout &layout;-
119 QList<QQuickStyledTextImgTag*> *imgTags;-
120 QFont baseFont;-
121 QStack<List> listStack;-
122 QUrl baseUrl;-
123 bool hasNewLine;-
124 int nbImages;-
125 bool updateImagePositions;-
126 bool preFormat;-
127 bool prependSpace;-
128 bool hasSpace;-
129 bool preloadImages;-
130 bool *fontSizeModified;-
131 QQmlContext *context;-
132-
133 static const QChar lessThan;-
134 static const QChar greaterThan;-
135 static const QChar equals;-
136 static const QChar singleQuote;-
137 static const QChar doubleQuote;-
138 static const QChar slash;-
139 static const QChar ampersand;-
140 static const QChar bullet;-
141 static const QChar disc;-
142 static const QChar square;-
143 static const QChar lineFeed;-
144 static const QChar space;-
145 static const int tabsize = 6;-
146};-
147-
148const QChar QQuickStyledTextPrivate::lessThan(QLatin1Char('<'));-
149const QChar QQuickStyledTextPrivate::greaterThan(QLatin1Char('>'));-
150const QChar QQuickStyledTextPrivate::equals(QLatin1Char('='));-
151const QChar QQuickStyledTextPrivate::singleQuote(QLatin1Char('\''));-
152const QChar QQuickStyledTextPrivate::doubleQuote(QLatin1Char('\"'));-
153const QChar QQuickStyledTextPrivate::slash(QLatin1Char('/'));-
154const QChar QQuickStyledTextPrivate::ampersand(QLatin1Char('&'));-
155const QChar QQuickStyledTextPrivate::bullet(0x2022);-
156const QChar QQuickStyledTextPrivate::disc(0x25e6);-
157const QChar QQuickStyledTextPrivate::square(0x25a1);-
158const QChar QQuickStyledTextPrivate::lineFeed(QLatin1Char('\n'));-
159const QChar QQuickStyledTextPrivate::space(QLatin1Char(' '));-
160-
161QQuickStyledText::QQuickStyledText(const QString &string, QTextLayout &layout,-
162 QList<QQuickStyledTextImgTag*> &imgTags,-
163 const QUrl &baseUrl,-
164 QQmlContext *context,-
165 bool preloadImages,-
166 bool *fontSizeModified)-
167 : d(new QQuickStyledTextPrivate(string, layout, imgTags, baseUrl, context, preloadImages, fontSizeModified))-
168{-
169}
executed 2146 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146
170-
171QQuickStyledText::~QQuickStyledText()-
172{-
173 delete d;-
174}
executed 2146 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146
175-
176void QQuickStyledText::parse(const QString &string, QTextLayout &layout,-
177 QList<QQuickStyledTextImgTag*> &imgTags,-
178 const QUrl &baseUrl,-
179 QQmlContext *context,-
180 bool preloadImages,-
181 bool *fontSizeModified)-
182{-
183 if (string.isEmpty())
string.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 2146 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2-2146
184 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickstyledtext
2
185 QQuickStyledText styledText(string, layout, imgTags, baseUrl, context, preloadImages, fontSizeModified);-
186 styledText.d->parse();-
187}
executed 2146 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146
188-
189void QQuickStyledTextPrivate::parse()-
190{-
191 QVector<QTextLayout::FormatRange> ranges;-
192 QStack<QTextCharFormat> formatStack;-
193-
194 QString drawText;-
195 drawText.reserve(text.count());-
196-
197 updateImagePositions = !imgTags->isEmpty();-
198-
199 int textStart = 0;-
200 int textLength = 0;-
201 int rangeStart = 0;-
202 bool formatChanged = false;-
203-
204 const QChar *ch = text.constData();-
205 while (!ch->isNull()) {
!ch->isNull()Description
TRUEevaluated 20051504 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 2146 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146-20051504
206 if (*ch == lessThan) {
*ch == lessThanDescription
TRUEevaluated 4844 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 20046660 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
4844-20046660
207 if (textLength) {
textLengthDescription
TRUEevaluated 2356 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 2488 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2356-2488
208 appendText(text, textStart, textLength, drawText);-
209 } else if (prependSpace) {
executed 2356 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
prependSpaceDescription
TRUEevaluated 1676 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 812 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
812-2356
210 drawText.append(space);-
211 prependSpace = false;-
212 hasSpace = true;-
213 }
executed 1676 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
1676
214-
215 if (rangeStart != drawText.length() && formatStack.count()) {
rangeStart != ...wText.length()Description
TRUEevaluated 4066 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 778 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
formatStack.count()Description
TRUEevaluated 2316 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 1750 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
778-4066
216 if (formatChanged) {
formatChangedDescription
TRUEevaluated 2298 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
18-2298
217 QTextLayout::FormatRange formatRange;-
218 formatRange.format = formatStack.top();-
219 formatRange.start = rangeStart;-
220 formatRange.length = drawText.length() - rangeStart;-
221 ranges.append(formatRange);-
222 formatChanged = false;-
223 } else if (ranges.count()) {
executed 2298 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
ranges.count()Description
TRUEevaluated 18 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-2298
224 ranges.last().length += drawText.length() - rangeStart;-
225 }
executed 18 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
18
226 }
executed 2316 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2316
227 rangeStart = drawText.length();-
228 ++ch;-
229 if (*ch == slash) {
*ch == slashDescription
TRUEevaluated 2220 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2624 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2220-2624
230 ++ch;-
231 if (parseCloseTag(ch, text, drawText)) {
parseCloseTag(...ext, drawText)Description
TRUEevaluated 2106 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
114-2106
232 if (formatStack.count()) {
formatStack.count()Description
TRUEevaluated 2090 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
16-2090
233 formatChanged = true;-
234 formatStack.pop();-
235 }
executed 2090 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
2090
236 }
executed 2106 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
2106
237 } else {
executed 2220 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
2220
238 QTextCharFormat format;-
239 if (formatStack.count())
formatStack.count()Description
TRUEevaluated 256 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 2368 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
256-2368
240 format = formatStack.top();
executed 256 times by 4 tests: format = formatStack.top();
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
256
241 if (parseTag(ch, text, drawText, format)) {
parseTag(ch, t...wText, format)Description
TRUEevaluated 2120 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 504 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
504-2120
242 formatChanged = true;-
243 formatStack.push(format);-
244 }
executed 2120 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2120
245 }
executed 2624 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2624
246 textStart = ch - text.constData() + 1;-
247 textLength = 0;-
248 } else if (*ch == ampersand) {
executed 4844 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
*ch == ampersandDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 20046630 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
30-20046630
249 ++ch;-
250 appendText(text, textStart, textLength, drawText);-
251 parseEntity(ch, text, drawText);-
252 textStart = ch - text.constData() + 1;-
253 textLength = 0;-
254 } else if (ch->isSpace()) {
executed 30 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
ch->isSpace()Description
TRUEevaluated 7448 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 20039182 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
30-20039182
255 if (textLength)
textLengthDescription
TRUEevaluated 6012 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 1436 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
1436-6012
256 appendText(text, textStart, textLength, drawText);
executed 6012 times by 6 tests: appendText(text, textStart, textLength, drawText);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
6012
257 if (!preFormat) {
!preFormatDescription
TRUEevaluated 7442 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
6-7442
258 prependSpace = !hasSpace;-
259 for (const QChar *n = ch + 1; !n->isNull() && n->isSpace(); ++n)
!n->isNull()Description
TRUEevaluated 20009776 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
n->isSpace()Description
TRUEevaluated 20002340 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 7436 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
6-20009776
260 ch = n;
executed 20002340 times by 3 tests: ch = n;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
20002340
261 hasNewLine = false;-
262 } else if (*ch == lineFeed) {
executed 7442 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
*ch == lineFeedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-7442
263 drawText.append(QChar(QChar::LineSeparator));-
264 hasNewLine = true;-
265 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
2
266 drawText.append(QChar(QChar::Nbsp));-
267 hasNewLine = false;-
268 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
4
269 textStart = ch - text.constData() + 1;-
270 textLength = 0;-
271 } else {
executed 7448 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
7448
272 ++textLength;-
273 }
executed 20039182 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
20039182
274 if (!ch->isNull())
!ch->isNull()Description
TRUEevaluated 20051494 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktextedit
10-20051494
275 ++ch;
executed 20051494 times by 7 tests: ++ch;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
20051494
276 }
executed 20051504 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
20051504
277 if (textLength)
textLengthDescription
TRUEevaluated 1902 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 244 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
244-1902
278 appendText(text, textStart, textLength, drawText);
executed 1902 times by 6 tests: appendText(text, textStart, textLength, drawText);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
1902
279 if (rangeStart != drawText.length() && formatStack.count()) {
rangeStart != ...wText.length()Description
TRUEevaluated 1958 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 188 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
formatStack.count()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 1938 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
20-1958
280 if (formatChanged) {
formatChangedDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-16
281 QTextLayout::FormatRange formatRange;-
282 formatRange.format = formatStack.top();-
283 formatRange.start = rangeStart;-
284 formatRange.length = drawText.length() - rangeStart;-
285 ranges.append(formatRange);-
286 } else if (ranges.count()) {
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
ranges.count()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-16
287 ranges.last().length += drawText.length() - rangeStart;-
288 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
4
289 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
20
290-
291 layout.setText(drawText);-
292 layout.setFormats(ranges);-
293}
executed 2146 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
2146
294-
295void QQuickStyledTextPrivate::appendText(const QString &textIn, int start, int length, QString &textOut)-
296{-
297 if (prependSpace)
prependSpaceDescription
TRUEevaluated 4940 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 5360 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
4940-5360
298 textOut.append(space);
executed 4940 times by 6 tests: textOut.append(space);
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
4940
299 textOut.append(QStringRef(&textIn, start, length));-
300 prependSpace = false;-
301 hasSpace = false;-
302 hasNewLine = false;-
303}
executed 10300 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
10300
304-
305//-
306// Calculates and sets the correct font size in points-
307// depending on the size multiplier and base font.-
308//-
309void QQuickStyledTextPrivate::setFontSize(int size, QTextCharFormat &format)-
310{-
311 static const qreal scaling[] = { 0.7, 0.8, 1.0, 1.2, 1.5, 2.0, 2.4 };-
312 if (baseFont.pointSizeF() != -1)
baseFont.pointSizeF() != -1Description
TRUEevaluated 666 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 648 times by 1 test
Evaluated by:
  • tst_qquicktext
648-666
313 format.setFontPointSize(baseFont.pointSize() * scaling[size - 1]);
executed 666 times by 2 tests: format.setFontPointSize(baseFont.pointSize() * scaling[size - 1]);
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
666
314 else-
315 format.setFontPointSize(baseFont.pixelSize() * qreal(72.) / qreal(qt_defaultDpi()) * scaling[size - 1]);
executed 648 times by 1 test: format.setFontPointSize(baseFont.pixelSize() * qreal(72.) / qreal(qt_defaultDpi()) * scaling[size - 1]);
Executed by:
  • tst_qquicktext
648
316 *fontSizeModified = true;-
317}
executed 1314 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
1314
318-
319bool QQuickStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QString &textOut, QTextCharFormat &format)-
320{-
321 skipSpace(ch);-
322-
323 int tagStart = ch - textIn.constData();-
324 int tagLength = 0;-
325 while (!ch->isNull()) {
!ch->isNull()Description
TRUEevaluated 8732 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktextedit
4-8732
326 if (*ch == greaterThan) {
*ch == greaterThanDescription
TRUEevaluated 1684 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 7048 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
1684-7048
327 if (tagLength == 0)
tagLength == 0Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktextedit
FALSEevaluated 1678 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
6-1678
328 return false;
executed 6 times by 2 tests: return false;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktextedit
6
329 QStringRef tag(&textIn, tagStart, tagLength);-
330 const QChar char0 = tag.at(0);-
331 if (char0 == QLatin1Char('b')) {
char0 == QLatin1Char('b')Description
TRUEevaluated 760 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 918 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
760-918
332 if (tagLength == 1) {
tagLength == 1Description
TRUEevaluated 586 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 174 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
174-586
333 format.setFontWeight(QFont::Bold);-
334 return true;
executed 586 times by 7 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
586
335 } else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) {
tagLength == 2Description
TRUEevaluated 168 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
tag.at(1) == QLatin1Char('r')Description
TRUEevaluated 166 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-168
336 textOut.append(QChar(QChar::LineSeparator));-
337 hasSpace = true;-
338 prependSpace = false;-
339 return false;
executed 166 times by 2 tests: return false;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
166
340 }-
341 } else if (char0 == QLatin1Char('i')) {
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
char0 == QLatin1Char('i')Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 846 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
8-846
342 if (tagLength == 1) {
tagLength == 1Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-70
343 format.setFontItalic(true);-
344 return true;
executed 70 times by 2 tests: return true;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
70
345 }-
346 } else if (char0 == QLatin1Char('p')) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
char0 == QLatin1Char('p')Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 824 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
2-824
347 if (tagLength == 1) {
tagLength == 1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
10-12
348 if (!hasNewLine)
!hasNewLineDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-12
349 textOut.append(QChar::LineSeparator);
executed 12 times by 2 tests: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
12
350 hasSpace = true;-
351 prependSpace = false;-
352 } else if (tag == QLatin1String("pre")) {
executed 12 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
tag == QLatin1String("pre")Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-12
353 preFormat = true;-
354 if (!hasNewLine)
!hasNewLineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-4
355 textOut.append(QChar::LineSeparator);
executed 4 times by 1 test: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_qquickstyledtext
4
356 format.setFontFamily(QString::fromLatin1("Courier New,courier"));-
357 format.setFontFixedPitch(true);-
358 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
4
359 }-
360 } else if (char0 == QLatin1Char('u')) {
executed 18 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
char0 == QLatin1Char('u')Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 806 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
18-806
361 if (tagLength == 1) {
tagLength == 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
4-14
362 format.setFontUnderline(true);-
363 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
4
364 } else if (tag == QLatin1String("ul")) {
tag == QLatin1String("ul")Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-12
365 List listItem;-
366 listItem.level = 0;-
367 listItem.type = Unordered;-
368 listItem.format = Bullet;-
369 listStack.push(listItem);-
370 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
12
371 } else if (char0 == QLatin1Char('h') && tagLength == 2) {
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
char0 == QLatin1Char('h')Description
TRUEevaluated 660 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 146 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
tagLength == 2Description
TRUEevaluated 644 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_examples
14-660
372 int level = tag.at(1).digitValue();-
373 if (level >= 1 && level <= 6) {
level >= 1Description
TRUEevaluated 642 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
level <= 6Description
TRUEevaluated 640 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-642
374 if (!hasNewLine)
!hasNewLineDescription
TRUEevaluated 624 times by 1 test
Evaluated by:
  • tst_qquicktext
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
16-624
375 textOut.append(QChar::LineSeparator);
executed 624 times by 1 test: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_qquicktext
624
376 hasSpace = true;-
377 prependSpace = false;-
378 setFontSize(7 - level, format);-
379 format.setFontWeight(QFont::Bold);-
380 return true;
executed 640 times by 2 tests: return true;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
640
381 }-
382 } else if (tag == QLatin1String("strong")) {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
tag == QLatin1String("strong")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 160 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
2-160
383 format.setFontWeight(QFont::Bold);-
384 return true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
2
385 } else if (tag == QLatin1String("ol")) {
tag == QLatin1String("ol")Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 148 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
12-148
386 List listItem;-
387 listItem.level = 0;-
388 listItem.type = Ordered;-
389 listItem.format = Decimal;-
390 listStack.push(listItem);-
391 } else if (tag == QLatin1String("li")) {
executed 12 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
tag == QLatin1String("li")Description
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
12-110
392 if (!hasNewLine)
!hasNewLineDescription
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
24-86
393 textOut.append(QChar(QChar::LineSeparator));
executed 86 times by 2 tests: textOut.append(QChar(QChar::LineSeparator));
Executed by:
  • tst_examples
  • tst_qquickstyledtext
86
394 if (!listStack.isEmpty()) {
!listStack.isEmpty()Description
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-110
395 int count = ++listStack.top().level;-
396 for (int i = 0; i < listStack.size(); ++i)
i < listStack.size()Description
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 110 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
110
397 textOut += QString(tabsize, QChar::Nbsp);
executed 110 times by 2 tests: textOut += QString(tabsize, QChar::Nbsp);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
110
398 switch (listStack.top().format) {-
399 case Decimal:
executed 40 times by 2 tests: case Decimal:
Executed by:
  • tst_examples
  • tst_qquickstyledtext
40
400 textOut += QString::number(count) % QLatin1Char('.');-
401 break;
executed 40 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
40
402 case LowerAlpha:
executed 4 times by 1 test: case LowerAlpha:
Executed by:
  • tst_qquickstyledtext
4
403 textOut += toAlpha(count, false) % QLatin1Char('.');-
404 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
405 case UpperAlpha:
executed 4 times by 1 test: case UpperAlpha:
Executed by:
  • tst_qquickstyledtext
4
406 textOut += toAlpha(count, true) % QLatin1Char('.');-
407 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
408 case LowerRoman:
executed 4 times by 1 test: case LowerRoman:
Executed by:
  • tst_qquickstyledtext
4
409 textOut += toRoman(count, false) % QLatin1Char('.');-
410 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
411 case UpperRoman:
executed 4 times by 1 test: case UpperRoman:
Executed by:
  • tst_qquickstyledtext
4
412 textOut += toRoman(count, true) % QLatin1Char('.');-
413 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
414 case Bullet:
executed 46 times by 2 tests: case Bullet:
Executed by:
  • tst_examples
  • tst_qquickstyledtext
46
415 textOut += bullet;-
416 break;
executed 46 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
46
417 case Disc:
executed 4 times by 1 test: case Disc:
Executed by:
  • tst_qquickstyledtext
4
418 textOut += disc;-
419 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
420 case Square:
executed 4 times by 1 test: case Square:
Executed by:
  • tst_qquickstyledtext
4
421 textOut += square;-
422 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
423 }-
424 textOut += QString(2, QChar::Nbsp);-
425 }
executed 110 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
110
426 }
executed 110 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
110
427 return false;
executed 206 times by 3 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
206
428 } else if (ch->isSpace()) {
ch->isSpace()Description
TRUEevaluated 938 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6110 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
938-6110
429 // may have params.-
430 QStringRef tag(&textIn, tagStart, tagLength);-
431 if (tag == QLatin1String("font"))
tag == QLatin1String("font")Description
TRUEevaluated 694 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 244 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
244-694
432 return parseFontAttributes(ch, textIn, format);
executed 694 times by 3 tests: return parseFontAttributes(ch, textIn, format);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
694
433 if (tag == QLatin1String("ol")) {
tag == QLatin1String("ol")Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 234 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
10-234
434 parseOrderedListAttributes(ch, textIn);-
435 return false; // doesn't modify format
executed 10 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
10
436 }-
437 if (tag == QLatin1String("ul")) {
tag == QLatin1String("ul")Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 228 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
6-228
438 parseUnorderedListAttributes(ch, textIn);-
439 return false; // doesn't modify format
executed 6 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
6
440 }-
441 if (tag == QLatin1String("a")) {
tag == QLatin1String("a")Description
TRUEevaluated 130 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 98 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
98-130
442 return parseAnchorAttributes(ch, textIn, format);
executed 130 times by 2 tests: return parseAnchorAttributes(ch, textIn, format);
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
130
443 }-
444 if (tag == QLatin1String("img")) {
tag == QLatin1String("img")Description
TRUEevaluated 96 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-96
445 parseImageAttributes(ch, textIn, textOut);-
446 return false;
executed 96 times by 3 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
96
447 }-
448 if (*ch == greaterThan || ch->isNull())
*ch == greaterThanDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
ch->isNull()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
0-2
449 continue;
never executed: continue;
0
450 } else if (*ch != slash) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
*ch != slashDescription
TRUEevaluated 5974 times by 7 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
2-5974
451 tagLength++;-
452 }
executed 5974 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
5974
453 ++ch;-
454 }
executed 6112 times by 7 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
  • tst_qquicktextedit
6112
455 return false;
executed 4 times by 2 tests: return false;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktextedit
4
456}-
457-
458bool QQuickStyledTextPrivate::parseCloseTag(const QChar *&ch, const QString &textIn, QString &textOut)-
459{-
460 skipSpace(ch);-
461-
462 int tagStart = ch - textIn.constData();-
463 int tagLength = 0;-
464 while (!ch->isNull()) {
!ch->isNull()Description
TRUEevaluated 7304 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-7304
465 if (*ch == greaterThan) {
*ch == greaterThanDescription
TRUEevaluated 2216 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 5088 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
2216-5088
466 if (tagLength == 0)
tagLength == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 2214 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
2-2214
467 return false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
2
468 QStringRef tag(&textIn, tagStart, tagLength);-
469 const QChar char0 = tag.at(0);-
470 hasNewLine = false;-
471 if (char0 == QLatin1Char('b')) {
char0 == QLatin1Char('b')Description
TRUEevaluated 576 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 1638 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
576-1638
472 if (tagLength == 1)
tagLength == 1Description
TRUEevaluated 576 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-576
473 return true;
executed 576 times by 6 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
576
474 else if (tag.at(1) == QLatin1Char('r') && tagLength == 2)
tag.at(1) == QLatin1Char('r')Description
TRUEnever evaluated
FALSEnever evaluated
tagLength == 2Description
TRUEnever evaluated
FALSEnever evaluated
0
475 return false;
never executed: return false;
0
476 } else if (char0 == QLatin1Char('i')) {
never executed: end of block
char0 == QLatin1Char('i')Description
TRUEevaluated 72 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 1566 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
0-1566
477 if (tagLength == 1)
tagLength == 1Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-70
478 return true;
executed 70 times by 2 tests: return true;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
70
479 } else if (char0 == QLatin1Char('a')) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
char0 == QLatin1Char('a')Description
TRUEevaluated 130 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 1436 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
2-1436
480 if (tagLength == 1)
tagLength == 1Description
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-128
481 return true;
executed 128 times by 2 tests: return true;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
128
482 } else if (char0 == QLatin1Char('p')) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
char0 == QLatin1Char('p')Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 1426 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
2-1426
483 if (tagLength == 1) {
tagLength == 1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-6
484 textOut.append(QChar::LineSeparator);-
485 hasNewLine = true;-
486 hasSpace = true;-
487 return false;
executed 6 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
6
488 } else if (tag == QLatin1String("pre")) {
tag == QLatin1String("pre")Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-4
489 preFormat = false;-
490 if (!hasNewLine)
!hasNewLineDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-4
491 textOut.append(QChar::LineSeparator);
executed 4 times by 1 test: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_qquickstyledtext
4
492 hasNewLine = true;-
493 hasSpace = true;-
494 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
4
495 }-
496 } else if (char0 == QLatin1Char('u')) {
never executed: end of block
char0 == QLatin1Char('u')Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 1406 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
0-1406
497 if (tagLength == 1)
tagLength == 1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
4-16
498 return true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
4
499 else if (tag == QLatin1String("ul")) {
tag == QLatin1String("ul")Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-16
500 if (!listStack.isEmpty()) {
!listStack.isEmpty()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-16
501 listStack.pop();-
502 if (!listStack.count())
!listStack.count()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-16
503 textOut.append(QChar::LineSeparator);
executed 16 times by 2 tests: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
16
504 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
16
505 return false;
executed 16 times by 2 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
16
506 }-
507 } else if (char0 == QLatin1Char('h') && tagLength == 2) {
never executed: end of block
char0 == QLatin1Char('h')Description
TRUEevaluated 644 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 762 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
tagLength == 2Description
TRUEevaluated 628 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_examples
0-762
508 textOut.append(QChar::LineSeparator);-
509 hasNewLine = true;-
510 hasSpace = true;-
511 return true;
executed 628 times by 2 tests: return true;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
628
512 } else if (tag == QLatin1String("font")) {
tag == QLatin1String("font")Description
TRUEevaluated 694 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 84 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
84-694
513 return true;
executed 694 times by 3 tests: return true;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
694
514 } else if (tag == QLatin1String("strong")) {
tag == QLatin1String("strong")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 82 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
2-82
515 return true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_qquickstyledtext
2
516 } else if (tag == QLatin1String("ol")) {
tag == QLatin1String("ol")Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
20-62
517 if (!listStack.isEmpty()) {
!listStack.isEmpty()Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-20
518 listStack.pop();-
519 if (!listStack.count())
!listStack.count()Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEnever evaluated
0-20
520 textOut.append(QChar::LineSeparator);
executed 20 times by 2 tests: textOut.append(QChar::LineSeparator);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
20
521 }
executed 20 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
20
522 return false;
executed 20 times by 2 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
20
523 } else if (tag == QLatin1String("li")) {
tag == QLatin1String("li")Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
22-40
524 return false;
executed 40 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
40
525 }-
526 return false;
executed 26 times by 2 tests: return false;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
26
527 } else if (!ch->isSpace()){
!ch->isSpace()Description
TRUEevaluated 5088 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-5088
528 tagLength++;-
529 }
executed 5088 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
5088
530 ++ch;-
531 }
executed 5088 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickstyledtext
  • tst_qquicktext
5088
532-
533 return false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_qquickstyledtext
4
534}-
535-
536void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textIn, QString &textOut)-
537{-
538 int entityStart = ch - textIn.constData();-
539 int entityLength = 0;-
540 while (!ch->isNull()) {
!ch->isNull()Description
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-122
541 if (*ch == QLatin1Char(';')) {
*ch == QLatin1Char(';')Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
26-96
542 QStringRef entity(&textIn, entityStart, entityLength);-
543 if (entity == QLatin1String("gt"))
entity == QLatin1String("gt")Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
6-20
544 textOut += QChar(62);
executed 6 times by 1 test: textOut += QChar(62);
Executed by:
  • tst_qquickstyledtext
6
545 else if (entity == QLatin1String("lt"))
entity == QLatin1String("lt")Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
6-14
546 textOut += QChar(60);
executed 6 times by 1 test: textOut += QChar(60);
Executed by:
  • tst_qquickstyledtext
6
547 else if (entity == QLatin1String("amp"))
entity == QLatin1String("amp")Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-10
548 textOut += QChar(38);
executed 4 times by 1 test: textOut += QChar(38);
Executed by:
  • tst_qquickstyledtext
4
549 else if (entity == QLatin1String("quot"))
entity == QLat...String("quot")Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-6
550 textOut += QChar(34);
executed 6 times by 1 test: textOut += QChar(34);
Executed by:
  • tst_qquickstyledtext
6
551 else if (entity == QLatin1String("nbsp"))
entity == QLat...String("nbsp")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2
552 textOut += QChar(QChar::Nbsp);
executed 2 times by 1 test: textOut += QChar(QChar::Nbsp);
Executed by:
  • tst_qquickstyledtext
2
553 return;
executed 26 times by 1 test: return;
Executed by:
  • tst_qquickstyledtext
26
554 } else if (*ch == QLatin1Char(' ')) {
*ch == QLatin1Char(' ')Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4-92
555 QStringRef entity(&textIn, entityStart - 1, entityLength + 1);-
556 textOut += entity + *ch;-
557 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickstyledtext
4
558 }-
559 ++entityLength;-
560 ++ch;-
561 }
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
92
562}
never executed: end of block
0
563-
564bool QQuickStyledTextPrivate::parseFontAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)-
565{-
566 bool valid = false;-
567 QPair<QStringRef,QStringRef> attr;-
568 do {-
569 attr = parseAttribute(ch, textIn);-
570 if (attr.first == QLatin1String("color")) {
attr.first == ...tring("color")Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
FALSEevaluated 1370 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
16-1370
571 valid = true;-
572 format.setForeground(QColor(attr.second.toString()));-
573 } else if (attr.first == QLatin1String("size")) {
executed 16 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
attr.first == ...String("size")Description
TRUEevaluated 674 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 696 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
16-696
574 valid = true;-
575 int size = attr.second.toString().toInt();-
576 if (attr.second.at(0) == QLatin1Char('-') || attr.second.at(0) == QLatin1Char('+'))
attr.second.at...atin1Char('-')Description
TRUEnever evaluated
FALSEevaluated 674 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
attr.second.at...atin1Char('+')Description
TRUEnever evaluated
FALSEevaluated 674 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
0-674
577 size += 3;
never executed: size += 3;
0
578 if (size >= 1 && size <= 7)
size >= 1Description
TRUEevaluated 674 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
size <= 7Description
TRUEevaluated 674 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-674
579 setFontSize(size, format);
executed 674 times by 2 tests: setFontSize(size, format);
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
674
580 }
executed 674 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
674
581 } while (!ch->isNull() && !attr.first.isEmpty());
executed 1386 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
!ch->isNull()Description
TRUEevaluated 1384 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
!attr.first.isEmpty()Description
TRUEevaluated 692 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 692 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
2-1386
582-
583 return valid;
executed 694 times by 3 tests: return valid;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
694
584}-
585-
586bool QQuickStyledTextPrivate::parseOrderedListAttributes(const QChar *&ch, const QString &textIn)-
587{-
588 bool valid = false;-
589-
590 List listItem;-
591 listItem.level = 0;-
592 listItem.type = Ordered;-
593 listItem.format = Decimal;-
594-
595 QPair<QStringRef,QStringRef> attr;-
596 do {-
597 attr = parseAttribute(ch, textIn);-
598 if (attr.first == QLatin1String("type")) {
attr.first == ...String("type")Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
10
599 valid = true;-
600 if (attr.second == QLatin1String("a"))
attr.second ==...in1String("a")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-8
601 listItem.format = LowerAlpha;
executed 2 times by 1 test: listItem.format = LowerAlpha;
Executed by:
  • tst_qquickstyledtext
2
602 else if (attr.second == QLatin1String("A"))
attr.second ==...in1String("A")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-6
603 listItem.format = UpperAlpha;
executed 2 times by 1 test: listItem.format = UpperAlpha;
Executed by:
  • tst_qquickstyledtext
2
604 else if (attr.second == QLatin1String("i"))
attr.second ==...in1String("i")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-4
605 listItem.format = LowerRoman;
executed 2 times by 1 test: listItem.format = LowerRoman;
Executed by:
  • tst_qquickstyledtext
2
606 else if (attr.second == QLatin1String("I"))
attr.second ==...in1String("I")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2
607 listItem.format = UpperRoman;
executed 2 times by 1 test: listItem.format = UpperRoman;
Executed by:
  • tst_qquickstyledtext
2
608 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
10
609 } while (!ch->isNull() && !attr.first.isEmpty());
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
!ch->isNull()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
!attr.first.isEmpty()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
0-20
610-
611 listStack.push(listItem);-
612 return valid;
executed 10 times by 1 test: return valid;
Executed by:
  • tst_qquickstyledtext
10
613}-
614-
615bool QQuickStyledTextPrivate::parseUnorderedListAttributes(const QChar *&ch, const QString &textIn)-
616{-
617 bool valid = false;-
618-
619 List listItem;-
620 listItem.level = 0;-
621 listItem.type = Unordered;-
622 listItem.format = Bullet;-
623-
624 QPair<QStringRef,QStringRef> attr;-
625 do {-
626 attr = parseAttribute(ch, textIn);-
627 if (attr.first == QLatin1String("type")) {
attr.first == ...String("type")Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
6
628 valid = true;-
629 if (attr.second == QLatin1String("disc"))
attr.second ==...String("disc")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-4
630 listItem.format = Disc;
executed 2 times by 1 test: listItem.format = Disc;
Executed by:
  • tst_qquickstyledtext
2
631 else if (attr.second == QLatin1String("square"))
attr.second ==...ring("square")Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2
632 listItem.format = Square;
executed 2 times by 1 test: listItem.format = Square;
Executed by:
  • tst_qquickstyledtext
2
633 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
6
634 } while (!ch->isNull() && !attr.first.isEmpty());
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
!ch->isNull()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
!attr.first.isEmpty()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
0-12
635-
636 listStack.push(listItem);-
637 return valid;
executed 6 times by 1 test: return valid;
Executed by:
  • tst_qquickstyledtext
6
638}-
639-
640bool QQuickStyledTextPrivate::parseAnchorAttributes(const QChar *&ch, const QString &textIn, QTextCharFormat &format)-
641{-
642 bool valid = false;-
643-
644 QPair<QStringRef,QStringRef> attr;-
645 do {-
646 attr = parseAttribute(ch, textIn);-
647 if (attr.first == QLatin1String("href")) {
attr.first == ...String("href")Description
TRUEevaluated 124 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 132 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
124-132
648 format.setAnchorHref(attr.second.toString());-
649 format.setAnchor(true);-
650 format.setFontUnderline(true);-
651 valid = true;-
652 }
executed 124 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
124
653 } while (!ch->isNull() && !attr.first.isEmpty());
executed 256 times by 2 tests: end of block
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
!ch->isNull()Description
TRUEevaluated 256 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
!attr.first.isEmpty()Description
TRUEevaluated 126 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 130 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
0-256
654-
655 return valid;
executed 130 times by 2 tests: return valid;
Executed by:
  • tst_qquickstyledtext
  • tst_qquicktext
130
656}-
657-
658void QQuickStyledTextPrivate::parseImageAttributes(const QChar *&ch, const QString &textIn, QString &textOut)-
659{-
660 qreal imgWidth = 0.0;-
661 QFontMetricsF fm(layout.font());-
662 const qreal spaceWidth = fm.width(QChar::Nbsp);-
663 const bool trailingSpace = textOut.endsWith(space);-
664-
665 if (!updateImagePositions) {
!updateImagePositionsDescription
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
10-86
666 QQuickStyledTextImgTag *image = new QQuickStyledTextImgTag;-
667 image->position = textOut.length() + (trailingSpace ? 0 : 1);
trailingSpaceDescription
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 34 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
34-52
668-
669 QPair<QStringRef,QStringRef> attr;-
670 do {-
671 attr = parseAttribute(ch, textIn);-
672 if (attr.first == QLatin1String("src")) {
attr.first == ...1String("src")Description
TRUEevaluated 86 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 180 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
86-180
673 image->url = QUrl(attr.second.toString());-
674 } else if (attr.first == QLatin1String("width")) {
executed 86 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
attr.first == ...tring("width")Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 150 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
30-150
675 image->size.setWidth(attr.second.toString().toInt());-
676 } else if (attr.first == QLatin1String("height")) {
executed 30 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
attr.first == ...ring("height")Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 120 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
30-120
677 image->size.setHeight(attr.second.toString().toInt());-
678 } else if (attr.first == QLatin1String("align")) {
executed 30 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
attr.first == ...tring("align")Description
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 86 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
30-86
679 if (attr.second.toString() == QLatin1String("top")) {
attr.second.to...1String("top")Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
8-26
680 image->align = QQuickStyledTextImgTag::Top;-
681 } else if (attr.second.toString() == QLatin1String("middle")) {
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
attr.second.to...ring("middle")Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
8-16
682 image->align = QQuickStyledTextImgTag::Middle;-
683 }
executed 16 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
16
684 }
executed 34 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
34
685 } while (!ch->isNull() && !attr.first.isEmpty());
executed 266 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
!ch->isNull()Description
TRUEevaluated 266 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
!attr.first.isEmpty()Description
TRUEevaluated 180 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 86 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
0-266
686-
687 if (preloadImages && !image->size.isValid()) {
preloadImagesDescription
TRUEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickstyledtext
  • tst_qquicktext
!image->size.isValid()Description
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
6-80
688 // if we don't know its size but the image is a local image,-
689 // we load it in the pixmap cache and save its implicit size-
690 // to avoid a relayout later on.-
691 QUrl url = baseUrl.resolved(image->url);-
692 if (url.isLocalFile()) {
url.isLocalFile()Description
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
8-44
693 image->pix = new QQuickPixmap(context->engine(), url, image->size);-
694 if (image->pix && image->pix->isReady()) {
image->pixDescription
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEnever evaluated
image->pix->isReady()Description
TRUEevaluated 44 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEnever evaluated
0-44
695 image->size = image->pix->implicitSize();-
696 } else {
executed 44 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
44
697 delete image->pix;-
698 image->pix = nullptr;-
699 }
never executed: end of block
0
700 }-
701 }
executed 52 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
52
702-
703 imgWidth = image->size.width();-
704 image->offset = -std::fmod(imgWidth, spaceWidth) / 2.0;-
705 imgTags->append(image);-
706-
707 } else {
executed 86 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
86
708 // if we already have a list of img tags for this text-
709 // we only want to update the positions of these tags.-
710 QQuickStyledTextImgTag *image = imgTags->value(nbImages);-
711 image->position = textOut.length() + (trailingSpace ? 0 : 1);
trailingSpaceDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquicktext
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
4-6
712 imgWidth = image->size.width();-
713 image->offset = -std::fmod(imgWidth, spaceWidth) / 2.0;-
714 QPair<QStringRef,QStringRef> attr;-
715 do {-
716 attr = parseAttribute(ch, textIn);-
717 } while (!ch->isNull() && !attr.first.isEmpty());
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
!ch->isNull()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEnever evaluated
!attr.first.isEmpty()Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
0-22
718 nbImages++;-
719 }
executed 10 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquicktext
10
720-
721 QString padding(qFloor(imgWidth / spaceWidth), QChar::Nbsp);-
722 if (!trailingSpace)
!trailingSpaceDescription
TRUEevaluated 38 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 58 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
38-58
723 textOut += QLatin1Char(' ');
executed 38 times by 3 tests: textOut += QLatin1Char(' ');
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
38
724 textOut += padding + QLatin1Char(' ');-
725}
executed 96 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
96
726-
727QPair<QStringRef,QStringRef> QQuickStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)-
728{-
729 skipSpace(ch);-
730-
731 int attrStart = ch - textIn.constData();-
732 int attrLength = 0;-
733 while (!ch->isNull()) {
!ch->isNull()Description
TRUEevaluated 6186 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEnever evaluated
0-6186
734 if (*ch == greaterThan) {
*ch == greaterThanDescription
TRUEevaluated 930 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 5256 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
930-5256
735 break;
executed 930 times by 3 tests: break;
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
930
736 } else if (*ch == equals) {
*ch == equalsDescription
TRUEevaluated 1032 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 4224 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
1032-4224
737 ++ch;-
738 if (*ch != singleQuote && *ch != doubleQuote) {
*ch != singleQuoteDescription
TRUEevaluated 1028 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
*ch != doubleQuoteDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 1024 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
4-1028
739 while (*ch != greaterThan && !ch->isNull())
*ch != greaterThanDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
!ch->isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0-4
740 ++ch;
never executed: ++ch;
0
741 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
4
742 }-
743 ++ch;-
744 if (!attrLength)
!attrLengthDescription
TRUEnever evaluated
FALSEevaluated 1028 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
0-1028
745 break;
never executed: break;
0
746 QStringRef attr(&textIn, attrStart, attrLength);-
747 QStringRef val = parseValue(ch, textIn);-
748 if (!val.isEmpty())
!val.isEmpty()Description
TRUEevaluated 1026 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-1026
749 return QPair<QStringRef,QStringRef>(attr,val);
executed 1026 times by 3 tests: return QPair<QStringRef,QStringRef>(attr,val);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
1026
750 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquickstyledtext
2
751 } else {-
752 ++attrLength;-
753 }
executed 4224 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
4224
754 ++ch;-
755 }
executed 4224 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
4224
756-
757 return QPair<QStringRef,QStringRef>();
executed 936 times by 3 tests: return QPair<QStringRef,QStringRef>();
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
936
758}-
759-
760QStringRef QQuickStyledTextPrivate::parseValue(const QChar *&ch, const QString &textIn)-
761{-
762 int valStart = ch - textIn.constData();-
763 int valLength = 0;-
764 while (*ch != singleQuote && *ch != doubleQuote && !ch->isNull()) {
*ch != singleQuoteDescription
TRUEevaluated 7680 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
*ch != doubleQuoteDescription
TRUEevaluated 6660 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 1020 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
!ch->isNull()Description
TRUEevaluated 6658 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
2-7680
765 ++valLength;-
766 ++ch;-
767 }
executed 6658 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
6658
768 if (ch->isNull())
ch->isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 1026 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
2-1026
769 return QStringRef();
executed 2 times by 1 test: return QStringRef();
Executed by:
  • tst_qquickstyledtext
2
770 ++ch; // skip quote-
771-
772 return QStringRef(&textIn, valStart, valLength);
executed 1026 times by 3 tests: return QStringRef(&textIn, valStart, valLength);
Executed by:
  • tst_examples
  • tst_qquickstyledtext
  • tst_qquicktext
1026
773}-
774-
775QString QQuickStyledTextPrivate::toAlpha(int value, bool upper)-
776{-
777 const char baseChar = upper ? 'A' : 'a';
upperDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4
778-
779 QString result;-
780 int c = value;-
781 while (c > 0) {
c > 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
8
782 c--;-
783 result.prepend(QChar(baseChar + (c % 26)));-
784 c /= 26;-
785 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
8
786 return result;
executed 8 times by 1 test: return result;
Executed by:
  • tst_qquickstyledtext
8
787}-
788-
789QString QQuickStyledTextPrivate::toRoman(int value, bool upper)-
790{-
791 QString result = QLatin1String("?");-
792 // works for up to 4999 items-
793 if (value < 5000) {
value < 5000Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEnever evaluated
0-8
794 QByteArray romanNumeral;-
795-
796 static const char romanSymbolsLower[] = "iiivixxxlxcccdcmmmm";-
797 static const char romanSymbolsUpper[] = "IIIVIXXXLXCCCDCMMMM";-
798 QByteArray romanSymbols;-
799 if (!upper)
!upperDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
4
800 romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower));
executed 4 times by 1 test: romanSymbols = QByteArray::fromRawData(romanSymbolsLower, sizeof(romanSymbolsLower));
Executed by:
  • tst_qquickstyledtext
4
801 else-
802 romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper));
executed 4 times by 1 test: romanSymbols = QByteArray::fromRawData(romanSymbolsUpper, sizeof(romanSymbolsUpper));
Executed by:
  • tst_qquickstyledtext
4
803-
804 int c[] = { 1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000 };-
805 int n = value;-
806 for (int i = 12; i >= 0; n %= c[i], i--) {
i >= 0Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
8-104
807 int q = n / c[i];-
808 if (q > 0) {
q > 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
FALSEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
8-96
809 int startDigit = i + (i + 3) / 4;-
810 int numDigits;-
811 if (i % 4) {
i % 4Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickstyledtext
0-8
812 if ((i - 2) % 4)
(i - 2) % 4Description
TRUEnever evaluated
FALSEnever evaluated
0
813 numDigits = 2;
never executed: numDigits = 2;
0
814 else-
815 numDigits = 1;
never executed: numDigits = 1;
0
816 }-
817 else-
818 numDigits = q;
executed 8 times by 1 test: numDigits = q;
Executed by:
  • tst_qquickstyledtext
8
819 romanNumeral.append(romanSymbols.mid(startDigit, numDigits));-
820 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
8
821 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
104
822 result = QString::fromLatin1(romanNumeral);-
823 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickstyledtext
8
824 return result;
executed 8 times by 1 test: return result;
Executed by:
  • tst_qquickstyledtext
8
825}-
826-
827QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0