OpenCoverage

qqmlfileselector.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlfileselector.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4typedef QHash<QQmlAbstractUrlInterceptor*, QQmlFileSelector*> interceptorSelectorMap;-
5namespace { namespace Q_QGS_interceptorInstances { typedef interceptorSelectorMap Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 24 times by 8 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 24 times by 8 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
}
executed 24 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 332 times by 8 tests: return &holder.value;
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
&holder.value;
executed 332 times by 8 tests: return &holder.value;
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
} } } static QGlobalStatic<interceptorSelectorMap, Q_QGS_interceptorInstances::innerFunction, Q_QGS_interceptorInstances::guard> interceptorInstances;;
0-332
6QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent)-
7 : QObject(*(new QQmlFileSelectorPrivate), parent)-
8{-
9 QQmlFileSelectorPrivate * const d = d_func();-
10 d->engine = engine;-
11 interceptorInstances()->insert(d->myInstance.data(), this);-
12 d->engine->setUrlInterceptor(d->myInstance.data());-
13}
executed 156 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
14-
15-
16-
17-
18QQmlFileSelector::~QQmlFileSelector()-
19{-
20 QQmlFileSelectorPrivate * const d = d_func();-
21 if (d->engine && QQmlFileSelector::get(d->engine) == this
QQmlFileSelect...ngine) == thisDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
FALSEnever evaluated
) {
0-8
22 d->engine->setUrlInterceptor(nullptr);-
23 d->engine = nullptr;-
24 }
executed 8 times by 2 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
8
25 interceptorInstances()->remove(d->myInstance.data());-
26}
executed 156 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
27-
28-
29-
30-
31-
32QFileSelector *QQmlFileSelector::selector() const noexcept-
33{-
34 const QQmlFileSelectorPrivate * const d = d_func();-
35 return
never executed: return d->selector;
d->selector;
never executed: return d->selector;
0
36}-
37-
38QQmlFileSelectorPrivate::QQmlFileSelectorPrivate()-
39{-
40 QQmlFileSelector * const q = q_func();-
41 ownSelector = true;-
42 selector = new QFileSelector(q);-
43 myInstance.reset(new QQmlFileSelectorInterceptor(this));-
44}
executed 156 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
45-
46QQmlFileSelectorPrivate::~QQmlFileSelectorPrivate()-
47{-
48 if (ownSelector
ownSelectorDescription
TRUEevaluated 156 times by 8 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
FALSEnever evaluated
)
0-156
49 delete selector;
executed 156 times by 8 tests: delete selector;
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
50}
executed 156 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
51-
52-
53-
54-
55-
56-
57-
58void QQmlFileSelector::setSelector(QFileSelector *selector)-
59{-
60 QQmlFileSelectorPrivate * const d = d_func();-
61 if (selector
selectorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
62 if (d->ownSelector
d->ownSelectorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
63 delete d->selector;-
64 d->ownSelector = false;-
65 }
never executed: end of block
0
66 d->selector = selector;-
67 }
never executed: end of block
else {
0
68 if (!d->ownSelector
!d->ownSelectorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
69 d->ownSelector = true;-
70 d->selector = new QFileSelector(this);-
71 }
never executed: end of block
0
72 }
never executed: end of block
0
73}-
74-
75-
76-
77-
78-
79-
80void QQmlFileSelector::setExtraSelectors(QStringList &strings)-
81{-
82 QQmlFileSelectorPrivate * const d = d_func();-
83 d->selector->setExtraSelectors(strings);-
84}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
10
85-
86-
87-
88-
89-
90-
91-
92void QQmlFileSelector::setExtraSelectors(const QStringList &strings)-
93{-
94 QQmlFileSelectorPrivate * const d = d_func();-
95 d->selector->setExtraSelectors(strings);-
96}
never executed: end of block
0
97-
98-
99-
100-
101QQmlFileSelector* QQmlFileSelector::get(QQmlEngine* engine)-
102{-
103-
104 QQmlAbstractUrlInterceptor* current = engine->urlInterceptor();-
105 if (current
currentDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
FALSEnever evaluated
&& interceptorInstances()->contains(current)
interceptorIns...tains(current)Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
FALSEnever evaluated
)
0-10
106 return
executed 10 times by 2 tests: return interceptorInstances()->value(current);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
interceptorInstances()->value(current);
executed 10 times by 2 tests: return interceptorInstances()->value(current);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlfileselector
10
107 return
never executed: return nullptr;
nullptr;
never executed: return nullptr;
0
108}-
109-
110-
111-
112-
113QQmlFileSelectorInterceptor::QQmlFileSelectorInterceptor(QQmlFileSelectorPrivate* pd)-
114 : d(pd)-
115{-
116}
executed 156 times by 8 tests: end of block
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
156
117-
118-
119-
120-
121QUrl QQmlFileSelectorInterceptor::intercept(const QUrl &path, DataType type)-
122{-
123 if ( type == QQmlAbstractUrlInterceptor::QmldirFile
type == QQmlAb...or::QmldirFileDescription
TRUEevaluated 3276 times by 8 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
FALSEevaluated 190 times by 8 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
)
190-3276
124 return
executed 3276 times by 8 tests: return path;
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
path;
executed 3276 times by 8 tests: return path;
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
3276
125 return
executed 190 times by 8 tests: return d->selector->select(path);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
d->selector->select(path);
executed 190 times by 8 tests: return d->selector->select(path);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmldebugjs
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlnativeconnector
  • tst_qquickshortcut
  • tst_sharedimage
190
126}-
127-
128-
129-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0