| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickscalegrid.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | QQuickScaleGrid::QQuickScaleGrid(QObject *parent) : QObject(parent), _left(0), _top(0), _right(0), _bottom(0) | - | ||||||||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||||||||
| 13 | } executed 100 times by 2 tests: end of blockExecuted by:
| 100 | ||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||
| 15 | QQuickScaleGrid::~QQuickScaleGrid() | - | ||||||||||||||||||||||||||||||
| 16 | { | - | ||||||||||||||||||||||||||||||
| 17 | } | - | ||||||||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||||||||
| 19 | bool QQuickScaleGrid::isNull() const | - | ||||||||||||||||||||||||||||||
| 20 | { | - | ||||||||||||||||||||||||||||||
| 21 | return never executed: !_left && !_top && !_right && !_bottom;return !_left && !_top && !_right && !_bottom;never executed: return !_left && !_top && !_right && !_bottom; | 0 | ||||||||||||||||||||||||||||||
| 22 | } | - | ||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||
| 24 | void QQuickScaleGrid::setLeft(int pos) | - | ||||||||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||||||||
| 26 | if (_left != pos
| 2-98 | ||||||||||||||||||||||||||||||
| 27 | _left = pos; | - | ||||||||||||||||||||||||||||||
| 28 | leftBorderChanged(); | - | ||||||||||||||||||||||||||||||
| 29 | borderChanged(); | - | ||||||||||||||||||||||||||||||
| 30 | } executed 98 times by 2 tests: end of blockExecuted by:
| 98 | ||||||||||||||||||||||||||||||
| 31 | } executed 100 times by 2 tests: end of blockExecuted by:
| 100 | ||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||
| 33 | void QQuickScaleGrid::setTop(int pos) | - | ||||||||||||||||||||||||||||||
| 34 | { | - | ||||||||||||||||||||||||||||||
| 35 | if (_top != pos
| 0-94 | ||||||||||||||||||||||||||||||
| 36 | _top = pos; | - | ||||||||||||||||||||||||||||||
| 37 | topBorderChanged(); | - | ||||||||||||||||||||||||||||||
| 38 | borderChanged(); | - | ||||||||||||||||||||||||||||||
| 39 | } executed 94 times by 2 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 40 | } executed 94 times by 2 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||
| 42 | void QQuickScaleGrid::setRight(int pos) | - | ||||||||||||||||||||||||||||||
| 43 | { | - | ||||||||||||||||||||||||||||||
| 44 | if (_right != pos
| 2-98 | ||||||||||||||||||||||||||||||
| 45 | _right = pos; | - | ||||||||||||||||||||||||||||||
| 46 | rightBorderChanged(); | - | ||||||||||||||||||||||||||||||
| 47 | borderChanged(); | - | ||||||||||||||||||||||||||||||
| 48 | } executed 98 times by 2 tests: end of blockExecuted by:
| 98 | ||||||||||||||||||||||||||||||
| 49 | } executed 100 times by 2 tests: end of blockExecuted by:
| 100 | ||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||
| 51 | void QQuickScaleGrid::setBottom(int pos) | - | ||||||||||||||||||||||||||||||
| 52 | { | - | ||||||||||||||||||||||||||||||
| 53 | if (_bottom != pos
| 0-94 | ||||||||||||||||||||||||||||||
| 54 | _bottom = pos; | - | ||||||||||||||||||||||||||||||
| 55 | bottomBorderChanged(); | - | ||||||||||||||||||||||||||||||
| 56 | borderChanged(); | - | ||||||||||||||||||||||||||||||
| 57 | } executed 94 times by 2 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 58 | } executed 94 times by 2 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||
| 60 | QQuickGridScaledImage::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 | - | |||||||||||||||||||||||||||||||
| 66 | QQuickGridScaledImage::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 | - | |||||||||||||||||||||||||||||||
| 71 | QQuickGridScaledImage &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: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||||||||
| 81 | } | - | ||||||||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||||||||
| 83 | QQuickGridScaledImage::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()
| 26-160 | ||||||||||||||||||||||||||||||
| 94 | QString line = QString::fromUtf8(raw.trimmed()); | - | ||||||||||||||||||||||||||||||
| 95 | if (line.isEmpty()
| 0-160 | ||||||||||||||||||||||||||||||
| 96 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||
| 98 | int colonId = line.indexOf(QLatin1Char(':')); | - | ||||||||||||||||||||||||||||||
| 99 | if (colonId <= 0
| 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")
| 24-136 | ||||||||||||||||||||||||||||||
| 106 | l = value.toInt(); | - | ||||||||||||||||||||||||||||||
| 107 | } executed 24 times by 2 tests: else if (property == QLatin1String("border.right")end of blockExecuted by:
| 22-114 | ||||||||||||||||||||||||||||||
| 108 | r = value.toInt(); | - | ||||||||||||||||||||||||||||||
| 109 | } executed 22 times by 2 tests: else if (property == QLatin1String("border.top")end of blockExecuted by:
| 22-90 | ||||||||||||||||||||||||||||||
| 110 | t = value.toInt(); | - | ||||||||||||||||||||||||||||||
| 111 | } executed 24 times by 2 tests: else if (property == QLatin1String("border.bottom")end of blockExecuted by:
| 22-68 | ||||||||||||||||||||||||||||||
| 112 | b = value.toInt(); | - | ||||||||||||||||||||||||||||||
| 113 | } executed 22 times by 2 tests: else if (property == QLatin1String("source")end of blockExecuted by:
| 22-44 | ||||||||||||||||||||||||||||||
| 114 | if (value.startsWith(QLatin1Char('"'))
| 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:
| 4 | ||||||||||||||||||||||||||||||
| 116 | imgFile = value.toString(); | - | ||||||||||||||||||||||||||||||
| 117 | } executed 24 times by 2 tests: else if (property == QLatin1String("horizontalTileRule")end of blockExecuted by:
| 8-32 | ||||||||||||||||||||||||||||||
| 118 | _h = stringToRule(value); | - | ||||||||||||||||||||||||||||||
| 119 | } executed 20 times by 1 test: else if (property == QLatin1String("verticalTileRule")end of blockExecuted by:
| 4-20 | ||||||||||||||||||||||||||||||
| 120 | _v = stringToRule(value); | - | ||||||||||||||||||||||||||||||
| 121 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||||||||||||||
| 122 | } executed 160 times by 2 tests: end of blockExecuted by:
| 160 | ||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||
| 124 | if (l < 0
| 0-24 | ||||||||||||||||||||||||||||||
| 125 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||||||||
| 127 | _l = l; _r = r; _t = t; _b = b; | - | ||||||||||||||||||||||||||||||
| 128 | _pix = imgFile; | - | ||||||||||||||||||||||||||||||
| 129 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||
| 131 | QQuickBorderImage::TileMode QQuickGridScaledImage::stringToRule(const QStringRef &s) | - | ||||||||||||||||||||||||||||||
| 132 | { | - | ||||||||||||||||||||||||||||||
| 133 | QStringRef string = s; | - | ||||||||||||||||||||||||||||||
| 134 | if (string.startsWith(QLatin1Char('"'))
| 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:
| 8 | ||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||
| 137 | if (string == QLatin1String("Stretch")
| 0-40 | ||||||||||||||||||||||||||||||
| 138 | return never executed: QQuickBorderImage::Stretch;return QQuickBorderImage::Stretch;never executed: return QQuickBorderImage::Stretch; | 0 | ||||||||||||||||||||||||||||||
| 139 | if (string == QLatin1String("Repeat")
| 4-26 | ||||||||||||||||||||||||||||||
| 140 | return executed 18 times by 1 test: QQuickBorderImage::Repeat;return QQuickBorderImage::Repeat;Executed by:
executed 18 times by 1 test: return QQuickBorderImage::Repeat;Executed by:
| 18 | ||||||||||||||||||||||||||||||
| 141 | if (string == QLatin1String("Round")
| 4-14 | ||||||||||||||||||||||||||||||
| 142 | return executed 18 times by 1 test: QQuickBorderImage::Round;return QQuickBorderImage::Round;Executed by:
executed 18 times by 1 test: return QQuickBorderImage::Round;Executed by:
| 18 | ||||||||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||||||||
| 144 | QMessageLogger(__FILE__, 185, __PRETTY_FUNCTION__).warning("QQuickGridScaledImage: Invalid tile rule specified. Using Stretch."); | - | ||||||||||||||||||||||||||||||
| 145 | return executed 4 times by 1 test: QQuickBorderImage::Stretch;return QQuickBorderImage::Stretch;Executed by:
executed 4 times by 1 test: return QQuickBorderImage::Stretch;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 146 | } | - | ||||||||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||||||||
| 148 | bool QQuickGridScaledImage::isValid() const | - | ||||||||||||||||||||||||||||||
| 149 | { | - | ||||||||||||||||||||||||||||||
| 150 | return executed 26 times by 2 tests: _l >= 0;return _l >= 0;Executed by:
executed 26 times by 2 tests: return _l >= 0;Executed by:
| 26 | ||||||||||||||||||||||||||||||
| 151 | } | - | ||||||||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||||||||
| 153 | int QQuickGridScaledImage::gridLeft() const | - | ||||||||||||||||||||||||||||||
| 154 | { | - | ||||||||||||||||||||||||||||||
| 155 | return executed 22 times by 2 tests: _l;return _l;Executed by:
executed 22 times by 2 tests: return _l;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||
| 158 | int QQuickGridScaledImage::gridRight() const | - | ||||||||||||||||||||||||||||||
| 159 | { | - | ||||||||||||||||||||||||||||||
| 160 | return executed 22 times by 2 tests: _r;return _r;Executed by:
executed 22 times by 2 tests: return _r;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 161 | } | - | ||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||
| 163 | int QQuickGridScaledImage::gridTop() const | - | ||||||||||||||||||||||||||||||
| 164 | { | - | ||||||||||||||||||||||||||||||
| 165 | return executed 22 times by 2 tests: _t;return _t;Executed by:
executed 22 times by 2 tests: return _t;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 166 | } | - | ||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||
| 168 | int QQuickGridScaledImage::gridBottom() const | - | ||||||||||||||||||||||||||||||
| 169 | { | - | ||||||||||||||||||||||||||||||
| 170 | return executed 22 times by 2 tests: _b;return _b;Executed by:
executed 22 times by 2 tests: return _b;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||||||||
| 173 | QString QQuickGridScaledImage::pixmapUrl() const | - | ||||||||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||||||||
| 175 | return executed 22 times by 2 tests: _pix;return _pix;Executed by:
executed 22 times by 2 tests: return _pix;Executed by:
| 22 | ||||||||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |