OpenCoverage

qqmlapplicationengine.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate(QQmlEngine *e)-
5 : QQmlEnginePrivate(e)-
6{-
7}
executed 148 times by 7 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
148
8-
9QQmlApplicationEnginePrivate::~QQmlApplicationEnginePrivate()-
10{-
11}-
12-
13void QQmlApplicationEnginePrivate::cleanUp()-
14{-
15 QQmlApplicationEngine * const q = q_func();-
16 for (auto obj : qAsConst(objects))-
17 obj->disconnect(q);
executed 178 times by 5 tests: obj->disconnect(q);
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
178
18-
19 qDeleteAll(objects);-
20-
21 qDeleteAll(translators);-
22-
23}
executed 148 times by 7 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
148
24-
25void QQmlApplicationEnginePrivate::init()-
26{-
27 QQmlApplicationEngine * const q = q_func();-
28 q->connect(q, qFlagLocation("2""quit()" "\0" __FILE__ ":" "73"), QCoreApplication::instance(), qFlagLocation("1""quit()" "\0" __FILE__ ":" "73"));-
29 q->connect(q, &QQmlApplicationEngine::exit, QCoreApplication::instance(), &QCoreApplication::exit);-
30-
31 QTranslator* qtTranslator = new QTranslator;-
32 if (qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath))
qtTranslator->...slationsPath))Description
TRUEnever evaluated
FALSEevaluated 148 times by 7 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
)
0-148
33 QCoreApplication::installTranslator(qtTranslator);
never executed: QCoreApplication::installTranslator(qtTranslator);
0
34 translators << qtTranslator;-
35-
36 new QQmlFileSelector(q,q);-
37 QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true));-
38}
executed 148 times by 7 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
148
39-
40void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile)-
41{-
42-
43 if (rootFile.scheme() != QLatin1String("file")
rootFile.schem...String("file")Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_sharedimage
FALSEevaluated 162 times by 4 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
&& rootFile.scheme() != QLatin1String("qrc")
rootFile.schem...1String("qrc")Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlapplicationengine
)
2-162
44 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_sharedimage
16
45-
46 QFileInfo fi(rootFile.toLocalFile());-
47-
48 QTranslator *translator = new QTranslator;-
49 if (translator->load(QLatin1String("qml_") + QLocale::system().name(), fi.path() + QLatin1String("/i18n"))
translator->lo...ring("/i18n"))Description
TRUEnever evaluated
FALSEevaluated 164 times by 4 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
) {
0-164
50 QCoreApplication::installTranslator(translator);-
51 translators << translator;-
52 }
never executed: end of block
else {
0
53 delete translator;-
54 }
executed 164 times by 4 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
164
55-
56-
57-
58}-
59-
60void QQmlApplicationEnginePrivate::startLoad(const QUrl &url, const QByteArray &data, bool dataFlag)-
61{-
62 QQmlApplicationEngine * const q = q_func();-
63-
64 loadTranslations(url);-
65 QQmlComponent *c = new QQmlComponent(q, q);-
66-
67 if (dataFlag
dataFlagDescription
TRUEevaluated 20 times by 3 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_sharedimage
FALSEevaluated 160 times by 4 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
)
20-160
68 c->setData(data,url);
executed 20 times by 3 tests: c->setData(data,url);
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_sharedimage
20
69 else-
70 c->loadUrl(url);
executed 160 times by 4 tests: c->loadUrl(url);
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
160
71-
72 if (!c->isLoading()
!c->isLoading()Description
TRUEevaluated 180 times by 5 tests
Evaluated by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
FALSEnever evaluated
) {
0-180
73 finishLoad(c);-
74 return;
executed 180 times by 5 tests: return;
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
180
75 }-
76 QObject::connect(c, &QQmlComponent::statusChanged, q, [this, c] { this->finishLoad(c); }
never executed: end of block
)
;
0
77}
never executed: end of block
0
78-
79void QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *c)-
80{-
81 QQmlApplicationEngine * const q = q_func();-
82 switch (c->status()) {-
83 case
never executed: case QQmlComponent::Error:
QQmlComponent::Error:
never executed: case QQmlComponent::Error:
0
84 QMessageLogger(__FILE__, 129, __PRETTY_FUNCTION__).warning() << "QQmlApplicationEngine failed to load component";-
85 QMessageLogger(__FILE__, 130, __PRETTY_FUNCTION__).warning() << QtPrivate::asString(c->errorString()).toLocal8Bit().constData();-
86 q->objectCreated(nullptr, c->url());-
87 break;
never executed: break;
0
88 case
executed 180 times by 5 tests: case QQmlComponent::Ready:
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
QQmlComponent::Ready:
executed 180 times by 5 tests: case QQmlComponent::Ready:
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
{
180
89 auto newObj = c->create();-
90 objects << newObj;-
91 QObject::connect(newObj, &QObject::destroyed, q, [&](QObject *obj) { objects.removeAll(obj); }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlapplicationengine
)
;
2
92 q->objectCreated(objects.constLast(), c->url());-
93 }-
94 break;
executed 180 times by 5 tests: break;
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
180
95 case
never executed: case QQmlComponent::Loading:
QQmlComponent::Loading:
never executed: case QQmlComponent::Loading:
0
96 case
never executed: case QQmlComponent::Null:
QQmlComponent::Null:
never executed: case QQmlComponent::Null:
0
97 return;
never executed: return;
0
98 }-
99-
100 c->deleteLater();-
101}
executed 180 times by 5 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
180
102QQmlApplicationEngine::QQmlApplicationEngine(QObject *parent)-
103: QQmlEngine(*(new QQmlApplicationEnginePrivate(this)), parent)-
104{-
105 QQmlApplicationEnginePrivate * const d = d_func();-
106 d->init();-
107 QJSEnginePrivate::addToDebugServer(this);-
108}
executed 148 times by 7 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
148
109-
110-
111-
112-
113-
114QQmlApplicationEngine::QQmlApplicationEngine(const QUrl &url, QObject *parent)-
115 : QQmlApplicationEngine(parent)-
116{-
117 load(url);-
118}
executed 14 times by 3 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_qquickshortcut
14
119QQmlApplicationEngine::QQmlApplicationEngine(const QString &filePath, QObject *parent)-
120 : QQmlApplicationEngine(QUrl::fromUserInput(filePath, QLatin1String("."), QUrl::AssumeLocalFile), parent)-
121{-
122}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlapplicationengine
2
123-
124-
125-
126-
127QQmlApplicationEngine::~QQmlApplicationEngine()-
128{-
129 QQmlApplicationEnginePrivate * const d = d_func();-
130 QJSEnginePrivate::removeFromDebugServer(this);-
131 d->cleanUp();-
132}
executed 148 times by 7 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
148
133void QQmlApplicationEngine::load(const QUrl &url)-
134{-
135 QQmlApplicationEnginePrivate * const d = d_func();-
136 d->startLoad(url);-
137}
executed 158 times by 4 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlimport
  • tst_qquickshortcut
158
138void QQmlApplicationEngine::load(const QString &filePath)-
139{-
140 QQmlApplicationEnginePrivate * const d = d_func();-
141 d->startLoad(QUrl::fromUserInput(filePath, QLatin1String("."), QUrl::AssumeLocalFile));-
142}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlapplicationengine
2
143void QQmlApplicationEngine::loadData(const QByteArray &data, const QUrl &url)-
144{-
145 QQmlApplicationEnginePrivate * const d = d_func();-
146 d->startLoad(url, data, true);-
147}
executed 20 times by 3 tests: end of block
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_sharedimage
20
148QList<QObject *> QQmlApplicationEngine::rootObjects() const-
149{-
150 const QQmlApplicationEnginePrivate * const d = d_func();-
151 return
executed 232 times by 4 tests: return d->objects;
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
d->objects;
executed 232 times by 4 tests: return d->objects;
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
232
152}-
153-
154-
155-
156-
157-
158-
159QList<QObject *> QQmlApplicationEngine::rootObjects()-
160{-
161 return
executed 232 times by 4 tests: return qAsConst(*this).rootObjects();
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
qAsConst(*this).rootObjects();
executed 232 times by 4 tests: return qAsConst(*this).rootObjects();
Executed by:
  • tst_qqmlapplicationengine
  • tst_qqmlimport
  • tst_qquickshortcut
  • tst_sharedimage
232
162}-
163-
164-
165-
166-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0