OpenCoverage

qqmlfile.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlfile.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 QtQml 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 "qqmlfile.h"-
41-
42#include <QtCore/qurl.h>-
43#include <QtCore/qobject.h>-
44#include <QtCore/qmetaobject.h>-
45#include <QtCore/qfile.h>-
46#include <private/qqmlengine_p.h>-
47#include <private/qqmlglobal_p.h>-
48-
49/*!-
50\class QQmlFile-
51\brief The QQmlFile class gives access to local and remote files.-
52-
53\internal-
54-
55Supports file:// and qrc:/ uris and whatever QNetworkAccessManager supports.-
56*/-
57-
58#define QQMLFILE_MAX_REDIRECT_RECURSION 16-
59-
60QT_BEGIN_NAMESPACE-
61-
62static char qrc_string[] = "qrc";-
63static char file_string[] = "file";-
64-
65#if defined(Q_OS_ANDROID)-
66static char assets_string[] = "assets";-
67#endif-
68-
69class QQmlFilePrivate;-
70-
71#if QT_CONFIG(qml_network)-
72class QQmlFileNetworkReply : public QObject-
73{-
74Q_OBJECT-
75public:-
76 QQmlFileNetworkReply(QQmlEngine *, QQmlFilePrivate *, const QUrl &);-
77 ~QQmlFileNetworkReply();-
78-
79signals:-
80 void finished();-
81 void downloadProgress(qint64, qint64);-
82-
83public slots:-
84 void networkFinished();-
85 void networkDownloadProgress(qint64, qint64);-
86-
87public:-
88 static int finishedIndex;-
89 static int downloadProgressIndex;-
90 static int networkFinishedIndex;-
91 static int networkDownloadProgressIndex;-
92 static int replyFinishedIndex;-
93 static int replyDownloadProgressIndex;-
94-
95private:-
96 QQmlEngine *m_engine;-
97 QQmlFilePrivate *m_p;-
98-
99 int m_redirectCount;-
100 QNetworkReply *m_reply;-
101};-
102#endif-
103-
104class QQmlFilePrivate-
105{-
106public:-
107 QQmlFilePrivate();-
108-
109 mutable QUrl url;-
110 mutable QString urlString;-
111-
112 QByteArray data;-
113-
114 enum Error {-
115 None, NotFound, CaseMismatch, Network-
116 };-
117-
118 Error error;-
119 QString errorString;-
120#if QT_CONFIG(qml_network)-
121 QQmlFileNetworkReply *reply;-
122#endif-
123};-
124-
125#if QT_CONFIG(qml_network)-
126int QQmlFileNetworkReply::finishedIndex = -1;-
127int QQmlFileNetworkReply::downloadProgressIndex = -1;-
128int QQmlFileNetworkReply::networkFinishedIndex = -1;-
129int QQmlFileNetworkReply::networkDownloadProgressIndex = -1;-
130int QQmlFileNetworkReply::replyFinishedIndex = -1;-
131int QQmlFileNetworkReply::replyDownloadProgressIndex = -1;-
132-
133QQmlFileNetworkReply::QQmlFileNetworkReply(QQmlEngine *e, QQmlFilePrivate *p, const QUrl &url)-
134: m_engine(e), m_p(p), m_redirectCount(0), m_reply(nullptr)-
135{-
136 if (finishedIndex == -1) {
finishedIndex == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
137 finishedIndex = QMetaMethod::fromSignal(&QQmlFileNetworkReply::finished).methodIndex();-
138 downloadProgressIndex = QMetaMethod::fromSignal(&QQmlFileNetworkReply::downloadProgress).methodIndex();-
139 const QMetaObject *smo = &staticMetaObject;-
140 networkFinishedIndex = smo->indexOfMethod("networkFinished()");-
141 networkDownloadProgressIndex = smo->indexOfMethod("networkDownloadProgress(qint64,qint64)");-
142-
143 replyFinishedIndex = QMetaMethod::fromSignal(&QNetworkReply::finished).methodIndex();-
144 replyDownloadProgressIndex = QMetaMethod::fromSignal(&QNetworkReply::downloadProgress).methodIndex();-
145 }
never executed: end of block
0
146 Q_ASSERT(finishedIndex != -1 && downloadProgressIndex != -1 &&-
147 networkFinishedIndex != -1 && networkDownloadProgressIndex != -1 &&-
148 replyFinishedIndex != -1 && replyDownloadProgressIndex != -1);-
149-
150 QNetworkRequest req(url);-
151 req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);-
152-
153 m_reply = m_engine->networkAccessManager()->get(req);-
154 QMetaObject::connect(m_reply, replyFinishedIndex, this, networkFinishedIndex);-
155 QMetaObject::connect(m_reply, replyDownloadProgressIndex, this, networkDownloadProgressIndex);-
156}
never executed: end of block
0
157-
158QQmlFileNetworkReply::~QQmlFileNetworkReply()-
159{-
160 if (m_reply) {
m_replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
161 m_reply->disconnect();-
162 m_reply->deleteLater();-
163 }
never executed: end of block
0
164}
never executed: end of block
0
165-
166void QQmlFileNetworkReply::networkFinished()-
167{-
168 ++m_redirectCount;-
169 if (m_redirectCount < QQMLFILE_MAX_REDIRECT_RECURSION) {
m_redirectCount < 16Description
TRUEnever evaluated
FALSEnever evaluated
0
170 QVariant redirect = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute);-
171 if (redirect.isValid()) {
redirect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
172 QUrl url = m_reply->url().resolved(redirect.toUrl());-
173-
174 QNetworkRequest req(url);-
175 req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);-
176-
177 m_reply->deleteLater();-
178 m_reply = m_engine->networkAccessManager()->get(req);-
179-
180 QMetaObject::connect(m_reply, replyFinishedIndex,-
181 this, networkFinishedIndex);-
182 QMetaObject::connect(m_reply, replyDownloadProgressIndex,-
183 this, networkDownloadProgressIndex);-
184-
185 return;
never executed: return;
0
186 }-
187 }
never executed: end of block
0
188-
189 if (m_reply->error()) {
m_reply->error()Description
TRUEnever evaluated
FALSEnever evaluated
0
190 m_p->errorString = m_reply->errorString();-
191 m_p->error = QQmlFilePrivate::Network;-
192 } else {
never executed: end of block
0
193 m_p->data = m_reply->readAll();-
194 }
never executed: end of block
0
195-
196 m_reply->deleteLater();-
197 m_reply = nullptr;-
198-
199 m_p->reply = nullptr;-
200 emit finished();-
201 delete this;-
202}
never executed: end of block
0
203-
204void QQmlFileNetworkReply::networkDownloadProgress(qint64 a, qint64 b)-
205{-
206 emit downloadProgress(a, b);-
207}
never executed: end of block
0
208#endif // qml_network-
209-
210QQmlFilePrivate::QQmlFilePrivate()-
211: error(None)-
212#if QT_CONFIG(qml_network)-
213, reply(nullptr)-
214#endif-
215{-
216}
never executed: end of block
0
217-
218QQmlFile::QQmlFile()-
219: d(new QQmlFilePrivate)-
220{-
221}
never executed: end of block
0
222-
223QQmlFile::QQmlFile(QQmlEngine *e, const QUrl &url)-
224: d(new QQmlFilePrivate)-
225{-
226 load(e, url);-
227}
never executed: end of block
0
228-
229QQmlFile::QQmlFile(QQmlEngine *e, const QString &url)-
230 : QQmlFile(e, QUrl(url))-
231{-
232}
never executed: end of block
0
233-
234QQmlFile::~QQmlFile()-
235{-
236#if QT_CONFIG(qml_network)-
237 delete d->reply;-
238#endif-
239 delete d;-
240 d = nullptr;-
241}
never executed: end of block
0
242-
243bool QQmlFile::isNull() const-
244{-
245 return status() == Null;
never executed: return status() == Null;
0
246}-
247-
248bool QQmlFile::isReady() const-
249{-
250 return status() == Ready;
never executed: return status() == Ready;
0
251}-
252-
253bool QQmlFile::isError() const-
254{-
255 return status() == Error;
never executed: return status() == Error;
0
256}-
257-
258bool QQmlFile::isLoading() const-
259{-
260 return status() == Loading;
never executed: return status() == Loading;
0
261}-
262-
263QUrl QQmlFile::url() const-
264{-
265 if (!d->urlString.isEmpty()) {
!d->urlString.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
266 d->url = QUrl(d->urlString);-
267 d->urlString = QString();-
268 }
never executed: end of block
0
269 return d->url;
never executed: return d->url;
0
270}-
271-
272QQmlFile::Status QQmlFile::status() const-
273{-
274 if (d->url.isEmpty() && d->urlString.isEmpty())
d->url.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
d->urlString.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
275 return Null;
never executed: return Null;
0
276#if QT_CONFIG(qml_network)-
277 else if (d->reply)
d->replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
278 return Loading;
never executed: return Loading;
0
279#endif-
280 else if (d->error != QQmlFilePrivate::None)
d->error != QQ...ePrivate::NoneDescription
TRUEnever evaluated
FALSEnever evaluated
0
281 return Error;
never executed: return Error;
0
282 else-
283 return Ready;
never executed: return Ready;
0
284}-
285-
286QString QQmlFile::error() const-
287{-
288 switch (d->error) {-
289 default:
never executed: default:
0
290 case QQmlFilePrivate::None:
never executed: case QQmlFilePrivate::None:
0
291 return QString();
never executed: return QString();
0
292 case QQmlFilePrivate::NotFound:
never executed: case QQmlFilePrivate::NotFound:
0
293 return QLatin1String("File not found");
never executed: return QLatin1String("File not found");
0
294 case QQmlFilePrivate::CaseMismatch:
never executed: case QQmlFilePrivate::CaseMismatch:
0
295 return QLatin1String("File name case mismatch");
never executed: return QLatin1String("File name case mismatch");
0
296 }-
297}-
298-
299qint64 QQmlFile::size() const-
300{-
301 return d->data.size();
never executed: return d->data.size();
0
302}-
303-
304const char *QQmlFile::data() const-
305{-
306 return d->data.constData();
never executed: return d->data.constData();
0
307}-
308-
309QByteArray QQmlFile::dataByteArray() const-
310{-
311 return d->data;
never executed: return d->data;
0
312}-
313-
314void QQmlFile::load(QQmlEngine *engine, const QUrl &url)-
315{-
316 Q_ASSERT(engine);-
317-
318 clear();-
319 d->url = url;-
320-
321 if (isLocalFile(url)) {
isLocalFile(url)Description
TRUEnever evaluated
FALSEnever evaluated
0
322 QString lf = urlToLocalFileOrQrc(url);-
323-
324 if (!QQml_isFileCaseCorrect(lf)) {
!QQml_isFileCaseCorrect(lf)Description
TRUEnever evaluated
FALSEnever evaluated
0
325 d->error = QQmlFilePrivate::CaseMismatch;-
326 return;
never executed: return;
0
327 }-
328-
329 QFile file(lf);-
330 if (file.open(QFile::ReadOnly)) {
file.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
0
331 d->data = file.readAll();-
332 } else {
never executed: end of block
0
333 d->error = QQmlFilePrivate::NotFound;-
334 }
never executed: end of block
0
335 } else {-
336#if QT_CONFIG(qml_network)-
337 d->reply = new QQmlFileNetworkReply(engine, d, url);-
338#else-
339 d->error = QQmlFilePrivate::NotFound;-
340#endif-
341 }
never executed: end of block
0
342}-
343-
344void QQmlFile::load(QQmlEngine *engine, const QString &url)-
345{-
346 Q_ASSERT(engine);-
347-
348 clear();-
349-
350 d->urlString = url;-
351-
352 if (isLocalFile(url)) {
isLocalFile(url)Description
TRUEnever evaluated
FALSEnever evaluated
0
353 QString lf = urlToLocalFileOrQrc(url);-
354-
355 if (!QQml_isFileCaseCorrect(lf)) {
!QQml_isFileCaseCorrect(lf)Description
TRUEnever evaluated
FALSEnever evaluated
0
356 d->error = QQmlFilePrivate::CaseMismatch;-
357 return;
never executed: return;
0
358 }-
359-
360 QFile file(lf);-
361 if (file.open(QFile::ReadOnly)) {
file.open(QFile::ReadOnly)Description
TRUEnever evaluated
FALSEnever evaluated
0
362 d->data = file.readAll();-
363 } else {
never executed: end of block
0
364 d->error = QQmlFilePrivate::NotFound;-
365 }
never executed: end of block
0
366 } else {-
367#if QT_CONFIG(qml_network)-
368 QUrl qurl(url);-
369 d->url = qurl;-
370 d->urlString = QString();-
371 d->reply = new QQmlFileNetworkReply(engine, d, qurl);-
372#else-
373 d->error = QQmlFilePrivate::NotFound;-
374#endif-
375 }
never executed: end of block
0
376}-
377-
378void QQmlFile::clear()-
379{-
380 d->url = QUrl();-
381 d->urlString = QString();-
382 d->data = QByteArray();-
383 d->error = QQmlFilePrivate::None;-
384}
never executed: end of block
0
385-
386void QQmlFile::clear(QObject *)-
387{-
388 clear();-
389}
never executed: end of block
0
390-
391#if QT_CONFIG(qml_network)-
392bool QQmlFile::connectFinished(QObject *object, const char *method)-
393{-
394 if (!d || !d->reply) {
!dDescription
TRUEnever evaluated
FALSEnever evaluated
!d->replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
395 qWarning("QQmlFile: connectFinished() called when not loading.");-
396 return false;
never executed: return false;
0
397 }-
398-
399 return QObject::connect(d->reply, SIGNAL(finished()),
never executed: return QObject::connect(d->reply, qFlagLocation("2""finished()" "\0" __FILE__ ":" "399"), object, method);
0
400 object, method);
never executed: return QObject::connect(d->reply, qFlagLocation("2""finished()" "\0" __FILE__ ":" "399"), object, method);
0
401}-
402-
403bool QQmlFile::connectFinished(QObject *object, int method)-
404{-
405 if (!d || !d->reply) {
!dDescription
TRUEnever evaluated
FALSEnever evaluated
!d->replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
406 qWarning("QQmlFile: connectFinished() called when not loading.");-
407 return false;
never executed: return false;
0
408 }-
409-
410 return QMetaObject::connect(d->reply, QQmlFileNetworkReply::finishedIndex,
never executed: return QMetaObject::connect(d->reply, QQmlFileNetworkReply::finishedIndex, object, method);
0
411 object, method);
never executed: return QMetaObject::connect(d->reply, QQmlFileNetworkReply::finishedIndex, object, method);
0
412}-
413-
414bool QQmlFile::connectDownloadProgress(QObject *object, const char *method)-
415{-
416 if (!d || !d->reply) {
!dDescription
TRUEnever evaluated
FALSEnever evaluated
!d->replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
417 qWarning("QQmlFile: connectDownloadProgress() called when not loading.");-
418 return false;
never executed: return false;
0
419 }-
420-
421 return QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
never executed: return QObject::connect(d->reply, qFlagLocation("2""downloadProgress(qint64,qint64)" "\0" __FILE__ ":" "421"), object, method);
0
422 object, method);
never executed: return QObject::connect(d->reply, qFlagLocation("2""downloadProgress(qint64,qint64)" "\0" __FILE__ ":" "421"), object, method);
0
423}-
424-
425bool QQmlFile::connectDownloadProgress(QObject *object, int method)-
426{-
427 if (!d || !d->reply) {
!dDescription
TRUEnever evaluated
FALSEnever evaluated
!d->replyDescription
TRUEnever evaluated
FALSEnever evaluated
0
428 qWarning("QQmlFile: connectDownloadProgress() called when not loading.");-
429 return false;
never executed: return false;
0
430 }-
431-
432 return QMetaObject::connect(d->reply, QQmlFileNetworkReply::downloadProgressIndex,
never executed: return QMetaObject::connect(d->reply, QQmlFileNetworkReply::downloadProgressIndex, object, method);
0
433 object, method);
never executed: return QMetaObject::connect(d->reply, QQmlFileNetworkReply::downloadProgressIndex, object, method);
0
434}-
435#endif-
436-
437/*!-
438Returns true if QQmlFile will open \a url synchronously.-
439-
440Synchronous urls have a qrc:/ or file:// scheme.-
441-
442\note On Android, urls with assets:/ scheme are also considered synchronous.-
443*/-
444bool QQmlFile::isSynchronous(const QUrl &url)-
445{-
446 QString scheme = url.scheme();-
447-
448 if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) ||
scheme.length() == 4Description
TRUEevaluated 14548 times by 126 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
FALSEevaluated 128 times by 8 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qrcqml
0 == scheme.co...seInsensitive)Description
TRUEevaluated 14440 times by 126 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
FALSEevaluated 108 times by 9 tests
Evaluated by:
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlmoduleplugin
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qquickanimatedimage
  • tst_qquickloader
  • tst_qquicktextedit
  • tst_qquicktextinput
108-14548
449 (scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) {
scheme.length() == 3Description
TRUEevaluated 44 times by 7 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmltranslation
  • tst_qrcqml
FALSEevaluated 192 times by 9 tests
Evaluated by:
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlmoduleplugin
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qquickanimatedimage
  • tst_qquickloader
  • tst_qquicktextedit
  • tst_qquicktextinput
0 == scheme.co...seInsensitive)Description
TRUEevaluated 44 times by 7 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmltranslation
  • tst_qrcqml
FALSEnever evaluated
0-192
450 return true;
executed 14484 times by 127 tests: return true;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
14484
451-
452#if defined(Q_OS_ANDROID)-
453 } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) {-
454 return true;-
455#endif-
456-
457 } else {-
458 return false;
executed 192 times by 9 tests: return false;
Executed by:
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlmoduleplugin
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qquickanimatedimage
  • tst_qquickloader
  • tst_qquicktextedit
  • tst_qquicktextinput
192
459 }-
460}-
461-
462/*!-
463Returns true if QQmlFile will open \a url synchronously.-
464-
465Synchronous urls have a qrc:/ or file:// scheme.-
466-
467\note On Android, urls with assets:/ scheme are also considered synchronous.-
468*/-
469bool QQmlFile::isSynchronous(const QString &url)-
470{-
471 if (url.length() < 5 /* qrc:/ */)
url.length() < 5Description
TRUEnever evaluated
FALSEnever evaluated
0
472 return false;
never executed: return false;
0
473-
474 QChar f = url[0];-
475-
476 if (f == QLatin1Char('f') || f == QLatin1Char('F')) {
f == QLatin1Char('f')Description
TRUEnever evaluated
FALSEnever evaluated
f == QLatin1Char('F')Description
TRUEnever evaluated
FALSEnever evaluated
0
477-
478 return url.length() >= 7 /* file:// */ &&
never executed: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
0
479 url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) &&
never executed: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
0
480 url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
never executed: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
0
481-
482 } else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) {
f == QLatin1Char('q')Description
TRUEnever evaluated
FALSEnever evaluated
f == QLatin1Char('Q')Description
TRUEnever evaluated
FALSEnever evaluated
0
483-
484 return url.length() >= 5 /* qrc:/ */ &&
never executed: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
0
485 url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) &&
never executed: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
0
486 url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
never executed: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
0
487-
488 }-
489-
490#if defined(Q_OS_ANDROID)-
491 else if (f == QLatin1Char('a') || f == QLatin1Char('A')) {-
492 return url.length() >= 8 /* assets:/ */ &&-
493 url.startsWith(QLatin1String(assets_string), Qt::CaseInsensitive) &&-
494 url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/');-
495-
496 }-
497#endif-
498-
499 return false;
never executed: return false;
0
500}-
501-
502/*!-
503Returns true if \a url is a local file that can be opened with QFile.-
504-
505Local file urls have either a qrc:/ or file:// scheme.-
506-
507\note On Android, urls with assets:/ scheme are also considered local files.-
508*/-
509bool QQmlFile::isLocalFile(const QUrl &url)-
510{-
511 QString scheme = url.scheme();-
512-
513 if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) ||
scheme.length() == 4Description
TRUEevaluated 15310 times by 125 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
FALSEevaluated 45745 times by 52 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • ...
0 == scheme.co...seInsensitive)Description
TRUEevaluated 15258 times by 125 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
FALSEevaluated 52 times by 8 tests
Evaluated by:
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlmoduleplugin
  • tst_qqmltypeloader
  • tst_qquickanimatedimage
  • tst_qquickloader
  • tst_qquicktextedit
  • tst_qquicktextinput
52-45745
514 (scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) {
scheme.length() == 3Description
TRUEevaluated 115 times by 8 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qrcqml
FALSEevaluated 45682 times by 47 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickdrag
  • tst_qquickdroparea
  • ...
0 == scheme.co...seInsensitive)Description
TRUEevaluated 115 times by 8 tests
Evaluated by:
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qrcqml
FALSEnever evaluated
0-45682
515 return true;
executed 15373 times by 126 tests: return true;
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
15373
516-
517#if defined(Q_OS_ANDROID)-
518 } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) {-
519 return true;-
520#endif-
521-
522 } else {-
523 return false;
executed 45682 times by 47 tests: return false;
Executed by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickdrag
  • tst_qquickdroparea
  • ...
45682
524 }-
525}-
526-
527/*!-
528Returns true if \a url is a local file that can be opened with QFile.-
529-
530Local file urls have either a qrc:/ or file:// scheme.-
531-
532\note On Android, urls with assets:/ scheme are also considered local files.-
533*/-
534bool QQmlFile::isLocalFile(const QString &url)-
535{-
536 if (url.length() < 5 /* qrc:/ */)
url.length() < 5Description
TRUEnever evaluated
FALSEevaluated 64061 times by 141 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
0-64061
537 return false;
never executed: return false;
0
538-
539 QChar f = url[0];-
540-
541 if (f == QLatin1Char('f') || f == QLatin1Char('F')) {
f == QLatin1Char('f')Description
TRUEevaluated 9581 times by 126 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
FALSEevaluated 54480 times by 140 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
f == QLatin1Char('F')Description
TRUEnever evaluated
FALSEevaluated 54480 times by 140 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
0-54480
542-
543 return url.length() >= 7 /* file:// */ &&
executed 9581 times by 126 tests: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
9581
544 url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) &&
executed 9581 times by 126 tests: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
9581
545 url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
executed 9581 times by 126 tests: return url.length() >= 7 && url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) && url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • tst_qqmllistreference
  • ...
9581
546-
547 } else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) {
f == QLatin1Char('q')Description
TRUEevaluated 8800 times by 138 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
FALSEevaluated 45680 times by 48 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickdrag
  • tst_qquickdroparea
  • ...
f == QLatin1Char('Q')Description
TRUEnever evaluated
FALSEevaluated 45680 times by 48 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickdrag
  • tst_qquickdroparea
  • ...
0-45680
548-
549 return url.length() >= 5 /* qrc:/ */ &&
executed 8800 times by 138 tests: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
8800
550 url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) &&
executed 8800 times by 138 tests: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
8800
551 url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
executed 8800 times by 138 tests: return url.length() >= 5 && url.startsWith(QLatin1String(qrc_string), Qt::CaseInsensitive) && url[3] == QLatin1Char(':') && url[4] == QLatin1Char('/');
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
8800
552-
553 }-
554#if defined(Q_OS_ANDROID)-
555 else if (f == QLatin1Char('a') || f == QLatin1Char('A')) {-
556 return url.length() >= 8 /* assets:/ */ &&-
557 url.startsWith(QLatin1String(assets_string), Qt::CaseInsensitive) &&-
558 url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/');-
559-
560 }-
561#endif-
562-
563 return false;
executed 45680 times by 48 tests: return false;
Executed by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmllistmodel
  • tst_qqmllocale
  • tst_qqmlmoduleplugin
  • tst_qqmlnativeconnector
  • tst_qqmlnotifier
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsettings
  • tst_qqmltimer
  • tst_qqmltypeloader
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimatedimage
  • tst_qquickanimations
  • tst_qquickapplication
  • tst_qquickborderimage
  • tst_qquickdrag
  • tst_qquickdroparea
  • ...
45680
564}-
565-
566/*!-
567If \a url is a local file returns a path suitable for passing to QFile. Otherwise returns an-
568empty string.-
569*/-
570QString QQmlFile::urlToLocalFileOrQrc(const QUrl& url)-
571{-
572 if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0) {
url.scheme().c...ensitive) == 0Description
TRUEevaluated 3507 times by 17 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlfile
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qquickfolderlistmodel
  • tst_qquickshortcut
  • tst_qrcqml
  • tst_sharedimage
FALSEevaluated 141998 times by 141 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
3507-141998
573 if (url.authority().isEmpty())
url.authority().isEmpty()Description
TRUEevaluated 3507 times by 17 tests
Evaluated by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlfile
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qquickfolderlistmodel
  • tst_qquickshortcut
  • tst_qrcqml
  • tst_sharedimage
FALSEnever evaluated
0-3507
574 return QLatin1Char(':') + url.path();
executed 3507 times by 17 tests: return QLatin1Char(':') + url.path();
Executed by:
  • tst_examples
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlcomponent
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlfile
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qqmltranslation
  • tst_qqmltypeloader
  • tst_qquickfolderlistmodel
  • tst_qquickshortcut
  • tst_qrcqml
  • tst_sharedimage
3507
575 return QString();
never executed: return QString();
0
576 }-
577-
578#if defined(Q_OS_ANDROID)-
579 else if (url.scheme().compare(QLatin1String("assets"), Qt::CaseInsensitive) == 0) {-
580 if (url.authority().isEmpty())-
581 return url.toString();-
582 return QString();-
583 }-
584#endif-
585-
586 return url.toLocalFile();
executed 141998 times by 141 tests: return url.toLocalFile();
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
141998
587}-
588-
589static QString toLocalFile(const QString &url)-
590{-
591 const QUrl file(url);-
592 if (!file.isLocalFile())
!file.isLocalFile()Description
TRUEevaluated 132784 times by 16 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlenginedebugservice
  • tst_qqmllocale
  • tst_qqmltypeloader
  • tst_qquickapplication
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_sharedimage
FALSEevaluated 466847 times by 127 tests
Evaluated by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • ...
132784-466847
593 return QString();
executed 132784 times by 16 tests: return QString();
Executed by:
  • tst_bindingdependencyapi
  • tst_parserstress
  • tst_qjsengine
  • tst_qqmlcomponent
  • tst_qqmlcontext
  • tst_qqmlenginedebugservice
  • tst_qqmllocale
  • tst_qqmltypeloader
  • tst_qquickapplication
  • tst_qquickdrag
  • tst_qquickdroparea
  • tst_qquickitem2
  • tst_qquickloader
  • tst_qquicktext
  • tst_qquicktextedit
  • tst_sharedimage
132784
594-
595 //XXX TODO: handle windows hostnames: "//servername/path/to/file.txt"-
596-
597 return file.toLocalFile();
executed 466847 times by 127 tests: return file.toLocalFile();
Executed by:
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • ...
466847
598}-
599-
600/*!-
601If \a url is a local file returns a path suitable for passing to QFile. Otherwise returns an-
602empty string.-
603*/-
604QString QQmlFile::urlToLocalFileOrQrc(const QString& url)-
605{-
606 if (url.startsWith(QLatin1String("qrc://"), Qt::CaseInsensitive)) {
url.startsWith...seInsensitive)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlfile
FALSEevaluated 622073 times by 140 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
2-622073
607 if (url.length() > 6)
url.length() > 6Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlfile
FALSEnever evaluated
0-2
608 return QLatin1Char(':') + url.midRef(6);
executed 2 times by 1 test: return QLatin1Char(':') + url.midRef(6);
Executed by:
  • tst_qqmlfile
2
609 return QString();
never executed: return QString();
0
610 }-
611-
612 if (url.startsWith(QLatin1String("qrc:"), Qt::CaseInsensitive)) {
url.startsWith...seInsensitive)Description
TRUEevaluated 22442 times by 138 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
FALSEevaluated 599631 times by 133 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
22442-599631
613 if (url.length() > 4)
url.length() > 4Description
TRUEevaluated 22442 times by 138 tests
Evaluated by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
FALSEnever evaluated
0-22442
614 return QLatin1Char(':') + url.midRef(4);
executed 22442 times by 138 tests: return QLatin1Char(':') + url.midRef(4);
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • tst_qqmlitemmodels
  • ...
22442
615 return QString();
never executed: return QString();
0
616 }-
617-
618#if defined(Q_OS_ANDROID)-
619 else if (url.startsWith(QLatin1String("assets:"), Qt::CaseInsensitive)) {-
620 return url;-
621 }-
622#endif-
623-
624 return toLocalFile(url);
executed 599631 times by 133 tests: return toLocalFile(url);
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
599631
625}-
626-
627QT_END_NAMESPACE-
628-
629#include "qqmlfile.moc"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0