OpenCoverage

qquickscalegrid.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickscalegrid.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11QQuickScaleGrid::QQuickScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0)-
12{-
13}
executed 100 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
100
14-
15QQuickScaleGrid::~QQuickScaleGrid()-
16{-
17}-
18-
19bool QQuickScaleGrid::isNull() const-
20{-
21 return
never executed: return !_left && !_top && !_right && !_bottom;
!_left && !_top && !_right && !_bottom;
never executed: return !_left && !_top && !_right && !_bottom;
0
22}-
23-
24void QQuickScaleGrid::setLeft(int pos)-
25{-
26 if (_left != pos
_left != posDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
) {
2-98
27 _left = pos;-
28 leftBorderChanged();-
29 borderChanged();-
30 }
executed 98 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
98
31}
executed 100 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
100
32-
33void QQuickScaleGrid::setTop(int pos)-
34{-
35 if (_top != pos
_top != posDescription
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-94
36 _top = pos;-
37 topBorderChanged();-
38 borderChanged();-
39 }
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
94
40}
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
94
41-
42void QQuickScaleGrid::setRight(int pos)-
43{-
44 if (_right != pos
_right != posDescription
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
) {
2-98
45 _right = pos;-
46 rightBorderChanged();-
47 borderChanged();-
48 }
executed 98 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
98
49}
executed 100 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
100
50-
51void QQuickScaleGrid::setBottom(int pos)-
52{-
53 if (_bottom != pos
_bottom != posDescription
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEnever evaluated
) {
0-94
54 _bottom = pos;-
55 bottomBorderChanged();-
56 borderChanged();-
57 }
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
94
58}
executed 94 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
94
59-
60QQuickGridScaledImage::QQuickGridScaledImage()-
61: _l(-1), _r(-1), _t(-1), _b(-1),-
62 _h(QQuickBorderImage::Stretch), _v(QQuickBorderImage::Stretch)-
63{-
64}
never executed: end of block
0
65-
66QQuickGridScaledImage::QQuickGridScaledImage(const QQuickGridScaledImage &o)-
67: _l(o._l), _r(o._r), _t(o._t), _b(o._b), _h(o._h), _v(o._v), _pix(o._pix)-
68{-
69}
never executed: end of block
0
70-
71QQuickGridScaledImage &QQuickGridScaledImage::operator=(const QQuickGridScaledImage &o)-
72{-
73 _l = o._l;-
74 _r = o._r;-
75 _t = o._t;-
76 _b = o._b;-
77 _h = o._h;-
78 _v = o._v;-
79 _pix = o._pix;-
80 return
never executed: return *this;
*this;
never executed: return *this;
0
81}-
82-
83QQuickGridScaledImage::QQuickGridScaledImage(QIODevice *data)-
84: _l(-1), _r(-1), _t(-1), _b(-1), _h(QQuickBorderImage::Stretch), _v(QQuickBorderImage::Stretch)-
85{-
86 int l = -1;-
87 int r = -1;-
88 int t = -1;-
89 int b = -1;-
90 QString imgFile;-
91-
92 QByteArray raw;-
93 while (raw = data->readLine(), !raw.isEmpty()
raw = data->re...!raw.isEmpty()Description
TRUEevaluated 160 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
26-160
94 QString line = QString::fromUtf8(raw.trimmed());-
95 if (line.isEmpty()
line.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 160 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
|| line.startsWith(QLatin1Char('#'))
line.startsWit...tin1Char('#'))Description
TRUEnever evaluated
FALSEevaluated 160 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-160
96 continue;
never executed: continue;
0
97-
98 int colonId = line.indexOf(QLatin1Char(':'));-
99 if (colonId <= 0
colonId <= 0Description
TRUEnever evaluated
FALSEevaluated 160 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-160
100 return;
never executed: return;
0
101-
102 const QStringRef property = line.leftRef(colonId).trimmed();-
103 QStringRef value = line.midRef(colonId + 1).trimmed();-
104-
105 if (property == QLatin1String("border.left")
property == QL..."border.left")Description
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
24-136
106 l = value.toInt();-
107 }
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
else if (property == QLatin1String("border.right")
property == QL...border.right")Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
22-114
108 r = value.toInt();-
109 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
else if (property == QLatin1String("border.top")
property == QL...("border.top")Description
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 90 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
22-90
110 t = value.toInt();-
111 }
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
else if (property == QLatin1String("border.bottom")
property == QL...order.bottom")Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
) {
22-68
112 b = value.toInt();-
113 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
else if (property == QLatin1String("source")
property == QL...ring("source")Description
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickborderimage
) {
22-44
114 if (value.startsWith(QLatin1Char('"'))
value.startsWi...tin1Char('"'))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
&& value.endsWith(QLatin1Char('"'))
value.endsWith...tin1Char('"'))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEnever evaluated
)
0-20
115 value = value.mid(1, value.size() - 2);
executed 4 times by 1 test: value = value.mid(1, value.size() - 2);
Executed by:
  • tst_qquickborderimage
4
116 imgFile = value.toString();-
117 }
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
else if (property == QLatin1String("horizontalTileRule")
property == QL...ntalTileRule")Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickborderimage
|| property == QLatin1String("horizontalTileMode")
property == QL...ntalTileMode")Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickborderimage
) {
8-32
118 _h = stringToRule(value);-
119 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
else if (property == QLatin1String("verticalTileRule")
property == QL...icalTileRule")Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickborderimage
|| property == QLatin1String("verticalTileMode")
property == QL...icalTileMode")Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
) {
4-20
120 _v = stringToRule(value);-
121 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickborderimage
20
122 }
executed 160 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
160
123-
124 if (l < 0
l < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
|| r < 0
r < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
|| t < 0
t < 0Description
TRUEnever evaluated
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
|| b < 0
b < 0Description
TRUEnever evaluated
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
|| imgFile.isEmpty()
imgFile.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
)
0-24
125 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickborderimage
4
126-
127 _l = l; _r = r; _t = t; _b = b;-
128 _pix = imgFile;-
129}
executed 22 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
130-
131QQuickBorderImage::TileMode QQuickGridScaledImage::stringToRule(const QStringRef &s)-
132{-
133 QStringRef string = s;-
134 if (string.startsWith(QLatin1Char('"'))
string.startsW...tin1Char('"'))Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickborderimage
&& string.endsWith(QLatin1Char('"'))
string.endsWit...tin1Char('"'))Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEnever evaluated
)
0-32
135 string = string.mid(1, string.size() - 2);
executed 8 times by 1 test: string = string.mid(1, string.size() - 2);
Executed by:
  • tst_qquickborderimage
8
136-
137 if (string == QLatin1String("Stretch")
string == QLat...ing("Stretch")Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickborderimage
|| string == QLatin1String("BorderImage.Stretch")
string == QLat...mage.Stretch")Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickborderimage
)
0-40
138 return
never executed: return QQuickBorderImage::Stretch;
QQuickBorderImage::Stretch;
never executed: return QQuickBorderImage::Stretch;
0
139 if (string == QLatin1String("Repeat")
string == QLat...ring("Repeat")Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickborderimage
|| string == QLatin1String("BorderImage.Repeat")
string == QLat...Image.Repeat")Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickborderimage
)
4-26
140 return
executed 18 times by 1 test: return QQuickBorderImage::Repeat;
Executed by:
  • tst_qquickborderimage
QQuickBorderImage::Repeat;
executed 18 times by 1 test: return QQuickBorderImage::Repeat;
Executed by:
  • tst_qquickborderimage
18
141 if (string == QLatin1String("Round")
string == QLat...tring("Round")Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickborderimage
|| string == QLatin1String("BorderImage.Round")
string == QLat...rImage.Round")Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickborderimage
)
4-14
142 return
executed 18 times by 1 test: return QQuickBorderImage::Round;
Executed by:
  • tst_qquickborderimage
QQuickBorderImage::Round;
executed 18 times by 1 test: return QQuickBorderImage::Round;
Executed by:
  • tst_qquickborderimage
18
143-
144 QMessageLogger(__FILE__, 185, __PRETTY_FUNCTION__).warning("QQuickGridScaledImage: Invalid tile rule specified. Using Stretch.");-
145 return
executed 4 times by 1 test: return QQuickBorderImage::Stretch;
Executed by:
  • tst_qquickborderimage
QQuickBorderImage::Stretch;
executed 4 times by 1 test: return QQuickBorderImage::Stretch;
Executed by:
  • tst_qquickborderimage
4
146}-
147-
148bool QQuickGridScaledImage::isValid() const-
149{-
150 return
executed 26 times by 2 tests: return _l >= 0;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_l >= 0;
executed 26 times by 2 tests: return _l >= 0;
Executed by:
  • tst_examples
  • tst_qquickborderimage
26
151}-
152-
153int QQuickGridScaledImage::gridLeft() const-
154{-
155 return
executed 22 times by 2 tests: return _l;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_l;
executed 22 times by 2 tests: return _l;
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
156}-
157-
158int QQuickGridScaledImage::gridRight() const-
159{-
160 return
executed 22 times by 2 tests: return _r;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_r;
executed 22 times by 2 tests: return _r;
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
161}-
162-
163int QQuickGridScaledImage::gridTop() const-
164{-
165 return
executed 22 times by 2 tests: return _t;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_t;
executed 22 times by 2 tests: return _t;
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
166}-
167-
168int QQuickGridScaledImage::gridBottom() const-
169{-
170 return
executed 22 times by 2 tests: return _b;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_b;
executed 22 times by 2 tests: return _b;
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
171}-
172-
173QString QQuickGridScaledImage::pixmapUrl() const-
174{-
175 return
executed 22 times by 2 tests: return _pix;
Executed by:
  • tst_examples
  • tst_qquickborderimage
_pix;
executed 22 times by 2 tests: return _pix;
Executed by:
  • tst_examples
  • tst_qquickborderimage
22
176}-
177-
178-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0