| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qmltest/quicktestresult.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | static const char *globalProgramName = nullptr; | - | ||||||||||||
| 12 | static bool loggingStarted = false; | - | ||||||||||||
| 13 | static QBenchmarkGlobalData globalBenchmarkData; | - | ||||||||||||
| 14 | - | |||||||||||||
| 15 | extern bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000); | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | class __attribute__((visibility("default"))) QuickTestImageObject : public QObject | - | ||||||||||||
| 18 | { | - | ||||||||||||
| 19 | public: | - | ||||||||||||
| 20 | #pragma GCC diagnostic push | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||
| 23 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||
| 24 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||
| 25 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||
| 26 | #pragma GCC diagnostic pop | - | ||||||||||||
| 27 | struct QPrivateSignal {}; | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | - | |||||||||||||
| 30 | - | |||||||||||||
| 31 | - | |||||||||||||
| 32 | - | |||||||||||||
| 33 | public: | - | ||||||||||||
| 34 | QuickTestImageObject(const QImage& img, QObject *parent = nullptr) | - | ||||||||||||
| 35 | : QObject(parent) | - | ||||||||||||
| 36 | , m_image(img) | - | ||||||||||||
| 37 | { | - | ||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||
| 39 | - | |||||||||||||
| 40 | ~QuickTestImageObject() {} | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | public : | - | ||||||||||||
| 43 | int red(int x, int y) const | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | return never executed: pixel(x, y).value<QColor>().red();return pixel(x, y).value<QColor>().red();never executed: return pixel(x, y).value<QColor>().red(); | 0 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | int green(int x, int y) const | - | ||||||||||||
| 49 | { | - | ||||||||||||
| 50 | return never executed: pixel(x, y).value<QColor>().green();return pixel(x, y).value<QColor>().green();never executed: return pixel(x, y).value<QColor>().green(); | 0 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | int blue(int x, int y) const | - | ||||||||||||
| 54 | { | - | ||||||||||||
| 55 | return never executed: pixel(x, y).value<QColor>().blue();return pixel(x, y).value<QColor>().blue();never executed: return pixel(x, y).value<QColor>().blue(); | 0 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | int alpha(int x, int y) const | - | ||||||||||||
| 59 | { | - | ||||||||||||
| 60 | return never executed: pixel(x, y).value<QColor>().alpha();return pixel(x, y).value<QColor>().alpha();never executed: return pixel(x, y).value<QColor>().alpha(); | 0 | ||||||||||||
| 61 | } | - | ||||||||||||
| 62 | - | |||||||||||||
| 63 | QVariant pixel(int x, int y) const | - | ||||||||||||
| 64 | { | - | ||||||||||||
| 65 | if (m_image.isNull()
| 0 | ||||||||||||
| 66 | || x >= m_image.width()
| 0 | ||||||||||||
| 67 | || y >= m_image.height()
| 0 | ||||||||||||
| 68 | || x < 0
| 0 | ||||||||||||
| 69 | || y < 0
| 0 | ||||||||||||
| 70 | || x * y >= m_image.width() * m_image.height()
| 0 | ||||||||||||
| 71 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||
| 72 | - | |||||||||||||
| 73 | return never executed: QColor::fromRgba(m_image.pixel(QPoint(x, y)));return QColor::fromRgba(m_image.pixel(QPoint(x, y)));never executed: return QColor::fromRgba(m_image.pixel(QPoint(x, y))); | 0 | ||||||||||||
| 74 | } | - | ||||||||||||
| 75 | - | |||||||||||||
| 76 | bool equals(QuickTestImageObject *other) const | - | ||||||||||||
| 77 | { | - | ||||||||||||
| 78 | if (!other
| 0 | ||||||||||||
| 79 | return never executed: m_image.isNull();return m_image.isNull();never executed: return m_image.isNull(); | 0 | ||||||||||||
| 80 | - | |||||||||||||
| 81 | return never executed: m_image == other->m_image;return m_image == other->m_image;never executed: return m_image == other->m_image; | 0 | ||||||||||||
| 82 | } | - | ||||||||||||
| 83 | - | |||||||||||||
| 84 | void save(const QString &filePath) | - | ||||||||||||
| 85 | { | - | ||||||||||||
| 86 | QImageWriter writer(filePath); | - | ||||||||||||
| 87 | if (!writer.write(m_image)
| 0 | ||||||||||||
| 88 | QQmlEngine *engine = qmlContext(this)->engine(); | - | ||||||||||||
| 89 | QV4::ExecutionEngine *v4 = engine->handle(); | - | ||||||||||||
| 90 | v4->throwError(([]() noexcept -> QString { enum { Size = sizeof(u"" "Can't save to %1: %2")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Can't save to %1: %2" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()).arg(filePath, writer.errorString()));return qstring_literal_temp; | 0 | ||||||||||||
| 91 | } never executed: end of block | 0 | ||||||||||||
| 92 | } never executed: end of block | 0 | ||||||||||||
| 93 | - | |||||||||||||
| 94 | public: | - | ||||||||||||
| 95 | int width() const | - | ||||||||||||
| 96 | { | - | ||||||||||||
| 97 | return never executed: m_image.width();return m_image.width();never executed: return m_image.width(); | 0 | ||||||||||||
| 98 | } | - | ||||||||||||
| 99 | - | |||||||||||||
| 100 | int height() const | - | ||||||||||||
| 101 | { | - | ||||||||||||
| 102 | return never executed: m_image.height();return m_image.height();never executed: return m_image.height(); | 0 | ||||||||||||
| 103 | } | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | QSize size() const | - | ||||||||||||
| 106 | { | - | ||||||||||||
| 107 | return never executed: m_image.size();return m_image.size();never executed: return m_image.size(); | 0 | ||||||||||||
| 108 | } | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | private: | - | ||||||||||||
| 111 | QImage m_image; | - | ||||||||||||
| 112 | }; | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | class QuickTestResultPrivate | - | ||||||||||||
| 115 | { | - | ||||||||||||
| 116 | public: | - | ||||||||||||
| 117 | QuickTestResultPrivate() | - | ||||||||||||
| 118 | : table(nullptr) | - | ||||||||||||
| 119 | , benchmarkIter(nullptr) | - | ||||||||||||
| 120 | , benchmarkData(nullptr) | - | ||||||||||||
| 121 | , iterCount(0) | - | ||||||||||||
| 122 | { | - | ||||||||||||
| 123 | } executed 40 times by 5 tests: end of blockExecuted by:
| 40 | ||||||||||||
| 124 | ~QuickTestResultPrivate() | - | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | delete table; | - | ||||||||||||
| 127 | delete benchmarkIter; | - | ||||||||||||
| 128 | delete benchmarkData; | - | ||||||||||||
| 129 | } executed 40 times by 5 tests: end of blockExecuted by:
| 40 | ||||||||||||
| 130 | - | |||||||||||||
| 131 | QByteArray intern(const QString &str); | - | ||||||||||||
| 132 | - | |||||||||||||
| 133 | QString testCaseName; | - | ||||||||||||
| 134 | QString functionName; | - | ||||||||||||
| 135 | QSet<QByteArray> internedStrings; | - | ||||||||||||
| 136 | QTestTable *table; | - | ||||||||||||
| 137 | QTest::QBenchmarkIterationController *benchmarkIter; | - | ||||||||||||
| 138 | QBenchmarkTestMethodData *benchmarkData; | - | ||||||||||||
| 139 | int iterCount; | - | ||||||||||||
| 140 | QList<QBenchmarkResult> results; | - | ||||||||||||
| 141 | }; | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | QByteArray QuickTestResultPrivate::intern(const QString &str) | - | ||||||||||||
| 144 | { | - | ||||||||||||
| 145 | QByteArray bstr = str.toUtf8(); | - | ||||||||||||
| 146 | return executed 188 times by 4 tests: *(internedStrings.insert(bstr));return *(internedStrings.insert(bstr));Executed by:
executed 188 times by 4 tests: return *(internedStrings.insert(bstr));Executed by:
| 188 | ||||||||||||
| 147 | } | - | ||||||||||||
| 148 | - | |||||||||||||
| 149 | QuickTestResult::QuickTestResult(QObject *parent) | - | ||||||||||||
| 150 | : QObject(parent), d_ptr(new QuickTestResultPrivate) | - | ||||||||||||
| 151 | { | - | ||||||||||||
| 152 | if (!QBenchmarkGlobalData::current
| 0-40 | ||||||||||||
| 153 | QBenchmarkGlobalData::current = &globalBenchmarkData; never executed: QBenchmarkGlobalData::current = &globalBenchmarkData; | 0 | ||||||||||||
| 154 | } executed 40 times by 5 tests: end of blockExecuted by:
| 40 | ||||||||||||
| 155 | - | |||||||||||||
| 156 | QuickTestResult::~QuickTestResult() | - | ||||||||||||
| 157 | { | - | ||||||||||||
| 158 | } | - | ||||||||||||
| 159 | QString QuickTestResult::testCaseName() const | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | const QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 162 | return executed 192 times by 2 tests: d->testCaseName;return d->testCaseName;Executed by:
executed 192 times by 2 tests: return d->testCaseName;Executed by:
| 192 | ||||||||||||
| 163 | } | - | ||||||||||||
| 164 | - | |||||||||||||
| 165 | void QuickTestResult::setTestCaseName(const QString &name) | - | ||||||||||||
| 166 | { | - | ||||||||||||
| 167 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 168 | d->testCaseName = name; | - | ||||||||||||
| 169 | testCaseNameChanged(); | - | ||||||||||||
| 170 | } executed 64 times by 4 tests: end of blockExecuted by:
| 64 | ||||||||||||
| 171 | QString QuickTestResult::functionName() const | - | ||||||||||||
| 172 | { | - | ||||||||||||
| 173 | const QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 174 | return executed 192 times by 2 tests: d->functionName;return d->functionName;Executed by:
executed 192 times by 2 tests: return d->functionName;Executed by:
| 192 | ||||||||||||
| 175 | } | - | ||||||||||||
| 176 | - | |||||||||||||
| 177 | void QuickTestResult::setFunctionName(const QString &name) | - | ||||||||||||
| 178 | { | - | ||||||||||||
| 179 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 180 | if (!name.isEmpty()
| 32-188 | ||||||||||||
| 181 | if (d->testCaseName.isEmpty()
| 0-188 | ||||||||||||
| 182 | QTestResult::setCurrentTestFunction | - | ||||||||||||
| 183 | (d->intern(name).constData()); | - | ||||||||||||
| 184 | } never executed: else {end of block | 0 | ||||||||||||
| 185 | QString fullName = d->testCaseName + QLatin1String("::") + name; | - | ||||||||||||
| 186 | QTestResult::setCurrentTestFunction | - | ||||||||||||
| 187 | (d->intern(fullName).constData()); | - | ||||||||||||
| 188 | QTestPrivate::checkBlackLists(fullName.toUtf8().constData(), nullptr); | - | ||||||||||||
| 189 | } executed 188 times by 4 tests: end of blockExecuted by:
| 188 | ||||||||||||
| 190 | } else { | - | ||||||||||||
| 191 | QTestResult::setCurrentTestFunction(nullptr); | - | ||||||||||||
| 192 | } executed 32 times by 4 tests: end of blockExecuted by:
| 32 | ||||||||||||
| 193 | d->functionName = name; | - | ||||||||||||
| 194 | functionNameChanged(); | - | ||||||||||||
| 195 | } executed 220 times by 4 tests: end of blockExecuted by:
| 220 | ||||||||||||
| 196 | - | |||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | - | |||||||||||||
| 201 | - | |||||||||||||
| 202 | - | |||||||||||||
| 203 | QString QuickTestResult::dataTag() const | - | ||||||||||||
| 204 | { | - | ||||||||||||
| 205 | const char *tag = QTestResult::currentDataTag(); | - | ||||||||||||
| 206 | if (tag
| 0 | ||||||||||||
| 207 | return never executed: QString::fromUtf8(tag);return QString::fromUtf8(tag);never executed: return QString::fromUtf8(tag); | 0 | ||||||||||||
| 208 | else | - | ||||||||||||
| 209 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||
| 210 | } | - | ||||||||||||
| 211 | - | |||||||||||||
| 212 | void QuickTestResult::setDataTag(const QString &tag) | - | ||||||||||||
| 213 | { | - | ||||||||||||
| 214 | if (!tag.isEmpty()
| 192 | ||||||||||||
| 215 | QTestData *data = &(QTest::newRow(tag.toUtf8().constData())); | - | ||||||||||||
| 216 | QTestResult::setCurrentTestData(data); | - | ||||||||||||
| 217 | QTestPrivate::checkBlackLists((testCaseName() + QLatin1String("::") + functionName()).toUtf8().constData(), tag.toUtf8().constData()); | - | ||||||||||||
| 218 | dataTagChanged(); | - | ||||||||||||
| 219 | } executed 192 times by 2 tests: else {end of blockExecuted by:
| 192 | ||||||||||||
| 220 | QTestResult::setCurrentTestData(nullptr); | - | ||||||||||||
| 221 | } executed 192 times by 2 tests: end of blockExecuted by:
| 192 | ||||||||||||
| 222 | } | - | ||||||||||||
| 223 | bool QuickTestResult::isFailed() const | - | ||||||||||||
| 224 | { | - | ||||||||||||
| 225 | return executed 988 times by 4 tests: QTestResult::currentTestFailed();return QTestResult::currentTestFailed();Executed by:
executed 988 times by 4 tests: return QTestResult::currentTestFailed();Executed by:
| 988 | ||||||||||||
| 226 | } | - | ||||||||||||
| 227 | bool QuickTestResult::isSkipped() const | - | ||||||||||||
| 228 | { | - | ||||||||||||
| 229 | return executed 304 times by 3 tests: QTestResult::skipCurrentTest();return QTestResult::skipCurrentTest();Executed by:
executed 304 times by 3 tests: return QTestResult::skipCurrentTest();Executed by:
| 304 | ||||||||||||
| 230 | } | - | ||||||||||||
| 231 | - | |||||||||||||
| 232 | void QuickTestResult::setSkipped(bool skip) | - | ||||||||||||
| 233 | { | - | ||||||||||||
| 234 | QTestResult::setSkipCurrentTest(skip); | - | ||||||||||||
| 235 | if (!skip
| 0-156 | ||||||||||||
| 236 | QTestResult::setBlacklistCurrentTest(false); executed 156 times by 4 tests: QTestResult::setBlacklistCurrentTest(false);Executed by:
| 156 | ||||||||||||
| 237 | skippedChanged(); | - | ||||||||||||
| 238 | } executed 156 times by 4 tests: end of blockExecuted by:
| 156 | ||||||||||||
| 239 | int QuickTestResult::passCount() const | - | ||||||||||||
| 240 | { | - | ||||||||||||
| 241 | return never executed: QTestLog::passCount();return QTestLog::passCount();never executed: return QTestLog::passCount(); | 0 | ||||||||||||
| 242 | } | - | ||||||||||||
| 243 | int QuickTestResult::failCount() const | - | ||||||||||||
| 244 | { | - | ||||||||||||
| 245 | return never executed: QTestLog::failCount();return QTestLog::failCount();never executed: return QTestLog::failCount(); | 0 | ||||||||||||
| 246 | } | - | ||||||||||||
| 247 | int QuickTestResult::skipCount() const | - | ||||||||||||
| 248 | { | - | ||||||||||||
| 249 | return never executed: QTestLog::skipCount();return QTestLog::skipCount();never executed: return QTestLog::skipCount(); | 0 | ||||||||||||
| 250 | } | - | ||||||||||||
| 251 | - | |||||||||||||
| 252 | - | |||||||||||||
| 253 | - | |||||||||||||
| 254 | - | |||||||||||||
| 255 | - | |||||||||||||
| 256 | - | |||||||||||||
| 257 | QStringList QuickTestResult::functionsToRun() const | - | ||||||||||||
| 258 | { | - | ||||||||||||
| 259 | return executed 186 times by 4 tests: QTest::testFunctions;return QTest::testFunctions;Executed by:
executed 186 times by 4 tests: return QTest::testFunctions;Executed by:
| 186 | ||||||||||||
| 260 | } | - | ||||||||||||
| 261 | - | |||||||||||||
| 262 | - | |||||||||||||
| 263 | - | |||||||||||||
| 264 | - | |||||||||||||
| 265 | - | |||||||||||||
| 266 | - | |||||||||||||
| 267 | void QuickTestResult::reset() | - | ||||||||||||
| 268 | { | - | ||||||||||||
| 269 | if (!globalProgramName
| 0-32 | ||||||||||||
| 270 | QTestResult::reset(); never executed: QTestResult::reset(); | 0 | ||||||||||||
| 271 | } executed 32 times by 4 tests: end of blockExecuted by:
| 32 | ||||||||||||
| 272 | void QuickTestResult::startLogging() | - | ||||||||||||
| 273 | { | - | ||||||||||||
| 274 | - | |||||||||||||
| 275 | - | |||||||||||||
| 276 | if (loggingStarted
| 16 | ||||||||||||
| 277 | return; executed 16 times by 3 tests: return;Executed by:
| 16 | ||||||||||||
| 278 | QTestLog::startLogging(); | - | ||||||||||||
| 279 | loggingStarted = true; | - | ||||||||||||
| 280 | } executed 16 times by 4 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 281 | void QuickTestResult::stopLogging() | - | ||||||||||||
| 282 | { | - | ||||||||||||
| 283 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 284 | if (globalProgramName
| 0-32 | ||||||||||||
| 285 | return; executed 32 times by 4 tests: return;Executed by:
| 32 | ||||||||||||
| 286 | QTestResult::setCurrentTestObject(d->intern(d->testCaseName).constData()); | - | ||||||||||||
| 287 | QTestLog::stopLogging(); | - | ||||||||||||
| 288 | } never executed: end of block | 0 | ||||||||||||
| 289 | - | |||||||||||||
| 290 | void QuickTestResult::initTestTable() | - | ||||||||||||
| 291 | { | - | ||||||||||||
| 292 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 293 | delete d->table; | - | ||||||||||||
| 294 | d->table = new QTestTable; | - | ||||||||||||
| 295 | - | |||||||||||||
| 296 | - | |||||||||||||
| 297 | d->table->addColumn(qMetaTypeId<QString>(), "qmltest_dummy_data_column"); | - | ||||||||||||
| 298 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 299 | - | |||||||||||||
| 300 | void QuickTestResult::clearTestTable() | - | ||||||||||||
| 301 | { | - | ||||||||||||
| 302 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 303 | delete d->table; | - | ||||||||||||
| 304 | d->table = nullptr; | - | ||||||||||||
| 305 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 306 | - | |||||||||||||
| 307 | void QuickTestResult::finishTestData() | - | ||||||||||||
| 308 | { | - | ||||||||||||
| 309 | QTestResult::finishedCurrentTestData(); | - | ||||||||||||
| 310 | } executed 368 times by 4 tests: end of blockExecuted by:
| 368 | ||||||||||||
| 311 | - | |||||||||||||
| 312 | void QuickTestResult::finishTestDataCleanup() | - | ||||||||||||
| 313 | { | - | ||||||||||||
| 314 | QTestResult::finishedCurrentTestDataCleanup(); | - | ||||||||||||
| 315 | } executed 368 times by 4 tests: end of blockExecuted by:
| 368 | ||||||||||||
| 316 | - | |||||||||||||
| 317 | void QuickTestResult::finishTestFunction() | - | ||||||||||||
| 318 | { | - | ||||||||||||
| 319 | QTestResult::finishedCurrentTestFunction(); | - | ||||||||||||
| 320 | } executed 188 times by 4 tests: end of blockExecuted by:
| 188 | ||||||||||||
| 321 | - | |||||||||||||
| 322 | static QString qtestFixUrl(const QUrl &location) | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | if (location.isLocalFile()
| 0-1840 | ||||||||||||
| 325 | return executed 1840 times by 3 tests: QDir::toNativeSeparators(location.toLocalFile());return QDir::toNativeSeparators(location.toLocalFile());Executed by:
executed 1840 times by 3 tests: return QDir::toNativeSeparators(location.toLocalFile());Executed by:
| 1840 | ||||||||||||
| 326 | return never executed: location.toString();return location.toString();never executed: return location.toString(); | 0 | ||||||||||||
| 327 | } | - | ||||||||||||
| 328 | - | |||||||||||||
| 329 | void QuickTestResult::fail | - | ||||||||||||
| 330 | (const QString &message, const QUrl &location, int line) | - | ||||||||||||
| 331 | { | - | ||||||||||||
| 332 | QTestResult::addFailure(message.toLatin1().constData(), | - | ||||||||||||
| 333 | qtestFixUrl(location).toLatin1().constData(), line); | - | ||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||
| 335 | - | |||||||||||||
| 336 | bool QuickTestResult::verify | - | ||||||||||||
| 337 | (bool success, const QString &message, const QUrl &location, int line) | - | ||||||||||||
| 338 | { | - | ||||||||||||
| 339 | if (!success
| 0-426 | ||||||||||||
| 340 | return never executed: QTestResult::verifyreturn QTestResult::verify (success, "verify()", "", qtestFixUrl(location).toLatin1().constData(), line);never executed: return QTestResult::verify (success, "verify()", "", qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 341 | (success, "verify()", "", never executed: return QTestResult::verify (success, "verify()", "", qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 342 | qtestFixUrl(location).toLatin1().constData(), line); never executed: return QTestResult::verify (success, "verify()", "", qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 343 | } else { | - | ||||||||||||
| 344 | return executed 426 times by 2 tests: QTestResult::verifyreturn QTestResult::verify (success, message.toLatin1().constData(), "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
executed 426 times by 2 tests: return QTestResult::verify (success, message.toLatin1().constData(), "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 426 | ||||||||||||
| 345 | (success, message.toLatin1().constData(), "", executed 426 times by 2 tests: return QTestResult::verify (success, message.toLatin1().constData(), "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 426 | ||||||||||||
| 346 | qtestFixUrl(location).toLatin1().constData(), line); executed 426 times by 2 tests: return QTestResult::verify (success, message.toLatin1().constData(), "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 426 | ||||||||||||
| 347 | } | - | ||||||||||||
| 348 | } | - | ||||||||||||
| 349 | - | |||||||||||||
| 350 | bool QuickTestResult::fuzzyCompare(const QVariant &actual, const QVariant &expected, qreal delta) | - | ||||||||||||
| 351 | { | - | ||||||||||||
| 352 | if (actual.type() == QVariant::Color
| 0-66 | ||||||||||||
| 353 | if (!actual.canConvert(QVariant::Color)
| 0 | ||||||||||||
| 354 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 355 | - | |||||||||||||
| 356 | - | |||||||||||||
| 357 | QColor act; | - | ||||||||||||
| 358 | QColor exp; | - | ||||||||||||
| 359 | bool ok(false); | - | ||||||||||||
| 360 | - | |||||||||||||
| 361 | QVariant var = QQml_colorProvider()->colorFromString(actual.toString(), &ok); | - | ||||||||||||
| 362 | if (!ok
| 0 | ||||||||||||
| 363 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 364 | act = var.value<QColor>(); | - | ||||||||||||
| 365 | - | |||||||||||||
| 366 | QQml_colorProvider()->colorFromString(expected.toString(), &ok); | - | ||||||||||||
| 367 | if (!ok
| 0 | ||||||||||||
| 368 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 369 | exp = var.value<QColor>(); | - | ||||||||||||
| 370 | - | |||||||||||||
| 371 | return never executed: ( qAbs(act.red() - exp.red()) <= deltareturn ( qAbs(act.red() - exp.red()) <= delta && qAbs(act.green() - exp.green()) <= delta && qAbs(act.blue() - exp.blue()) <= delta && qAbs(act.alpha() - exp.alpha()) <= delta);never executed: return ( qAbs(act.red() - exp.red()) <= delta && qAbs(act.green() - exp.green()) <= delta && qAbs(act.blue() - exp.blue()) <= delta && qAbs(act.alpha() - exp.alpha()) <= delta); | 0 | ||||||||||||
| 372 | && qAbs(act.green() - exp.green()) <= delta never executed: return ( qAbs(act.red() - exp.red()) <= delta && qAbs(act.green() - exp.green()) <= delta && qAbs(act.blue() - exp.blue()) <= delta && qAbs(act.alpha() - exp.alpha()) <= delta); | 0 | ||||||||||||
| 373 | && qAbs(act.blue() - exp.blue()) <= delta never executed: return ( qAbs(act.red() - exp.red()) <= delta && qAbs(act.green() - exp.green()) <= delta && qAbs(act.blue() - exp.blue()) <= delta && qAbs(act.alpha() - exp.alpha()) <= delta); | 0 | ||||||||||||
| 374 | && qAbs(act.alpha() - exp.alpha()) <= delta); never executed: return ( qAbs(act.red() - exp.red()) <= delta && qAbs(act.green() - exp.green()) <= delta && qAbs(act.blue() - exp.blue()) <= delta && qAbs(act.alpha() - exp.alpha()) <= delta); | 0 | ||||||||||||
| 375 | } else { | - | ||||||||||||
| 376 | - | |||||||||||||
| 377 | bool ok = true; | - | ||||||||||||
| 378 | qreal act = actual.toFloat(&ok); | - | ||||||||||||
| 379 | if (!ok
| 0-66 | ||||||||||||
| 380 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 381 | - | |||||||||||||
| 382 | qreal exp = expected.toFloat(&ok); | - | ||||||||||||
| 383 | if (!ok
| 0-66 | ||||||||||||
| 384 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 385 | - | |||||||||||||
| 386 | return executed 66 times by 1 test: (qAbs(act - exp) <= delta);return (qAbs(act - exp) <= delta);Executed by:
executed 66 times by 1 test: return (qAbs(act - exp) <= delta);Executed by:
| 66 | ||||||||||||
| 387 | } | - | ||||||||||||
| 388 | - | |||||||||||||
| 389 | return dead code: false;return false;dead code: return false; | - | ||||||||||||
| 390 | } | - | ||||||||||||
| 391 | - | |||||||||||||
| 392 | void QuickTestResult::stringify(QQmlV4Function *args) | - | ||||||||||||
| 393 | { | - | ||||||||||||
| 394 | if (args->length() < 1
| 0-2684 | ||||||||||||
| 395 | args->setReturnValue(QV4::Encode::null()); never executed: args->setReturnValue(QV4::Encode::null()); | 0 | ||||||||||||
| 396 | - | |||||||||||||
| 397 | QV4::Scope scope(args->v4engine()); | - | ||||||||||||
| 398 | QV4::ScopedValue value(scope, (*args)[0]); | - | ||||||||||||
| 399 | - | |||||||||||||
| 400 | QString result; | - | ||||||||||||
| 401 | - | |||||||||||||
| 402 | - | |||||||||||||
| 403 | if (value->isObject()
| 532-2152 | ||||||||||||
| 404 | && !value->as<QV4::FunctionObject>()
| 0-532 | ||||||||||||
| 405 | && !value->as<QV4::ArrayObject>()
| 4-528 | ||||||||||||
| 406 | QVariant v = scope.engine->toVariant(value, QMetaType::UnknownType); | - | ||||||||||||
| 407 | if (v.isValid()
| 0-4 | ||||||||||||
| 408 | switch (v.type()) { | - | ||||||||||||
| 409 | case never executed: QVariant::Vector3D:case QVariant::Vector3D:never executed: case QVariant::Vector3D: | 0 | ||||||||||||
| 410 | { | - | ||||||||||||
| 411 | QVector3D v3d = v.value<QVector3D>(); | - | ||||||||||||
| 412 | result = QString::fromLatin1("Qt.vector3d(%1, %2, %3)").arg(v3d.x()).arg(v3d.y()).arg(v3d.z()); | - | ||||||||||||
| 413 | break; never executed: break; | 0 | ||||||||||||
| 414 | } | - | ||||||||||||
| 415 | case never executed: QVariant::Url:case QVariant::Url:never executed: case QVariant::Url: | 0 | ||||||||||||
| 416 | { | - | ||||||||||||
| 417 | QUrl url = v.value<QUrl>(); | - | ||||||||||||
| 418 | result = QString::fromLatin1("Qt.url(%1)").arg(url.toString()); | - | ||||||||||||
| 419 | break; never executed: break; | 0 | ||||||||||||
| 420 | } | - | ||||||||||||
| 421 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: case QVariant::DateTime: | 0 | ||||||||||||
| 422 | { | - | ||||||||||||
| 423 | QDateTime dt = v.value<QDateTime>(); | - | ||||||||||||
| 424 | result = dt.toString(Qt::ISODateWithMs); | - | ||||||||||||
| 425 | break; never executed: break; | 0 | ||||||||||||
| 426 | } | - | ||||||||||||
| 427 | default executed 4 times by 1 test: :default:Executed by:
executed 4 times by 1 test: default:Executed by:
| 4 | ||||||||||||
| 428 | result = v.toString(); | - | ||||||||||||
| 429 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 430 | - | |||||||||||||
| 431 | } else { | - | ||||||||||||
| 432 | result = QLatin1String("Object"); | - | ||||||||||||
| 433 | } never executed: end of block | 0 | ||||||||||||
| 434 | } | - | ||||||||||||
| 435 | - | |||||||||||||
| 436 | if (result.isEmpty()
| 4-2680 | ||||||||||||
| 437 | QString tmp = value->toQStringNoThrow(); | - | ||||||||||||
| 438 | if (value->as<QV4::ArrayObject>()
| 528-2152 | ||||||||||||
| 439 | result += QLatin1Char('[') + tmp + QLatin1Char(']'); executed 528 times by 1 test: result += QLatin1Char('[') + tmp + QLatin1Char(']');Executed by:
| 528 | ||||||||||||
| 440 | else | - | ||||||||||||
| 441 | result.append(tmp); executed 2152 times by 2 tests: result.append(tmp);Executed by:
| 2152 | ||||||||||||
| 442 | } | - | ||||||||||||
| 443 | - | |||||||||||||
| 444 | args->setReturnValue(QV4::Encode(args->v4engine()->newString(result))); | - | ||||||||||||
| 445 | } executed 2684 times by 2 tests: end of blockExecuted by:
| 2684 | ||||||||||||
| 446 | - | |||||||||||||
| 447 | bool QuickTestResult::compare | - | ||||||||||||
| 448 | (bool success, const QString &message, | - | ||||||||||||
| 449 | const QVariant &val1, const QVariant &val2, | - | ||||||||||||
| 450 | const QUrl &location, int line) | - | ||||||||||||
| 451 | { | - | ||||||||||||
| 452 | return executed 1408 times by 2 tests: QTestResult::comparereturn QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 453 | (success, message.toLocal8Bit().constData(), executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 454 | QTest::toString(val1.toString().toLatin1().constData()), executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 455 | QTest::toString(val2.toString().toLatin1().constData()), executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 456 | "", "", executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 457 | qtestFixUrl(location).toLatin1().constData(), line); executed 1408 times by 2 tests: return QTestResult::compare (success, message.toLocal8Bit().constData(), QTest::toString(val1.toString().toLatin1().constData()), QTest::toString(val2.toString().toLatin1().constData()), "", "", qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 1408 | ||||||||||||
| 458 | } | - | ||||||||||||
| 459 | - | |||||||||||||
| 460 | void QuickTestResult::skip | - | ||||||||||||
| 461 | (const QString &message, const QUrl &location, int line) | - | ||||||||||||
| 462 | { | - | ||||||||||||
| 463 | QTestResult::addSkip(message.toLatin1().constData(), | - | ||||||||||||
| 464 | qtestFixUrl(location).toLatin1().constData(), line); | - | ||||||||||||
| 465 | QTestResult::setSkipCurrentTest(true); | - | ||||||||||||
| 466 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 467 | - | |||||||||||||
| 468 | bool QuickTestResult::expectFail | - | ||||||||||||
| 469 | (const QString &tag, const QString &comment, const QUrl &location, int line) | - | ||||||||||||
| 470 | { | - | ||||||||||||
| 471 | return executed 4 times by 1 test: QTestResult::expectFailreturn QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line);Executed by:
executed 4 times by 1 test: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 4 | ||||||||||||
| 472 | (tag.toLatin1().constData(), executed 4 times by 1 test: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 4 | ||||||||||||
| 473 | QTest::toString(comment.toLatin1().constData()), executed 4 times by 1 test: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 4 | ||||||||||||
| 474 | QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line); executed 4 times by 1 test: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Abort, qtestFixUrl(location).toLatin1().constData(), line);Executed by:
| 4 | ||||||||||||
| 475 | } | - | ||||||||||||
| 476 | - | |||||||||||||
| 477 | bool QuickTestResult::expectFailContinue | - | ||||||||||||
| 478 | (const QString &tag, const QString &comment, const QUrl &location, int line) | - | ||||||||||||
| 479 | { | - | ||||||||||||
| 480 | return never executed: QTestResult::expectFailreturn QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line);never executed: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 481 | (tag.toLatin1().constData(), never executed: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 482 | QTest::toString(comment.toLatin1().constData()), never executed: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 483 | QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line); never executed: return QTestResult::expectFail (tag.toLatin1().constData(), QTest::toString(comment.toLatin1().constData()), QTest::Continue, qtestFixUrl(location).toLatin1().constData(), line); | 0 | ||||||||||||
| 484 | } | - | ||||||||||||
| 485 | - | |||||||||||||
| 486 | void QuickTestResult::warn(const QString &message, const QUrl &location, int line) | - | ||||||||||||
| 487 | { | - | ||||||||||||
| 488 | QTestLog::warn(message.toLatin1().constData(), qtestFixUrl(location).toLatin1().constData(), line); | - | ||||||||||||
| 489 | } never executed: end of block | 0 | ||||||||||||
| 490 | - | |||||||||||||
| 491 | void QuickTestResult::ignoreWarning(const QJSValue &message) | - | ||||||||||||
| 492 | { | - | ||||||||||||
| 493 | if (message.isRegExp()
| 0-16 | ||||||||||||
| 494 | - | |||||||||||||
| 495 | QRegExp re = message.toVariant().toRegExp(); | - | ||||||||||||
| 496 | QRegularExpression::PatternOptions opts = re.caseSensitivity() ==
| 0 | ||||||||||||
| 497 | Qt::CaseInsensitive
| 0 | ||||||||||||
| 498 | QRegularExpression re2(re.pattern(), opts); | - | ||||||||||||
| 499 | QTestLog::ignoreMessage(QtWarningMsg, re2); | - | ||||||||||||
| 500 | } never executed: else {end of block | 0 | ||||||||||||
| 501 | QTestLog::ignoreMessage(QtWarningMsg, message.toString().toLatin1()); | - | ||||||||||||
| 502 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||
| 503 | } | - | ||||||||||||
| 504 | - | |||||||||||||
| 505 | void QuickTestResult::wait(int ms) | - | ||||||||||||
| 506 | { | - | ||||||||||||
| 507 | QTest::qWait(ms); | - | ||||||||||||
| 508 | } executed 396 times by 3 tests: end of blockExecuted by:
| 396 | ||||||||||||
| 509 | - | |||||||||||||
| 510 | void QuickTestResult::sleep(int ms) | - | ||||||||||||
| 511 | { | - | ||||||||||||
| 512 | QTest::qSleep(ms); | - | ||||||||||||
| 513 | } never executed: end of block | 0 | ||||||||||||
| 514 | - | |||||||||||||
| 515 | bool QuickTestResult::waitForRendering(QQuickItem *item, int timeout) | - | ||||||||||||
| 516 | { | - | ||||||||||||
| 517 | ((item) ? static_cast<void>(0) : qt_assert("item", __FILE__, 655)); | - | ||||||||||||
| 518 | - | |||||||||||||
| 519 | return executed 56 times by 1 test: qWaitForSignal(item->window(), qFlagLocation("2""frameSwapped()" "\0" __FILE__ ":" "657"), timeout);return qWaitForSignal(item->window(), qFlagLocation("2""frameSwapped()" "\0" __FILE__ ":" "657"), timeout);Executed by:
executed 56 times by 1 test: return qWaitForSignal(item->window(), qFlagLocation("2""frameSwapped()" "\0" __FILE__ ":" "657"), timeout);Executed by:
| 56 | ||||||||||||
| 520 | } | - | ||||||||||||
| 521 | - | |||||||||||||
| 522 | void QuickTestResult::startMeasurement() | - | ||||||||||||
| 523 | { | - | ||||||||||||
| 524 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 525 | delete d->benchmarkData; | - | ||||||||||||
| 526 | d->benchmarkData = new QBenchmarkTestMethodData(); | - | ||||||||||||
| 527 | QBenchmarkTestMethodData::current = d->benchmarkData; | - | ||||||||||||
| 528 | d->iterCount = (
| 0 | ||||||||||||
| 529 | d->results.clear(); | - | ||||||||||||
| 530 | } never executed: end of block | 0 | ||||||||||||
| 531 | - | |||||||||||||
| 532 | void QuickTestResult::beginDataRun() | - | ||||||||||||
| 533 | { | - | ||||||||||||
| 534 | QBenchmarkTestMethodData::current->beginDataRun(); | - | ||||||||||||
| 535 | } never executed: end of block | 0 | ||||||||||||
| 536 | - | |||||||||||||
| 537 | void QuickTestResult::endDataRun() | - | ||||||||||||
| 538 | { | - | ||||||||||||
| 539 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 540 | QBenchmarkTestMethodData::current->endDataRun(); | - | ||||||||||||
| 541 | if (d->iterCount > -1
| 0 | ||||||||||||
| 542 | d->results.append(QBenchmarkTestMethodData::current->result); never executed: d->results.append(QBenchmarkTestMethodData::current->result); | 0 | ||||||||||||
| 543 | - | |||||||||||||
| 544 | if (QBenchmarkGlobalData::current->verboseOutput
| 0 | ||||||||||||
| 545 | if (d->iterCount == -1
| 0 | ||||||||||||
| 546 | QMessageLogger(__FILE__, 684, __PRETTY_FUNCTION__).debug() << "warmup stage result :" << QBenchmarkTestMethodData::current->result.value; | - | ||||||||||||
| 547 | } never executed: else {end of block | 0 | ||||||||||||
| 548 | QMessageLogger(__FILE__, 686, __PRETTY_FUNCTION__).debug() << "accumulation stage result:" << QBenchmarkTestMethodData::current->result.value; | - | ||||||||||||
| 549 | } never executed: end of block | 0 | ||||||||||||
| 550 | } | - | ||||||||||||
| 551 | } never executed: end of block | 0 | ||||||||||||
| 552 | - | |||||||||||||
| 553 | bool QuickTestResult::measurementAccepted() | - | ||||||||||||
| 554 | { | - | ||||||||||||
| 555 | return never executed: QBenchmarkTestMethodData::current->resultsAccepted();return QBenchmarkTestMethodData::current->resultsAccepted();never executed: return QBenchmarkTestMethodData::current->resultsAccepted(); | 0 | ||||||||||||
| 556 | } | - | ||||||||||||
| 557 | - | |||||||||||||
| 558 | static QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container) | - | ||||||||||||
| 559 | { | - | ||||||||||||
| 560 | const int count = container.count(); | - | ||||||||||||
| 561 | if (count == 0
| 0 | ||||||||||||
| 562 | return never executed: QBenchmarkResult();return QBenchmarkResult();never executed: return QBenchmarkResult(); | 0 | ||||||||||||
| 563 | - | |||||||||||||
| 564 | if (count == 1
| 0 | ||||||||||||
| 565 | return never executed: container.at(0);return container.at(0);never executed: return container.at(0); | 0 | ||||||||||||
| 566 | - | |||||||||||||
| 567 | QList<QBenchmarkResult> containerCopy = container; | - | ||||||||||||
| 568 | std::sort(containerCopy.begin(), containerCopy.end()); | - | ||||||||||||
| 569 | - | |||||||||||||
| 570 | const int middle = count / 2; | - | ||||||||||||
| 571 | - | |||||||||||||
| 572 | - | |||||||||||||
| 573 | return never executed: containerCopy.at(middle);return containerCopy.at(middle);never executed: return containerCopy.at(middle); | 0 | ||||||||||||
| 574 | } | - | ||||||||||||
| 575 | - | |||||||||||||
| 576 | bool QuickTestResult::needsMoreMeasurements() | - | ||||||||||||
| 577 | { | - | ||||||||||||
| 578 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 579 | ++(d->iterCount); | - | ||||||||||||
| 580 | if (d->iterCount < QBenchmarkGlobalData::current->adjustMedianIterationCount()
| 0 | ||||||||||||
| 581 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 582 | if (QBenchmarkTestMethodData::current->resultsAccepted()
| 0 | ||||||||||||
| 583 | QTestLog::addBenchmarkResult(qMedian(d->results)); never executed: QTestLog::addBenchmarkResult(qMedian(d->results)); | 0 | ||||||||||||
| 584 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 585 | } | - | ||||||||||||
| 586 | - | |||||||||||||
| 587 | void QuickTestResult::startBenchmark(RunMode runMode, const QString &tag) | - | ||||||||||||
| 588 | { | - | ||||||||||||
| 589 | QBenchmarkTestMethodData::current->result = QBenchmarkResult(); | - | ||||||||||||
| 590 | QBenchmarkTestMethodData::current->resultAccepted = false; | - | ||||||||||||
| 591 | QBenchmarkGlobalData::current->context.tag = tag; | - | ||||||||||||
| 592 | QBenchmarkGlobalData::current->context.slotName = functionName(); | - | ||||||||||||
| 593 | - | |||||||||||||
| 594 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 595 | delete d->benchmarkIter; | - | ||||||||||||
| 596 | d->benchmarkIter = new QTest::QBenchmarkIterationController | - | ||||||||||||
| 597 | (QTest::QBenchmarkIterationController::RunMode(runMode)); | - | ||||||||||||
| 598 | } never executed: end of block | 0 | ||||||||||||
| 599 | - | |||||||||||||
| 600 | bool QuickTestResult::isBenchmarkDone() const | - | ||||||||||||
| 601 | { | - | ||||||||||||
| 602 | const QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 603 | if (d->benchmarkIter
| 0 | ||||||||||||
| 604 | return never executed: d->benchmarkIter->isDone();return d->benchmarkIter->isDone();never executed: return d->benchmarkIter->isDone(); | 0 | ||||||||||||
| 605 | else | - | ||||||||||||
| 606 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 607 | } | - | ||||||||||||
| 608 | - | |||||||||||||
| 609 | void QuickTestResult::nextBenchmark() | - | ||||||||||||
| 610 | { | - | ||||||||||||
| 611 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 612 | if (d->benchmarkIter
| 0 | ||||||||||||
| 613 | d->benchmarkIter->next(); never executed: d->benchmarkIter->next(); | 0 | ||||||||||||
| 614 | } never executed: end of block | 0 | ||||||||||||
| 615 | - | |||||||||||||
| 616 | void QuickTestResult::stopBenchmark() | - | ||||||||||||
| 617 | { | - | ||||||||||||
| 618 | QuickTestResultPrivate * const d = d_func(); | - | ||||||||||||
| 619 | delete d->benchmarkIter; | - | ||||||||||||
| 620 | d->benchmarkIter = nullptr; | - | ||||||||||||
| 621 | } never executed: end of block | 0 | ||||||||||||
| 622 | - | |||||||||||||
| 623 | QObject *QuickTestResult::grabImage(QQuickItem *item) | - | ||||||||||||
| 624 | { | - | ||||||||||||
| 625 | if (item
| 0 | ||||||||||||
| 626 | QQuickWindow *window = item->window(); | - | ||||||||||||
| 627 | QImage grabbed = window->grabWindow(); | - | ||||||||||||
| 628 | QRectF rf(item->x(), item->y(), item->width(), item->height()); | - | ||||||||||||
| 629 | rf = rf.intersected(QRectF(0, 0, grabbed.width(), grabbed.height())); | - | ||||||||||||
| 630 | QObject *o = new QuickTestImageObject(grabbed.copy(rf.toAlignedRect())); | - | ||||||||||||
| 631 | QQmlEngine::setContextForObject(o, qmlContext(this)); | - | ||||||||||||
| 632 | return never executed: o;return o;never executed: return o; | 0 | ||||||||||||
| 633 | } | - | ||||||||||||
| 634 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||
| 635 | } | - | ||||||||||||
| 636 | - | |||||||||||||
| 637 | QObject *QuickTestResult::findChild(QObject *parent, const QString &objectName) | - | ||||||||||||
| 638 | { | - | ||||||||||||
| 639 | return never executed: parent ? parent->findChild<QObject*>(objectName) : 0;return parent ? parent->findChild<QObject*>(objectName) : 0;never executed: return parent ? parent->findChild<QObject*>(objectName) : 0; | 0 | ||||||||||||
| 640 | } | - | ||||||||||||
| 641 | - | |||||||||||||
| 642 | namespace QTest { | - | ||||||||||||
| 643 | void qtest_qParseArgs(int argc, char *argv[], bool qml); | - | ||||||||||||
| 644 | }; | - | ||||||||||||
| 645 | - | |||||||||||||
| 646 | void QuickTestResult::parseArgs(int argc, char *argv[]) | - | ||||||||||||
| 647 | { | - | ||||||||||||
| 648 | if (!QBenchmarkGlobalData::current
| 0-18 | ||||||||||||
| 649 | QBenchmarkGlobalData::current = &globalBenchmarkData; executed 18 times by 4 tests: QBenchmarkGlobalData::current = &globalBenchmarkData;Executed by:
| 18 | ||||||||||||
| 650 | QTest::qtest_qParseArgs(argc, argv, true); | - | ||||||||||||
| 651 | } executed 18 times by 4 tests: end of blockExecuted by:
| 18 | ||||||||||||
| 652 | - | |||||||||||||
| 653 | void QuickTestResult::setProgramName(const char *name) | - | ||||||||||||
| 654 | { | - | ||||||||||||
| 655 | if (name
| 18 | ||||||||||||
| 656 | QTestPrivate::parseBlackList(); | - | ||||||||||||
| 657 | QTestPrivate::parseGpuBlackList(); | - | ||||||||||||
| 658 | QTestResult::reset(); | - | ||||||||||||
| 659 | } executed 18 times by 4 tests: else if (!nameend of blockExecuted by:
| 0-18 | ||||||||||||
| 660 | QTestResult::setCurrentTestObject(globalProgramName); | - | ||||||||||||
| 661 | QTestLog::stopLogging(); | - | ||||||||||||
| 662 | QTestResult::setCurrentTestObject(nullptr); | - | ||||||||||||
| 663 | } executed 16 times by 4 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 664 | globalProgramName = name; | - | ||||||||||||
| 665 | QTestResult::setCurrentTestObject(globalProgramName); | - | ||||||||||||
| 666 | } executed 36 times by 4 tests: end of blockExecuted by:
| 36 | ||||||||||||
| 667 | - | |||||||||||||
| 668 | void QuickTestResult::setCurrentAppname(const char *appname) | - | ||||||||||||
| 669 | { | - | ||||||||||||
| 670 | QTestResult::setCurrentAppName(appname); | - | ||||||||||||
| 671 | } executed 18 times by 4 tests: end of blockExecuted by:
| 18 | ||||||||||||
| 672 | - | |||||||||||||
| 673 | int QuickTestResult::exitCode() | - | ||||||||||||
| 674 | { | - | ||||||||||||
| 675 | - | |||||||||||||
| 676 | - | |||||||||||||
| 677 | - | |||||||||||||
| 678 | - | |||||||||||||
| 679 | - | |||||||||||||
| 680 | return executed 14 times by 4 tests: qMin(QTestLog::failCount(), 127);return qMin(QTestLog::failCount(), 127);Executed by:
executed 14 times by 4 tests: return qMin(QTestLog::failCount(), 127);Executed by:
| 14 | ||||||||||||
| 681 | - | |||||||||||||
| 682 | } | - | ||||||||||||
| 683 | - | |||||||||||||
| 684 | - | |||||||||||||
| 685 | - | |||||||||||||
| Switch to Source code | Preprocessed file |