qstatemachine.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qstatemachine.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15struct CalculationCache {-
16 struct TransitionInfo {-
17 QList<QAbstractState*> effectiveTargetStates;-
18 QSet<QAbstractState*> exitSet;-
19 QAbstractState *transitionDomain;-
20-
21 bool effectiveTargetStatesIsKnown: 1;-
22 bool exitSetIsKnown : 1;-
23 bool transitionDomainIsKnown : 1;-
24-
25 TransitionInfo()-
26 : transitionDomain(0)-
27 , effectiveTargetStatesIsKnown(false)-
28 , exitSetIsKnown(false)-
29 , transitionDomainIsKnown(false)-
30 {}
executed 1394 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1394
31 };-
32-
33 typedef QHash<QAbstractTransition *, TransitionInfo> TransitionInfoCache;-
34 TransitionInfoCache cache;-
35-
36 bool effectiveTargetStates(QAbstractTransition *t, QList<QAbstractState *> *targets) const-
37 {-
38 ((!(targets)) ? qt_assert("targets",__FILE__,211) : qt_noop());-
39-
40 TransitionInfoCache::const_iterator cacheIt = cache.find(t);-
41 if (cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEevaluated 1394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1237 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| !cacheIt->effectiveTargetStatesIsKnown
!cacheIt->effe...tStatesIsKnownDescription
TRUEnever evaluated
FALSEevaluated 1237 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-1394
42 return
executed 1394 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 1394 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
1394
43-
44 *targets = cacheIt->effectiveTargetStates;-
45 return
executed 1237 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
true;
executed 1237 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
1237
46 }-
47-
48 void insert(QAbstractTransition *t, const QList<QAbstractState *> &targets)-
49 {-
50 TransitionInfoCache::iterator cacheIt = cache.find(t);-
51 TransitionInfo &ti = cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEevaluated 1394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
0-1394
52 ? *cache.insert(t, TransitionInfo())-
53 : *cacheIt;-
54-
55 ((!(!ti.effectiveTargetStatesIsKnown)) ? qt_assert("!ti.effectiveTargetStatesIsKnown",__FILE__,228) : qt_noop());-
56 ti.effectiveTargetStates = targets;-
57 ti.effectiveTargetStatesIsKnown = true;-
58 }
executed 1394 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1394
59-
60 bool exitSet(QAbstractTransition *t, QSet<QAbstractState *> *exits) const-
61 {-
62 ((!(exits)) ? qt_assert("exits",__FILE__,235) : qt_noop());-
63-
64 TransitionInfoCache::const_iterator cacheIt = cache.find(t);-
65 if (cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEevaluated 1241 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
|| !cacheIt->exitSetIsKnown
!cacheIt->exitSetIsKnownDescription
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-1241
66 return
executed 1241 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 1241 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
1241
67-
68 *exits = cacheIt->exitSet;-
69 return
executed 19 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 19 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
19
70 }-
71-
72 void insert(QAbstractTransition *t, const QSet<QAbstractState *> &exits)-
73 {-
74 TransitionInfoCache::iterator cacheIt = cache.find(t);-
75 TransitionInfo &ti = cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEnever evaluated
FALSEevaluated 1241 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
0-1241
76 ? *cache.insert(t, TransitionInfo())-
77 : *cacheIt;-
78-
79 ((!(!ti.exitSetIsKnown)) ? qt_assert("!ti.exitSetIsKnown",__FILE__,252) : qt_noop());-
80 ti.exitSet = exits;-
81 ti.exitSetIsKnown = true;-
82 }
executed 1241 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1241
83-
84 bool transitionDomain(QAbstractTransition *t, QAbstractState **domain) const-
85 {-
86 ((!(domain)) ? qt_assert("domain",__FILE__,259) : qt_noop());-
87-
88 TransitionInfoCache::const_iterator cacheIt = cache.find(t);-
89 if (cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEnever evaluated
FALSEevaluated 2620 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| !cacheIt->transitionDomainIsKnown
!cacheIt->tran...nDomainIsKnownDescription
TRUEevaluated 1389 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1231 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-2620
90 return
executed 1389 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 1389 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
1389
91-
92 *domain = cacheIt->transitionDomain;-
93 return
executed 1231 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
true;
executed 1231 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
1231
94 }-
95-
96 void insert(QAbstractTransition *t, QAbstractState *domain)-
97 {-
98 TransitionInfoCache::iterator cacheIt = cache.find(t);-
99 TransitionInfo &ti = cacheIt == cache.end()
cacheIt == cache.end()Description
TRUEnever evaluated
FALSEevaluated 1387 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
0-1387
100 ? *cache.insert(t, TransitionInfo())-
101 : *cacheIt;-
102-
103 ((!(!ti.transitionDomainIsKnown)) ? qt_assert("!ti.transitionDomainIsKnown",__FILE__,276) : qt_noop());-
104 ti.transitionDomain = domain;-
105 ti.transitionDomainIsKnown = true;-
106 }
executed 1387 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1387
107};-
108static inline bool isDescendant(const QAbstractState *state1, const QAbstractState *state2)-
109{-
110 ((!(state1 != 0)) ? qt_assert("state1 != 0",__FILE__,291) : qt_noop());-
111-
112 for (QAbstractState *it = state1->parentState(); it != 0
it != 0Description
TRUEevaluated 9869 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1681 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; it = it->parentState()) {
1681-9869
113 if (it == state2
it == state2Description
TRUEevaluated 3496 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 6373 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
3496-6373
114 return
executed 3496 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
true;
executed 3496 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
3496
115 }
executed 6373 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6373
116-
117 return
executed 1681 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 1681 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
1681
118}-
119-
120static bool containsDecendantOf(const QSet<QAbstractState *> &states, const QAbstractState *node)-
121{-
122 for (QAbstractState *s : states)-
123 if (isDescendant(s, node)
isDescendant(s, node)Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 354 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
36-354
124 return
executed 36 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 36 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
36
125-
126 return
executed 56 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 56 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
56
127}-
128-
129static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor)-
130{-
131 int depth = 0;-
132 for (const QAbstractState *it = state; it != 0
it != 0Description
TRUEevaluated 62 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
; it = it->parentState()) {
0-62
133 if (it == ancestor
it == ancestorDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
24-38
134 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QStateMachine
24
135 ++depth;-
136 }
executed 38 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
38
137 return
executed 24 times by 1 test: return depth;
Executed by:
  • tst_QStateMachine
depth;
executed 24 times by 1 test: return depth;
Executed by:
  • tst_QStateMachine
24
138}-
139static QVector<QState*> getProperAncestors(const QAbstractState *state, const QAbstractState *upperBound)-
140{-
141 ((!(state != 0)) ? qt_assert("state != 0",__FILE__,334) : qt_noop());-
142 QVector<QState*> result;-
143 result.reserve(16);-
144 for (QState *it = state->parentState(); it
itDescription
TRUEevaluated 8455 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 5489 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& it != upperBound
it != upperBoundDescription
TRUEevaluated 6987 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1468 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; it = it->parentState()) {
1468-8455
145 result.append(it);-
146 }
executed 6987 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6987
147 return
executed 6957 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
result;
executed 6957 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
6957
148}-
149static QList<QAbstractState *> getEffectiveTargetStates(QAbstractTransition *transition, CalculationCache *cache)-
150{-
151 ((!(cache)) ? qt_assert("cache",__FILE__,363) : qt_noop());-
152-
153 QList<QAbstractState *> targetsList;-
154 if (cache->effectiveTargetStates(transition, &targetsList)
cache->effecti... &targetsList)Description
TRUEevaluated 1237 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1237-1394
155 return
executed 1237 times by 2 tests: return targetsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
targetsList;
executed 1237 times by 2 tests: return targetsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
1237
156-
157 QSet<QAbstractState *> targets;-
158 const auto targetStates = transition->targetStates();-
159 for (QAbstractState *s : targetStates) {-
160 if (QHistoryState *historyState = QStateMachinePrivate::toHistoryState(s)
QHistoryState ...istoryState(s)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1381 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
9-1381
161 QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(historyState)->configuration;-
162 if (!historyConfiguration.isEmpty()
!historyConfig...tion.isEmpty()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
4-5
163-
164 targets.unite(historyConfiguration.toSet());-
165 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else if (QAbstractTransition *defaultTransition = historyState->defaultTransition()
QAbstractTrans...ltTransition()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-5
166-
167 targets.unite(defaultTransition->targetStates().toSet());-
168 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
3
169-
170 QStateMachinePrivate *m = QStateMachinePrivate::get(historyState->machine());-
171 m->setError(QStateMachine::NoDefaultStateInHistoryStateError, historyState);-
172 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
173 } else {-
174 targets.insert(s);-
175 }
executed 1381 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1381
176 }-
177-
178 targetsList = targets.toList();-
179 cache->insert(transition, targetsList);-
180 return
executed 1394 times by 2 tests: return targetsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
targetsList;
executed 1394 times by 2 tests: return targetsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
1394
181}-
182-
183QStateMachinePrivate::QStateMachinePrivate()-
184{-
185 isMachine = true;-
186-
187 state = NotRunning;-
188 processing = false;-
189 processingScheduled = false;-
190 stop = false;-
191 stopProcessingReason = EventQueueEmpty;-
192 error = QStateMachine::NoError;-
193 globalRestorePolicy = QState::DontRestoreProperties;-
194 signalEventGenerator = 0;-
195-
196 animated = true;-
197-
198}
executed 145 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
145
199-
200QStateMachinePrivate::~QStateMachinePrivate()-
201{-
202 qDeleteAll(internalEventQueue);-
203 qDeleteAll(externalEventQueue);-
204-
205 for (QHash<int, DelayedEvent>::const_iterator it = delayedEvents.begin(), eit = delayedEvents.end(); it != eit
it != eitDescription
TRUEnever evaluated
FALSEevaluated 145 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
0-145
206 delete it.value().event;-
207 }
never executed: end of block
0
208}
executed 145 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
145
209-
210QState *QStateMachinePrivate::rootState() const-
211{-
212 return
executed 5261 times by 2 tests: return const_cast<QStateMachine*>(q_func());
Executed by:
  • tst_QState
  • tst_QStateMachine
const_cast<QStateMachine*>(q_func());
executed 5261 times by 2 tests: return const_cast<QStateMachine*>(q_func());
Executed by:
  • tst_QState
  • tst_QStateMachine
5261
213}-
214-
215static QEvent *cloneEvent(QEvent *e)-
216{-
217 switch (e->type()) {-
218 case
never executed: case QEvent::None:
QEvent::None:
never executed: case QEvent::None:
0
219 return
never executed: return new QEvent(*e);
new QEvent(*e);
never executed: return new QEvent(*e);
0
220 case
executed 7 times by 1 test: case QEvent::Timer:
Executed by:
  • tst_QStateMachine
QEvent::Timer:
executed 7 times by 1 test: case QEvent::Timer:
Executed by:
  • tst_QStateMachine
7
221 return
executed 7 times by 1 test: return new QTimerEvent(*static_cast<QTimerEvent*>(e));
Executed by:
  • tst_QStateMachine
new QTimerEvent(*static_cast<QTimerEvent*>(e));
executed 7 times by 1 test: return new QTimerEvent(*static_cast<QTimerEvent*>(e));
Executed by:
  • tst_QStateMachine
7
222 default
never executed: default:
:
never executed: default:
0
223 ((!(false)) ? qt_assert_x("cloneEvent()", "not implemented",__FILE__,435) : qt_noop());-
224 break;
never executed: break;
0
225 }-
226 return
never executed: return 0;
0;
never executed: return 0;
0
227}-
228-
229const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = {-
230 cloneEvent-
231};-
232-
233const QStateMachinePrivate::Handler *QStateMachinePrivate::handler = &qt_kernel_statemachine_handler;-
234-
235__attribute__((visibility("default"))) const QStateMachinePrivate::Handler *qcoreStateMachineHandler()-
236{-
237 return
executed 7 times by 1 test: return &qt_kernel_statemachine_handler;
Executed by:
  • tst_QStateMachine
&qt_kernel_statemachine_handler;
executed 7 times by 1 test: return &qt_kernel_statemachine_handler;
Executed by:
  • tst_QStateMachine
7
238}-
239-
240static int indexOfDescendant(QState *s, QAbstractState *desc)-
241{-
242 QList<QAbstractState*> childStates = QStatePrivate::get(s)->childStates();-
243 for (int i = 0; i < childStates.size()
i < childStates.size()Description
TRUEevaluated 819 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
; ++i) {
0-819
244 QAbstractState *c = childStates.at(i);-
245 if ((
(c == desc)Description
TRUEevaluated 179 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 640 times by 1 test
Evaluated by:
  • tst_QStateMachine
c == desc)
(c == desc)Description
TRUEevaluated 179 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 640 times by 1 test
Evaluated by:
  • tst_QStateMachine
|| isDescendant(desc, c)
isDescendant(desc, c)Description
TRUEevaluated 335 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 305 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
179-640
246 return
executed 514 times by 1 test: return i;
Executed by:
  • tst_QStateMachine
i;
executed 514 times by 1 test: return i;
Executed by:
  • tst_QStateMachine
514
247 }-
248 }
executed 305 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
305
249 return
never executed: return -1;
-1;
never executed: return -1;
0
250}-
251-
252bool QStateMachinePrivate::transitionStateEntryLessThan(QAbstractTransition *t1, QAbstractTransition *t2)-
253{-
254 QState *s1 = t1->sourceState(), *s2 = t2->sourceState();-
255 if (s1 == s2
s1 == s2Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
6-12
256 QList<QAbstractTransition*> transitions = QStatePrivate::get(s1)->transitions();-
257 return
executed 6 times by 1 test: return transitions.indexOf(t1) < transitions.indexOf(t2);
Executed by:
  • tst_QStateMachine
transitions.indexOf(t1) < transitions.indexOf(t2);
executed 6 times by 1 test: return transitions.indexOf(t1) < transitions.indexOf(t2);
Executed by:
  • tst_QStateMachine
6
258 } else if (isDescendant(s1, s2)
isDescendant(s1, s2)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-12
259 return
never executed: return true;
true;
never executed: return true;
0
260 } else if (isDescendant(s2, s1)
isDescendant(s2, s1)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-12
261 return
never executed: return false;
false;
never executed: return false;
0
262 } else {-
263 ((!(s1->machine() != 0)) ? qt_assert("s1->machine() != 0",__FILE__,475) : qt_noop());-
264 QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());-
265 QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);-
266 ((!(lca != 0)) ? qt_assert("lca != 0",__FILE__,478) : qt_noop());-
267 int s1Depth = descendantDepth(s1, lca);-
268 int s2Depth = descendantDepth(s2, lca);-
269 if (s1Depth == s2Depth
s1Depth == s2DepthDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
4-8
270 return
executed 8 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
Executed by:
  • tst_QStateMachine
(indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
executed 8 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
Executed by:
  • tst_QStateMachine
8
271 else-
272 return
executed 4 times by 1 test: return s1Depth > s2Depth;
Executed by:
  • tst_QStateMachine
s1Depth > s2Depth;
executed 4 times by 1 test: return s1Depth > s2Depth;
Executed by:
  • tst_QStateMachine
4
273 }-
274}-
275-
276bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState *s2)-
277{-
278 if (s1->parent() == s2->parent()
s1->parent() == s2->parent()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 425 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
40-425
279 return
executed 40 times by 1 test: return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2);
Executed by:
  • tst_QStateMachine
s1->parent()->children().indexOf(s1)
executed 40 times by 1 test: return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2);
Executed by:
  • tst_QStateMachine
40
280 < s2->parent()->children().indexOf(s2);
executed 40 times by 1 test: return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2);
Executed by:
  • tst_QStateMachine
40
281 } else if (isDescendant(s1, s2)
isDescendant(s1, s2)Description
TRUEevaluated 134 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 291 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
134-291
282 return
executed 134 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 134 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
134
283 } else if (isDescendant(s2, s1)
isDescendant(s2, s1)Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 223 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
68-223
284 return
executed 68 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 68 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
68
285 } else {-
286 ((!(s1->machine() != 0)) ? qt_assert("s1->machine() != 0",__FILE__,498) : qt_noop());-
287 QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());-
288 QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);-
289 ((!(lca != 0)) ? qt_assert("lca != 0",__FILE__,501) : qt_noop());-
290 return
executed 223 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
Executed by:
  • tst_QStateMachine
(indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
executed 223 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
Executed by:
  • tst_QStateMachine
223
291 }-
292}-
293-
294bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState *s2)-
295{-
296 if (s1->parent() == s2->parent()
s1->parent() == s2->parent()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 130 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
10-130
297 return
executed 10 times by 1 test: return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1);
Executed by:
  • tst_QStateMachine
s2->parent()->children().indexOf(s2)
executed 10 times by 1 test: return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1);
Executed by:
  • tst_QStateMachine
10
298 < s1->parent()->children().indexOf(s1);
executed 10 times by 1 test: return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1);
Executed by:
  • tst_QStateMachine
10
299 } else if (isDescendant(s1, s2)
isDescendant(s1, s2)Description
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 80 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
50-80
300 return
executed 50 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
true;
executed 50 times by 2 tests: return true;
Executed by:
  • tst_QState
  • tst_QStateMachine
50
301 } else if (isDescendant(s2, s1)
isDescendant(s2, s1)Description
TRUEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
26-54
302 return
executed 54 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
false;
executed 54 times by 2 tests: return false;
Executed by:
  • tst_QState
  • tst_QStateMachine
54
303 } else {-
304 ((!(s1->machine() != 0)) ? qt_assert("s1->machine() != 0",__FILE__,516) : qt_noop());-
305 QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());-
306 QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);-
307 ((!(lca != 0)) ? qt_assert("lca != 0",__FILE__,519) : qt_noop());-
308 return
executed 26 times by 1 test: return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));
Executed by:
  • tst_QStateMachine
(indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));
executed 26 times by 1 test: return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));
Executed by:
  • tst_QStateMachine
26
309 }-
310}-
311-
312QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states, bool onlyCompound) const-
313{-
314 if (states.isEmpty()
states.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1652 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-1652
315 return
never executed: return 0;
0;
never executed: return 0;
0
316 QVector<QState*> ancestors = getProperAncestors(states.at(0), rootState()->parentState());-
317 for (int i = 0; i < ancestors.size()
i < ancestors.size()Description
TRUEevaluated 1931 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
4-1931
318 QState *anc = ancestors.at(i);-
319 if (onlyCompound
onlyCompoundDescription
TRUEevaluated 1415 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 516 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& !isCompound(anc)
!isCompound(anc)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1403 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
12-1415
320 continue;
executed 12 times by 1 test: continue;
Executed by:
  • tst_QStateMachine
12
321-
322 bool ok = true;-
323 for (int j = states.size() - 1; (
(j > 0)Description
TRUEevaluated 1768 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1919 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
j > 0)
(j > 0)Description
TRUEevaluated 1768 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1919 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& ok
okDescription
TRUEevaluated 1768 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
; --j) {
0-1919
324 const QAbstractState *s = states.at(j);-
325 if (!isDescendant(s, anc)
!isDescendant(s, anc)Description
TRUEevaluated 271 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1497 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
271-1497
326 ok = false;
executed 271 times by 1 test: ok = false;
Executed by:
  • tst_QStateMachine
271
327 }
executed 1768 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1768
328 if (ok
okDescription
TRUEevaluated 1648 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 271 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
271-1648
329 return
executed 1648 times by 2 tests: return anc;
Executed by:
  • tst_QState
  • tst_QStateMachine
anc;
executed 1648 times by 2 tests: return anc;
Executed by:
  • tst_QState
  • tst_QStateMachine
1648
330 }
executed 271 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
271
331 return
executed 4 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 4 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
4
332}-
333-
334QState *QStateMachinePrivate::findLCCA(const QList<QAbstractState*> &states) const-
335{-
336 return
executed 1391 times by 2 tests: return findLCA(states, true);
Executed by:
  • tst_QState
  • tst_QStateMachine
findLCA(states, true);
executed 1391 times by 2 tests: return findLCA(states, true);
Executed by:
  • tst_QState
  • tst_QStateMachine
1391
337}-
338-
339QList<QAbstractTransition*> QStateMachinePrivate::selectTransitions(QEvent *event, CalculationCache *cache)-
340{-
341 ((!(cache)) ? qt_assert("cache",__FILE__,553) : qt_noop());-
342 const QStateMachine * const q = q_func();-
343-
344 QVarLengthArray<QAbstractState *> configuration_sorted;-
345 for (QAbstractState *s : qAsConst(configuration)) {-
346 if (isAtomic(s)
isAtomic(s)Description
TRUEevaluated 3838 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 386 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
386-3838
347 configuration_sorted.append(s);
executed 3838 times by 2 tests: configuration_sorted.append(s);
Executed by:
  • tst_QState
  • tst_QStateMachine
3838
348 }
executed 4224 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
4224
349 std::sort(configuration_sorted.begin(), configuration_sorted.end(), stateEntryLessThan);-
350-
351 QList<QAbstractTransition*> enabledTransitions;-
352 const_cast<QStateMachine*>(q)->beginSelectTransitions(event);-
353 for (QAbstractState *state : qAsConst(configuration_sorted)) {-
354 QVector<QState*> lst = getProperAncestors(state, nullptr);-
355 if (QState *grp = toStandardState(state)
QState *grp = ...rdState(state)Description
TRUEevaluated 3815 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
23-3815
356 lst.prepend(grp);
executed 3815 times by 2 tests: lst.prepend(grp);
Executed by:
  • tst_QState
  • tst_QStateMachine
3815
357 bool found = false;-
358 for (int j = 0; (
(j < lst.size())Description
TRUEevaluated 8136 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2594 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
j < lst.size())
(j < lst.size())Description
TRUEevaluated 8136 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2594 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& !found
!foundDescription
TRUEevaluated 6892 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1244 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++j) {
1244-8136
359 QState *s = lst.at(j);-
360 QList<QAbstractTransition*> transitions = QStatePrivate::get(s)->transitions();-
361 for (int k = 0; k < transitions.size()
k < transitions.size()Description
TRUEevaluated 5945 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 5648 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++k) {
5648-5945
362 QAbstractTransition *t = transitions.at(k);-
363 if (QAbstractTransitionPrivate::get(t)->callEventTest(event)
QAbstractTrans...entTest(event)Description
TRUEevaluated 1244 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 4701 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1244-4701
364-
365-
366-
367 enabledTransitions.append(t);-
368 found = true;-
369 break;
executed 1244 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
1244
370 }-
371 }
executed 4701 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
4701
372 }
executed 6892 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6892
373 }
executed 3838 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
3838
374-
375 if (!enabledTransitions.isEmpty()
!enabledTransitions.isEmpty()Description
TRUEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2515 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1235-2515
376 removeConflictingTransitions(enabledTransitions, cache);-
377-
378-
379-
380 }
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
381 const_cast<QStateMachine*>(q)->endSelectTransitions(event);-
382 return
executed 3750 times by 2 tests: return enabledTransitions;
Executed by:
  • tst_QState
  • tst_QStateMachine
enabledTransitions;
executed 3750 times by 2 tests: return enabledTransitions;
Executed by:
  • tst_QState
  • tst_QStateMachine
3750
383}-
384void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache)-
385{-
386 ((!(cache)) ? qt_assert("cache",__FILE__,623) : qt_noop());-
387-
388 if (enabledTransitions.size() < 2
enabledTransitions.size() < 2Description
TRUEevaluated 1229 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
6-1229
389 return;
executed 1229 times by 2 tests: return;
Executed by:
  • tst_QState
  • tst_QStateMachine
1229
390-
391 QList<QAbstractTransition*> filteredTransitions;-
392 filteredTransitions.reserve(enabledTransitions.size());-
393 std::sort(enabledTransitions.begin(), enabledTransitions.end(), transitionStateEntryLessThan);-
394-
395 for (QAbstractTransition *t1 : qAsConst(enabledTransitions)) {-
396 bool t1Preempted = false;-
397 const QSet<QAbstractState*> exitSetT1 = computeExitSet_Unordered(t1, cache);-
398 QList<QAbstractTransition*>::iterator t2It = filteredTransitions.begin();-
399 while (t2It != filteredTransitions.end()
t2It != filter...nsitions.end()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
9-10
400 QAbstractTransition *t2 = *t2It;-
401 if (t1 == t2
t1 == t2Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
3-7
402-
403-
404 t1Preempted = true;-
405 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QStateMachine
3
406 }-
407-
408 QSet<QAbstractState*> exitSetT2 = computeExitSet_Unordered(t2, cache);-
409 if (!exitSetT1.intersects(exitSetT2)
!exitSetT1.int...cts(exitSetT2)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
3-4
410-
411 ++t2It;-
412 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
4
413-
414 if (isDescendant(t1->sourceState(), t2->sourceState())
isDescendant(t...sourceState())Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-3
415-
416 t2It = filteredTransitions.erase(t2It);-
417 }
never executed: end of block
else {
0
418-
419-
420 t1Preempted = true;-
421 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QStateMachine
3
422 }-
423 }-
424 }-
425 if (!t1Preempted
!t1PreemptedDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
6-9
426 filteredTransitions.append(t1);
executed 9 times by 1 test: filteredTransitions.append(t1);
Executed by:
  • tst_QStateMachine
9
427 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
15
428-
429 enabledTransitions = filteredTransitions;-
430}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
6
431-
432void QStateMachinePrivate::microstep(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions,-
433 CalculationCache *cache)-
434{-
435 ((!(cache)) ? qt_assert("cache",__FILE__,672) : qt_noop());-
436-
437-
438-
439-
440-
441 QList<QAbstractState*> exitedStates = computeExitSet(enabledTransitions, cache);-
442 QHash<RestorableId, QVariant> pendingRestorables = computePendingRestorables(exitedStates);-
443-
444 QSet<QAbstractState*> statesForDefaultEntry;-
445 QList<QAbstractState*> enteredStates = computeEntrySet(enabledTransitions, statesForDefaultEntry, cache);-
446-
447-
448-
449-
450-
451-
452 QHash<QAbstractState*, QVector<QPropertyAssignment> > assignmentsForEnteredStates =-
453 computePropertyAssignments(enteredStates, pendingRestorables);-
454 if (!pendingRestorables.isEmpty()
!pendingRestorables.isEmpty()Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1212 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
23-1212
455-
456-
457 ((!(!enteredStates.isEmpty())) ? qt_assert("!enteredStates.isEmpty()",__FILE__,694) : qt_noop());-
458 QAbstractState *s = enteredStates.constFirst();-
459 assignmentsForEnteredStates[s] << restorablesToPropertyList(pendingRestorables);-
460 }
executed 23 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
23
461-
462 exitStates(event, exitedStates, assignmentsForEnteredStates);-
463-
464-
465-
466-
467 executeTransitionContent(event, enabledTransitions);-
468-
469-
470 QList<QAbstractAnimation *> selectedAnimations = selectAnimations(enabledTransitions);-
471-
472-
473 enterStates(event, exitedStates, enteredStates, statesForDefaultEntry, assignmentsForEnteredStates-
474-
475 , selectedAnimations-
476-
477 );-
478-
479-
480-
481-
482}
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
483QList<QAbstractState*> QStateMachinePrivate::computeExitSet(const QList<QAbstractTransition*> &enabledTransitions,-
484 CalculationCache *cache)-
485{-
486 ((!(cache)) ? qt_assert("cache",__FILE__,744) : qt_noop());-
487-
488 QList<QAbstractState*> statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).toList();-
489 std::sort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan);-
490 return
executed 1235 times by 2 tests: return statesToExit_sorted;
Executed by:
  • tst_QState
  • tst_QStateMachine
statesToExit_sorted;
executed 1235 times by 2 tests: return statesToExit_sorted;
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
491}-
492-
493QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(const QList<QAbstractTransition*> &enabledTransitions,-
494 CalculationCache *cache)-
495{-
496 ((!(cache)) ? qt_assert("cache",__FILE__,754) : qt_noop());-
497-
498 QSet<QAbstractState*> statesToExit;-
499 for (QAbstractTransition *t : enabledTransitions)-
500 statesToExit.unite(computeExitSet_Unordered(t, cache));
executed 1238 times by 2 tests: statesToExit.unite(computeExitSet_Unordered(t, cache));
Executed by:
  • tst_QState
  • tst_QStateMachine
1238
501 return
executed 1235 times by 2 tests: return statesToExit;
Executed by:
  • tst_QState
  • tst_QStateMachine
statesToExit;
executed 1235 times by 2 tests: return statesToExit;
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
502}-
503-
504QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(QAbstractTransition *t,-
505 CalculationCache *cache)-
506{-
507 ((!(cache)) ? qt_assert("cache",__FILE__,765) : qt_noop());-
508-
509 QSet<QAbstractState*> statesToExit;-
510 if (cache->exitSet(t, &statesToExit)
cache->exitSet...&statesToExit)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1241 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
19-1241
511 return
executed 19 times by 1 test: return statesToExit;
Executed by:
  • tst_QStateMachine
statesToExit;
executed 19 times by 1 test: return statesToExit;
Executed by:
  • tst_QStateMachine
19
512-
513 QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache);-
514 QAbstractState *domain = getTransitionDomain(t, effectiveTargetStates, cache);-
515 if (domain == nullptr
domain == nullptrDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1232 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& !t->targetStates().isEmpty()
!t->targetStates().isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
4-1232
516-
517-
518-
519-
520-
521-
522-
523 if (error == QStateMachine::NoError
error == QStat...chine::NoErrorDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-3
524 setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState());
executed 3 times by 1 test: setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState());
Executed by:
  • tst_QStateMachine
3
525 QList<QAbstractState *> lst = pendingErrorStates.toList();-
526 lst.prepend(t->sourceState());-
527-
528 domain = findLCCA(lst);-
529 ((!(domain != 0)) ? qt_assert("domain != 0",__FILE__,787) : qt_noop());-
530 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
4
531-
532 for (QAbstractState* s : qAsConst(configuration)) {-
533 if (isDescendant(s, domain)
isDescendant(s, domain)Description
TRUEevaluated 1315 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
104-1315
534 statesToExit.insert(s);
executed 1315 times by 2 tests: statesToExit.insert(s);
Executed by:
  • tst_QState
  • tst_QStateMachine
1315
535 }
executed 1419 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1419
536-
537 cache->insert(t, statesToExit);-
538 return
executed 1241 times by 2 tests: return statesToExit;
Executed by:
  • tst_QState
  • tst_QStateMachine
statesToExit;
executed 1241 times by 2 tests: return statesToExit;
Executed by:
  • tst_QState
  • tst_QStateMachine
1241
539}-
540-
541void QStateMachinePrivate::exitStates(QEvent *event, const QList<QAbstractState*> &statesToExit_sorted,-
542 const QHash<QAbstractState*, QVector<QPropertyAssignment> > &assignmentsForEnteredStates)-
543{-
544 for (int i = 0; i < statesToExit_sorted.size()
i < statesToExit_sorted.size()Description
TRUEevaluated 1298 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1235-1298
545 QAbstractState *s = statesToExit_sorted.at(i);-
546 if (QState *grp = toStandardState(s)
QState *grp = ...andardState(s)Description
TRUEevaluated 1291 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
7-1291
547 QList<QHistoryState*> hlst = QStatePrivate::get(grp)->historyStates();-
548 for (int j = 0; j < hlst.size()
j < hlst.size()Description
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1291 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++j) {
9-1291
549 QHistoryState *h = hlst.at(j);-
550 QHistoryStatePrivate::get(h)->configuration.clear();-
551 QSet<QAbstractState*>::const_iterator it;-
552 for (it = configuration.constBegin(); it != configuration.constEnd()
it != configuration.constEnd()Description
TRUEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
9-27
553 QAbstractState *s0 = *it;-
554 if (QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory
QHistoryStateP...e::DeepHistoryDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
11-16
555 if (isAtomic(s0)
isAtomic(s0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& isDescendant(s0, s)
isDescendant(s0, s)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-6
556 QHistoryStatePrivate::get(h)->configuration.append(s0);
executed 5 times by 1 test: QHistoryStatePrivate::get(h)->configuration.append(s0);
Executed by:
  • tst_QStateMachine
5
557 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else if (s0->parentState() == s
s0->parentState() == sDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
8-11
558 QHistoryStatePrivate::get(h)->configuration.append(s0);-
559 }
executed 8 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
8
560 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
27
561-
562-
563-
564-
565 }
executed 9 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
9
566 }
executed 1291 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1291
567 }
executed 1298 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1298
568 for (int i = 0; i < statesToExit_sorted.size()
i < statesToExit_sorted.size()Description
TRUEevaluated 1298 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1235-1298
569 QAbstractState *s = statesToExit_sorted.at(i);-
570-
571-
572-
573 QAbstractStatePrivate::get(s)->callOnExit(event);-
574-
575-
576 terminateActiveAnimations(s, assignmentsForEnteredStates);-
577-
578-
579-
580-
581 configuration.remove(s);-
582 QAbstractStatePrivate::get(s)->emitExited();-
583 }
executed 1298 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1298
584}
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
585-
586void QStateMachinePrivate::executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions)-
587{-
588 for (int i = 0; i < enabledTransitions.size()
i < enabledTransitions.size()Description
TRUEevaluated 1391 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1388-1391
589 QAbstractTransition *t = enabledTransitions.at(i);-
590-
591-
592-
593 QAbstractTransitionPrivate::get(t)->callOnTransition(event);-
594 QAbstractTransitionPrivate::get(t)->emitTriggered();-
595 }
executed 1391 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1391
596}
executed 1388 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
597-
598QList<QAbstractState*> QStateMachinePrivate::computeEntrySet(const QList<QAbstractTransition *> &enabledTransitions,-
599 QSet<QAbstractState *> &statesForDefaultEntry,-
600 CalculationCache *cache)-
601{-
602 ((!(cache)) ? qt_assert("cache",__FILE__,860) : qt_noop());-
603-
604 QSet<QAbstractState*> statesToEnter;-
605 if (pendingErrorStates.isEmpty()
pendingErrorStates.isEmpty()Description
TRUEevaluated 1387 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-1387
606 for (QAbstractTransition *t : enabledTransitions) {-
607 const auto targetStates = t->targetStates();-
608 for (QAbstractState *s : targetStates)-
609 addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
executed 1386 times by 2 tests: addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
1386
610-
611 const QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache);-
612 QAbstractState *ancestor = getTransitionDomain(t, effectiveTargetStates, cache);-
613 for (QAbstractState *s : effectiveTargetStates)-
614 addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry);
executed 1390 times by 2 tests: addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
1390
615 }
executed 1390 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1390
616 }
executed 1387 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1387
617-
618-
619 if (!pendingErrorStates.isEmpty()
!pendingErrorStates.isEmpty()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1379 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
9-1379
620 statesToEnter.clear();-
621 statesToEnter = pendingErrorStates;-
622 statesForDefaultEntry = pendingErrorStatesForDefaultEntry;-
623 pendingErrorStates.clear();-
624 pendingErrorStatesForDefaultEntry.clear();-
625 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
9
626-
627 QList<QAbstractState*> statesToEnter_sorted = statesToEnter.toList();-
628 std::sort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan);-
629 return
executed 1388 times by 2 tests: return statesToEnter_sorted;
Executed by:
  • tst_QState
  • tst_QStateMachine
statesToEnter_sorted;
executed 1388 times by 2 tests: return statesToEnter_sorted;
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
630}-
631QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t,-
632 const QList<QAbstractState *> &effectiveTargetStates,-
633 CalculationCache *cache) const-
634{-
635 ((!(cache)) ? qt_assert("cache",__FILE__,910) : qt_noop());-
636-
637 if (effectiveTargetStates.isEmpty()
effectiveTarge...ates.isEmpty()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2620 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
11-2620
638 return
executed 11 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 11 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
11
639-
640 QAbstractState *domain = nullptr;-
641 if (cache->transitionDomain(t, &domain)
cache->transit...in(t, &domain)Description
TRUEevaluated 1231 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1389 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1231-1389
642 return
executed 1231 times by 2 tests: return domain;
Executed by:
  • tst_QState
  • tst_QStateMachine
domain;
executed 1231 times by 2 tests: return domain;
Executed by:
  • tst_QState
  • tst_QStateMachine
1231
643-
644 if (t->transitionType() == QAbstractTransition::InternalTransition
t->transitionT...rnalTransitionDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1387 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
2-1387
645 if (QState *tSource = t->sourceState()
QState *tSourc...>sourceState()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-2
646 if (isCompound(tSource)
isCompound(tSource)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-2
647 bool allDescendants = true;-
648 for (QAbstractState *s : effectiveTargetStates) {-
649 if (!isDescendant(s, tSource)
!isDescendant(s, tSource)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-2
650 allDescendants = false;-
651 break;
never executed: break;
0
652 }-
653 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
654-
655 if (allDescendants
allDescendantsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-2
656 return
executed 2 times by 1 test: return tSource;
Executed by:
  • tst_QStateMachine
tSource;
executed 2 times by 1 test: return tSource;
Executed by:
  • tst_QStateMachine
2
657 }
never executed: end of block
0
658 }
never executed: end of block
0
659 }
never executed: end of block
0
660-
661 QList<QAbstractState *> states(effectiveTargetStates);-
662 if (QAbstractState *src = t->sourceState()
QAbstractState...>sourceState()Description
TRUEevaluated 1234 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 153 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
153-1234
663 states.prepend(src);
executed 1234 times by 2 tests: states.prepend(src);
Executed by:
  • tst_QState
  • tst_QStateMachine
1234
664 domain = findLCCA(states);-
665 cache->insert(t, domain);-
666 return
executed 1387 times by 2 tests: return domain;
Executed by:
  • tst_QState
  • tst_QStateMachine
domain;
executed 1387 times by 2 tests: return domain;
Executed by:
  • tst_QState
  • tst_QStateMachine
1387
667}-
668-
669void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState*> &exitedStates_sorted,-
670 const QList<QAbstractState*> &statesToEnter_sorted,-
671 const QSet<QAbstractState*> &statesForDefaultEntry,-
672 QHash<QAbstractState*, QVector<QPropertyAssignment> > &propertyAssignmentsForState-
673-
674 , const QList<QAbstractAnimation *> &selectedAnimations-
675-
676 )-
677{-
678-
679-
680-
681 for (int i = 0; i < statesToEnter_sorted.size()
i < statesToEn..._sorted.size()Description
TRUEevaluated 1507 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1388-1507
682 QAbstractState *s = statesToEnter_sorted.at(i);-
683-
684-
685-
686 configuration.insert(s);-
687 registerTransitions(s);-
688-
689-
690 initializeAnimations(s, selectedAnimations, exitedStates_sorted, propertyAssignmentsForState);-
691-
692-
693-
694 {-
695 QVector<QPropertyAssignment> assignments = propertyAssignmentsForState.value(s);-
696 for (int i = 0; i < assignments.size()
i < assignments.size()Description
TRUEevaluated 97 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1507 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
97-1507
697 const QPropertyAssignment &assn = assignments.at(i);-
698 if (globalRestorePolicy == QState::RestoreProperties
globalRestoreP...torePropertiesDescription
TRUEevaluated 54 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
43-54
699 if (assn.explicitlySet
assn.explicitlySetDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
18-36
700 if (!hasRestorable(s, assn.object, assn.propertyName)
!hasRestorable....propertyName)Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-34
701 QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName);-
702 unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);-
703 registerRestorable(s, assn.object, assn.propertyName, value);-
704 }
executed 34 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
34
705 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
36
706-
707-
708-
709 unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);-
710 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
18
711 }-
712 assn.write();-
713 }
executed 97 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
97
714 }-
715-
716 QAbstractStatePrivate::get(s)->callOnEntry(event);-
717 QAbstractStatePrivate::get(s)->emitEntered();-
718-
719-
720-
721-
722-
723-
724 (void)statesForDefaultEntry;;-
725-
726 if (QHistoryState *h = toHistoryState(s)
QHistoryState ...istoryState(s)Description
TRUEnever evaluated
FALSEevaluated 1507 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-1507
727 QAbstractTransitionPrivate::get(h->defaultTransition())->callOnTransition(event);
never executed: QAbstractTransitionPrivate::get(h->defaultTransition())->callOnTransition(event);
0
728-
729-
730 {-
731 QState *ss = toStandardState(s);-
732 if (ss
ssDescription
TRUEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
72-1435
733-
734 && !animationsForState.contains(s)
!animationsFor...te.contains(s)Description
TRUEevaluated 1403 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QStateMachine
32-1403
735-
736 )-
737 QStatePrivate::get(ss)->emitPropertiesAssigned();
executed 1403 times by 2 tests: QStatePrivate::get(ss)->emitPropertiesAssigned();
Executed by:
  • tst_QState
  • tst_QStateMachine
1403
738 }-
739-
740 if (isFinal(s)
isFinal(s)Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
72-1435
741 QState *parent = s->parentState();-
742 if (parent
parentDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-72
743 if (parent != rootState()
parent != rootState()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 63 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
9-63
744 QFinalState *finalState = qobject_cast<QFinalState *>(s);-
745 ((!(finalState)) ? qt_assert("finalState",__FILE__,1020) : qt_noop());-
746 emitStateFinished(parent, finalState);-
747 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
9
748 QState *grandparent = parent->parentState();-
749 if (grandparent
grandparentDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& isParallel(grandparent)
isParallel(grandparent)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
5-60
750 bool allChildStatesFinal = true;-
751 QList<QAbstractState*> childStates = QStatePrivate::get(grandparent)->childStates();-
752 for (int j = 0; j < childStates.size()
j < childStates.size()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++j) {
3-16
753 QAbstractState *cs = childStates.at(j);-
754 if (!isInFinalState(cs)
!isInFinalState(cs)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
4-12
755 allChildStatesFinal = false;-
756 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QStateMachine
4
757 }-
758 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
12
759 if (allChildStatesFinal
allChildStatesFinalDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& (
(grandparent != rootState())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
grandparent != rootState())
(grandparent != rootState())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-4
760 QFinalState *finalState = qobject_cast<QFinalState *>(s);-
761 ((!(finalState)) ? qt_assert("finalState",__FILE__,1036) : qt_noop());-
762 emitStateFinished(grandparent, finalState);-
763 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
764 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
7
765 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
72
766 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
72
767 }
executed 1507 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1507
768 {-
769 QSet<QAbstractState*>::const_iterator it;-
770 for (it = configuration.constBegin(); it != configuration.constEnd()
it != configuration.constEnd()Description
TRUEevaluated 1591 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1324 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
1324-1591
771 if (isFinal(*it)
isFinal(*it)Description
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1517 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
74-1517
772 QState *parent = (*it)->parentState();-
773 if (((
(parent == rootState())Description
TRUEevaluated 63 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
parent == rootState())
(parent == rootState())Description
TRUEevaluated 63 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
11-63
774 && (
(rootState()->...clusiveStates)Description
TRUEevaluated 63 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
rootState()->childMode() == QState::ExclusiveStates)
(rootState()->...clusiveStates)Description
TRUEevaluated 63 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-63
775 || ((
(parent->paren...= rootState())Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
parent->parentState() == rootState())
(parent->paren...= rootState())Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
3-8
776 && (
(rootState()->...arallelStates)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
rootState()->childMode() == QState::ParallelStates)
(rootState()->...arallelStates)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
1-2
777 && isInFinalState(rootState())
isInFinalState(rootState())Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)) {
0-1
778 processing = false;-
779 stopProcessingReason = Finished;-
780 break;
executed 64 times by 1 test: break;
Executed by:
  • tst_QStateMachine
64
781 }-
782 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
10
783 }
executed 1527 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1527
784 }-
785-
786}
executed 1388 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
787void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state,-
788 QSet<QAbstractState*> &statesToEnter,-
789 QSet<QAbstractState*> &statesForDefaultEntry)-
790{-
791 if (QHistoryState *h = toHistoryState(state)
QHistoryState ...ryState(state)Description
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1506 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
13-1506
792 const QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(h)->configuration;-
793 if (!historyConfiguration.isEmpty()
!historyConfig...tion.isEmpty()Description
TRUEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
6-7
794 for (QAbstractState *s : historyConfiguration)-
795 addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
executed 11 times by 2 tests: addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
11
796 for (QAbstractState *s : historyConfiguration)-
797 addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
executed 11 times by 2 tests: addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
11
798-
799-
800-
801-
802-
803-
804 }
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
else {
7
805 QList<QAbstractState*> defaultHistoryContent;-
806 if (QAbstractTransition *t = QHistoryStatePrivate::get(h)->defaultTransition
QAbstractTrans...aultTransitionDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
)
0-6
807 defaultHistoryContent = t->targetStates();
executed 6 times by 2 tests: defaultHistoryContent = t->targetStates();
Executed by:
  • tst_QState
  • tst_QStateMachine
6
808-
809 if (defaultHistoryContent.isEmpty()
defaultHistory...tent.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
0-6
810 setError(QStateMachine::NoDefaultStateInHistoryStateError, h);-
811 }
never executed: end of block
else {
0
812 for (QAbstractState *s : qAsConst(defaultHistoryContent))-
813 addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
executed 7 times by 2 tests: addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
7
814 for (QAbstractState *s : qAsConst(defaultHistoryContent))-
815 addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
executed 7 times by 2 tests: addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QState
  • tst_QStateMachine
7
816-
817-
818-
819 }
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6
820 }-
821 } else {-
822 if (state == rootState()
state == rootState()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1505 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-1505
823-
824 ((!(error != QStateMachine::NoError)) ? qt_assert("error != QStateMachine::NoError",__FILE__,1131) : qt_noop());-
825 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
826 }-
827 statesToEnter.insert(state);-
828 if (isCompound(state)
isCompound(state)Description
TRUEevaluated 65 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1440 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
65-1440
829 statesForDefaultEntry.insert(state);-
830 if (QAbstractState *initial = toStandardState(state)->initialState()
QAbstractState...initialState()Description
TRUEevaluated 49 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
16-49
831 ((!(initial->machine() == q_func())) ? qt_assert("initial->machine() == q_func()",__FILE__,1138) : qt_noop());-
832-
833-
834-
835-
836-
837 statesForDefaultEntry.insert(initial);-
838-
839 addDescendantStatesToEnter(initial, statesToEnter, statesForDefaultEntry);-
840 addAncestorStatesToEnter(initial, state, statesToEnter, statesForDefaultEntry);-
841 }
executed 49 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
else {
49
842 setError(QStateMachine::NoInitialStateError, state);-
843 return;
executed 16 times by 1 test: return;
Executed by:
  • tst_QStateMachine
16
844 }-
845 } else if (isParallel(state)
isParallel(state)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1425 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
15-1425
846 QState *grp = toStandardState(state);-
847 const auto childStates = QStatePrivate::get(grp)->childStates();-
848 for (QAbstractState *child : childStates) {-
849 if (!containsDecendantOf(statesToEnter, child)
!containsDecen...oEnter, child)Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-29
850 addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
executed 29 times by 1 test: addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QStateMachine
29
851 }
executed 29 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
29
852 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
15
853 }
executed 1489 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1489
854}-
855void QStateMachinePrivate::addAncestorStatesToEnter(QAbstractState *s, QAbstractState *ancestor,-
856 QSet<QAbstractState*> &statesToEnter,-
857 QSet<QAbstractState*> &statesForDefaultEntry)-
858{-
859 const auto properAncestors = getProperAncestors(s, ancestor);-
860 for (QState *anc : properAncestors) {-
861 if (!anc->parentState()
!anc->parentState()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
2-66
862 continue;
executed 2 times by 1 test: continue;
Executed by:
  • tst_QStateMachine
2
863 statesToEnter.insert(anc);-
864 if (isParallel(anc)
isParallel(anc)Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 31 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
31-35
865 const auto childStates = QStatePrivate::get(anc)->childStates();-
866 for (QAbstractState *child : childStates) {-
867 if (!containsDecendantOf(statesToEnter, child)
!containsDecen...oEnter, child)Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
27-36
868 addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
executed 27 times by 1 test: addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
Executed by:
  • tst_QStateMachine
27
869 }
executed 63 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
63
870 }
executed 35 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
35
871 }
executed 66 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
66
872}
executed 1467 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1467
873-
874bool QStateMachinePrivate::isFinal(const QAbstractState *s)-
875{-
876 return
executed 3561 times by 2 tests: return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState);
Executed by:
  • tst_QState
  • tst_QStateMachine
s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState);
executed 3561 times by 2 tests: return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState);
Executed by:
  • tst_QState
  • tst_QStateMachine
3561
877}-
878-
879bool QStateMachinePrivate::isParallel(const QAbstractState *s)-
880{-
881 const QState *ss = toStandardState(s);-
882 return
executed 4385 times by 2 tests: return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates);
Executed by:
  • tst_QState
  • tst_QStateMachine
ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates);
executed 4385 times by 2 tests: return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates);
Executed by:
  • tst_QState
  • tst_QStateMachine
4385
883}-
884-
885bool QStateMachinePrivate::isCompound(const QAbstractState *s) const-
886{-
887 const QState *group = toStandardState(s);-
888 if (!group
!groupDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2869 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
72-2869
889 return
executed 72 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 72 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
72
890 bool isMachine = QStatePrivate::get(group)->isMachine;-
891-
892 if (isMachine
isMachineDescription
TRUEevaluated 1352 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1517 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& (
(group != rootState())Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1349 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
group != rootState())
(group != rootState())Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1349 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
3-1517
893 return
executed 3 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
3
894 return
executed 2866 times by 2 tests: return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty());
Executed by:
  • tst_QState
  • tst_QStateMachine
(!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty());
executed 2866 times by 2 tests: return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty());
Executed by:
  • tst_QState
  • tst_QStateMachine
2866
895}-
896-
897bool QStateMachinePrivate::isAtomic(const QAbstractState *s) const-
898{-
899 const QState *ss = toStandardState(s);-
900 return
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
Executed by:
  • tst_QState
  • tst_QStateMachine
(ss && QStatePrivate::get(ss)->childStates().isEmpty())
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
Executed by:
  • tst_QState
  • tst_QStateMachine
4235
901 || isFinal(s)
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
Executed by:
  • tst_QState
  • tst_QStateMachine
4235
9024235
903 || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
Executed by:
  • tst_QState
  • tst_QStateMachine
4235
904}-
905-
906QState *QStateMachinePrivate::toStandardState(QAbstractState *state)-
907{-
908 if (state
stateDescription
TRUEevaluated 9813 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
&& (
(QAbstractStat...StandardState)Description
TRUEevaluated 9566 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 247 times by 1 test
Evaluated by:
  • tst_QStateMachine
QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)
(QAbstractStat...StandardState)Description
TRUEevaluated 9566 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 247 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-9813
909 return
executed 9566 times by 2 tests: return static_cast<QState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
static_cast<QState*>(state);
executed 9566 times by 2 tests: return static_cast<QState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
9566
910 return
executed 247 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 247 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
247
911}-
912-
913const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state)-
914{-
915 if (state
stateDescription
TRUEevaluated 11561 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
&& (
(QAbstractStat...StandardState)Description
TRUEevaluated 11394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 167 times by 1 test
Evaluated by:
  • tst_QStateMachine
QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState)
(QAbstractStat...StandardState)Description
TRUEevaluated 11394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 167 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-11561
916 return
executed 11394 times by 2 tests: return static_cast<const QState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
static_cast<const QState*>(state);
executed 11394 times by 2 tests: return static_cast<const QState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
11394
917 return
executed 167 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 167 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
167
918}-
919-
920QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state)-
921{-
922 if (state
stateDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(QAbstractStat...e::FinalState)Description
TRUEnever evaluated
FALSEnever evaluated
QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState)
(QAbstractStat...e::FinalState)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
923 return
never executed: return static_cast<QFinalState*>(state);
static_cast<QFinalState*>(state);
never executed: return static_cast<QFinalState*>(state);
0
924 return
never executed: return 0;
0;
never executed: return 0;
0
925}-
926-
927QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state)-
928{-
929 if (state
stateDescription
TRUEevaluated 4416 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
&& (
(QAbstractStat...:HistoryState)Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 4394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState)
(QAbstractStat...:HistoryState)Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 4394 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-4416
930 return
executed 22 times by 2 tests: return static_cast<QHistoryState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
static_cast<QHistoryState*>(state);
executed 22 times by 2 tests: return static_cast<QHistoryState*>(state);
Executed by:
  • tst_QState
  • tst_QStateMachine
22
931 return
executed 4394 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
0;
executed 4394 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
4394
932}-
933-
934bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const-
935{-
936 if (isCompound(s)
isCompound(s)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-18
937 QState *grp = toStandardState(s);-
938 QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();-
939 for (int i = 0; i < lst.size()
i < lst.size()Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
4-30
940 QAbstractState *cs = lst.at(i);-
941 if (isFinal(cs)
isFinal(cs)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& configuration.contains(cs)
configuration.contains(cs)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
4-18
942 return
executed 14 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 14 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
14
943 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
16
944 return
executed 4 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
4
945 } else if (isParallel(s)
isParallel(s)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-1
946 QState *grp = toStandardState(s);-
947 QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();-
948 for (int i = 0; i < lst.size()
i < lst.size()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
1-2
949 QAbstractState *cs = lst.at(i);-
950 if (!isInFinalState(cs)
!isInFinalState(cs)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-2
951 return
never executed: return false;
false;
never executed: return false;
0
952 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
953 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QStateMachine
1
954 }-
955 else-
956 return
never executed: return false;
false;
never executed: return false;
0
957}-
958bool QStateMachinePrivate::hasRestorable(QAbstractState *state, QObject *object,-
959 const QByteArray &propertyName) const-
960{-
961 RestorableId id(object, propertyName);-
962 return
executed 48 times by 1 test: return registeredRestorablesForState.value(state).contains(id);
Executed by:
  • tst_QStateMachine
registeredRestorablesForState.value(state).contains(id);
executed 48 times by 1 test: return registeredRestorablesForState.value(state).contains(id);
Executed by:
  • tst_QStateMachine
48
963}-
964QVariant QStateMachinePrivate::savedValueForRestorable(const QList<QAbstractState*> &exitedStates_sorted,-
965 QObject *object, const QByteArray &propertyName) const-
966{-
967-
968-
969-
970 for (int i = exitedStates_sorted.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 29 times by 1 test
Evaluated by:
  • tst_QStateMachine
; --i) {
29-38
971 QAbstractState *s = exitedStates_sorted.at(i);-
972 QHash<RestorableId, QVariant> restorables = registeredRestorablesForState.value(s);-
973 QHash<RestorableId, QVariant>::const_iterator it = restorables.constFind(RestorableId(object, propertyName));-
974 if (it != restorables.constEnd()
it != restorables.constEnd()Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
17-21
975-
976-
977-
978 return
executed 17 times by 1 test: return it.value();
Executed by:
  • tst_QStateMachine
it.value();
executed 17 times by 1 test: return it.value();
Executed by:
  • tst_QStateMachine
17
979 }-
980 }
executed 21 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
21
981-
982-
983-
984 return
executed 29 times by 1 test: return object->property(propertyName);
Executed by:
  • tst_QStateMachine
object->property(propertyName);
executed 29 times by 1 test: return object->property(propertyName);
Executed by:
  • tst_QStateMachine
29
985}-
986-
987void QStateMachinePrivate::registerRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName,-
988 const QVariant &value)-
989{-
990-
991-
992-
993 RestorableId id(object, propertyName);-
994 QHash<RestorableId, QVariant> &restorables = registeredRestorablesForState[state];-
995 if (!restorables.contains(id)
!restorables.contains(id)Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-46
996 restorables.insert(id, value);
executed 46 times by 1 test: restorables.insert(id, value);
Executed by:
  • tst_QStateMachine
46
997-
998-
999-
1000-
1001}
executed 46 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
46
1002-
1003void QStateMachinePrivate::unregisterRestorables(const QList<QAbstractState *> &states, QObject *object,-
1004 const QByteArray &propertyName)-
1005{-
1006-
1007-
1008-
1009 RestorableId id(object, propertyName);-
1010 for (int i = 0; i < states.size()
i < states.size()Description
TRUEevaluated 70 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 65 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
65-70
1011 QAbstractState *s = states.at(i);-
1012 QHash<QAbstractState*, QHash<RestorableId, QVariant> >::iterator it;-
1013 it = registeredRestorablesForState.find(s);-
1014 if (it == registeredRestorablesForState.end()
it == register...ForState.end()Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
24-46
1015 continue;
executed 24 times by 1 test: continue;
Executed by:
  • tst_QStateMachine
24
1016 QHash<RestorableId, QVariant> &restorables = it.value();-
1017 const auto it2 = restorables.constFind(id);-
1018 if (it2 == restorables.cend()
it2 == restorables.cend()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 37 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
9-37
1019 continue;
executed 9 times by 1 test: continue;
Executed by:
  • tst_QStateMachine
9
1020-
1021-
1022-
1023 restorables.erase(it2);-
1024 if (restorables.isEmpty()
restorables.isEmpty()Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
5-32
1025 registeredRestorablesForState.erase(it);
executed 32 times by 1 test: registeredRestorablesForState.erase(it);
Executed by:
  • tst_QStateMachine
32
1026 }
executed 37 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
37
1027}
executed 65 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
65
1028-
1029QVector<QPropertyAssignment> QStateMachinePrivate::restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const-
1030{-
1031 QVector<QPropertyAssignment> result;-
1032 QHash<RestorableId, QVariant>::const_iterator it;-
1033 for (it = restorables.constBegin(); it != restorables.constEnd()
it != restorables.constEnd()Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 23 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++it) {
23-25
1034 const RestorableId &id = it.key();-
1035 if (!id.object()
!id.object()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-24
1036-
1037 continue;
executed 1 time by 1 test: continue;
Executed by:
  • tst_QStateMachine
1
1038 }-
1039-
1040-
1041-
1042 result.append(QPropertyAssignment(id.object(), id.propertyName(), it.value(), false));-
1043 }
executed 24 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
24
1044 return
executed 23 times by 1 test: return result;
Executed by:
  • tst_QStateMachine
result;
executed 23 times by 1 test: return result;
Executed by:
  • tst_QStateMachine
23
1045}-
1046QHash<QStateMachinePrivate::RestorableId, QVariant> QStateMachinePrivate::computePendingRestorables(-
1047 const QList<QAbstractState*> &statesToExit_sorted) const-
1048{-
1049 QHash<QStateMachinePrivate::RestorableId, QVariant> restorables;-
1050 for (int i = statesToExit_sorted.size() - 1; i >= 0
i >= 0Description
TRUEevaluated 1298 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; --i) {
1235-1298
1051 QAbstractState *s = statesToExit_sorted.at(i);-
1052 QHash<QStateMachinePrivate::RestorableId, QVariant> rs = registeredRestorablesForState.value(s);-
1053 QHash<QStateMachinePrivate::RestorableId, QVariant>::const_iterator it;-
1054 for (it = rs.constBegin(); it != rs.constEnd()
it != rs.constEnd()Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1298 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
39-1298
1055 if (!restorables.contains(it.key())
!restorables.c...ains(it.key())Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-38
1056 restorables.insert(it.key(), it.value());
executed 38 times by 1 test: restorables.insert(it.key(), it.value());
Executed by:
  • tst_QStateMachine
38
1057 }
executed 39 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
39
1058 }
executed 1298 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1298
1059 return
executed 1235 times by 2 tests: return restorables;
Executed by:
  • tst_QState
  • tst_QStateMachine
restorables;
executed 1235 times by 2 tests: return restorables;
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
1060}-
1061QHash<QAbstractState*, QVector<QPropertyAssignment> > QStateMachinePrivate::computePropertyAssignments(-
1062 const QList<QAbstractState*> &statesToEnter_sorted, QHash<RestorableId, QVariant> &pendingRestorables) const-
1063{-
1064 QHash<QAbstractState*, QVector<QPropertyAssignment> > assignmentsForState;-
1065 for (int i = 0; i < statesToEnter_sorted.size()
i < statesToEn..._sorted.size()Description
TRUEevaluated 1507 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1388-1507
1066 QState *s = toStandardState(statesToEnter_sorted.at(i));-
1067 if (!s
!sDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
72-1435
1068 continue;
executed 72 times by 1 test: continue;
Executed by:
  • tst_QStateMachine
72
1069-
1070 QVector<QPropertyAssignment> &assignments = QStatePrivate::get(s)->propertyAssignments;-
1071 for (int j = 0; j < assignments.size()
j < assignments.size()Description
TRUEevaluated 110 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++j) {
110-1435
1072 const QPropertyAssignment &assn = assignments.at(j);-
1073 if (assn.objectDeleted()
assn.objectDeleted()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 109 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-109
1074 assignments.removeAt(j--);-
1075 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
1
1076 pendingRestorables.remove(RestorableId(assn.object, assn.propertyName));-
1077 assignmentsForState[s].append(assn);-
1078 }
executed 109 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
109
1079 }-
1080 }
executed 1435 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1435
1081 return
executed 1388 times by 2 tests: return assignmentsForState;
Executed by:
  • tst_QState
  • tst_QStateMachine
assignmentsForState;
executed 1388 times by 2 tests: return assignmentsForState;
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
1082}-
1083-
1084-
1085-
1086QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)-
1087{-
1088-
1089 QAbstractState *errorState = 0;-
1090 if (context != 0
context != 0Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
9-40
1091 QState *s = toStandardState(context);-
1092 if (s != 0
s != 0Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-39
1093 errorState = s->errorState();
executed 39 times by 1 test: errorState = s->errorState();
Executed by:
  • tst_QStateMachine
39
1094-
1095 if (errorState == 0
errorState == 0Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
11-29
1096 errorState = findErrorState(context->parentState());
executed 29 times by 1 test: errorState = findErrorState(context->parentState());
Executed by:
  • tst_QStateMachine
29
1097 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
40
1098-
1099 return
executed 49 times by 1 test: return errorState;
Executed by:
  • tst_QStateMachine
errorState;
executed 49 times by 1 test: return errorState;
Executed by:
  • tst_QStateMachine
49
1100}-
1101-
1102void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractState *currentContext)-
1103{-
1104 QStateMachine * const q = q_func();-
1105-
1106 error = errorCode;-
1107 switch (errorCode) {-
1108 case
executed 16 times by 1 test: case QStateMachine::NoInitialStateError:
Executed by:
  • tst_QStateMachine
QStateMachine::NoInitialStateError:
executed 16 times by 1 test: case QStateMachine::NoInitialStateError:
Executed by:
  • tst_QStateMachine
16
1109 ((!(currentContext != 0)) ? qt_assert("currentContext != 0",__FILE__,1470) : qt_noop());-
1110-
1111 errorString = QStateMachine::tr("Missing initial state in compound state '%1'")-
1112 .arg(currentContext->objectName());-
1113-
1114 break;
executed 16 times by 1 test: break;
Executed by:
  • tst_QStateMachine
16
1115 case
executed 1 time by 1 test: case QStateMachine::NoDefaultStateInHistoryStateError:
Executed by:
  • tst_QStateMachine
QStateMachine::NoDefaultStateInHistoryStateError:
executed 1 time by 1 test: case QStateMachine::NoDefaultStateInHistoryStateError:
Executed by:
  • tst_QStateMachine
1
1116 ((!(currentContext != 0)) ? qt_assert("currentContext != 0",__FILE__,1477) : qt_noop());-
1117-
1118 errorString = QStateMachine::tr("Missing default state in history state '%1'")-
1119 .arg(currentContext->objectName());-
1120 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QStateMachine
1
1121-
1122 case
executed 3 times by 1 test: case QStateMachine::NoCommonAncestorForTransitionError:
Executed by:
  • tst_QStateMachine
QStateMachine::NoCommonAncestorForTransitionError:
executed 3 times by 1 test: case QStateMachine::NoCommonAncestorForTransitionError:
Executed by:
  • tst_QStateMachine
3
1123 ((!(currentContext != 0)) ? qt_assert("currentContext != 0",__FILE__,1484) : qt_noop());-
1124-
1125 errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'")-
1126 .arg(currentContext->objectName());-
1127 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QStateMachine
3
1128 default
never executed: default:
:
never executed: default:
0
1129 errorString = QStateMachine::tr("Unknown error");-
1130 }
never executed: end of block
;
0
1131-
1132 pendingErrorStates.clear();-
1133 pendingErrorStatesForDefaultEntry.clear();-
1134-
1135 QAbstractState *currentErrorState = findErrorState(currentContext);-
1136-
1137-
1138 if (currentContext == currentErrorState
currentContext...rentErrorStateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-19
1139 currentErrorState = 0;
executed 1 time by 1 test: currentErrorState = 0;
Executed by:
  • tst_QStateMachine
1
1140-
1141 ((!(currentErrorState != rootState())) ? qt_assert("currentErrorState != rootState()",__FILE__,1502) : qt_noop());-
1142-
1143 if (currentErrorState != 0
currentErrorState != 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
10
1144-
1145-
1146-
1147 pendingErrorStates.insert(currentErrorState);-
1148 addDescendantStatesToEnter(currentErrorState, pendingErrorStates, pendingErrorStatesForDefaultEntry);-
1149 addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);-
1150 pendingErrorStates -= configuration;-
1151 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
10
1152 QMessageLogger(__FILE__, 1513, __PRETTY_FUNCTION__).warning("Unrecoverable error detected in running state machine: %s",-
1153 QString(errorString).toLocal8Bit().constData());-
1154 q->stop();-
1155 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
10
1156}-
1157-
1158-
1159-
1160QStateMachinePrivate::InitializeAnimationResult-
1161QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,-
1162 const QPropertyAssignment &prop)-
1163{-
1164 InitializeAnimationResult result;-
1165 QAnimationGroup *group = qobject_cast<QAnimationGroup*>(abstractAnimation);-
1166 if (group
groupDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 50 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
5-50
1167 for (int i = 0; i < group->animationCount()
i < group->animationCount()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
5-8
1168 QAbstractAnimation *animationChild = group->animationAt(i);-
1169 const auto ret = initializeAnimation(animationChild, prop);-
1170 result.handledAnimations << ret.handledAnimations;-
1171 result.localResetEndValues << ret.localResetEndValues;-
1172 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
8
1173 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
5
1174 QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);-
1175 if (animation != 0
animation != 0Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
0-50
1176 && prop.object == animation->targetObject()
prop.object ==...targetObject()Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
4-46
1177 && prop.propertyName == animation->propertyName()
prop.propertyN...propertyName()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
10-36
1178-
1179-
1180 if (!animation->endValue().isValid()
!animation->en...ue().isValid()Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-35
1181 animation->setEndValue(prop.value);-
1182 result.localResetEndValues.append(animation);-
1183 }
executed 35 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
35
1184 result.handledAnimations.append(animation);-
1185 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
36
1186 }
executed 50 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
50
1187 return
executed 55 times by 1 test: return result;
Executed by:
  • tst_QStateMachine
result;
executed 55 times by 1 test: return result;
Executed by:
  • tst_QStateMachine
55
1188}-
1189-
1190void QStateMachinePrivate::_q_animationFinished()-
1191{-
1192 QStateMachine * const q = q_func();-
1193 QAbstractAnimation *anim = qobject_cast<QAbstractAnimation*>(q->sender());-
1194 ((!(anim != 0)) ? qt_assert("anim != 0",__FILE__,1555) : qt_noop());-
1195 QObject::disconnect(anim, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1556"), q, qFlagLocation("1""_q_animationFinished()" "\0" __FILE__ ":" "1556"));-
1196 if (resetAnimationEndValues.contains(anim)
resetAnimation...contains(anim)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-15
1197 qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant());-
1198 resetAnimationEndValues.remove(anim);-
1199 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
15
1200-
1201 QAbstractState *state = stateForAnimation.take(anim);-
1202 ((!(state != 0)) ? qt_assert("state != 0",__FILE__,1563) : qt_noop());-
1203-
1204-
1205-
1206 QPropertyAssignment assn = propertyForAnimation.take(anim);-
1207 assn.write();-
1208 if (!assn.explicitlySet
!assn.explicitlySetDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-14
1209 unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
executed 1 time by 1 test: unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
Executed by:
  • tst_QStateMachine
1
1210-
1211-
1212 QHash<QAbstractState*, QList<QAbstractAnimation*> >::iterator it;-
1213 it = animationsForState.find(state);-
1214 ((!(it != animationsForState.end())) ? qt_assert("it != animationsForState.end()",__FILE__,1575) : qt_noop());-
1215 QList<QAbstractAnimation*> &animations = it.value();-
1216 animations.removeOne(anim);-
1217 if (animations.isEmpty()
animations.isEmpty()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
3-12
1218 animationsForState.erase(it);-
1219 QStatePrivate::get(toStandardState(state))->emitPropertiesAssigned();-
1220 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
12
1221}
executed 15 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
15
1222-
1223QList<QAbstractAnimation *> QStateMachinePrivate::selectAnimations(const QList<QAbstractTransition *> &transitionList) const-
1224{-
1225 QList<QAbstractAnimation *> selectedAnimations;-
1226 if (animated
animatedDescription
TRUEevaluated 1388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
) {
0-1388
1227 for (int i = 0; i < transitionList.size()
i < transitionList.size()Description
TRUEevaluated 1391 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1388-1391
1228 QAbstractTransition *transition = transitionList.at(i);-
1229-
1230 selectedAnimations << transition->animations();-
1231 selectedAnimations << defaultAnimationsForSource.values(transition->sourceState());-
1232-
1233 QList<QAbstractState *> targetStates = transition->targetStates();-
1234 for (int j=0; j<targetStates.size()
j<targetStates.size()Description
TRUEevaluated 1387 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1391 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++j)
1387-1391
1235 selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j));
executed 1387 times by 2 tests: selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j));
Executed by:
  • tst_QState
  • tst_QStateMachine
1387
1236 }
executed 1391 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1391
1237 selectedAnimations << defaultAnimations;-
1238 }
executed 1388 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
1239 return
executed 1388 times by 2 tests: return selectedAnimations;
Executed by:
  • tst_QState
  • tst_QStateMachine
selectedAnimations;
executed 1388 times by 2 tests: return selectedAnimations;
Executed by:
  • tst_QState
  • tst_QStateMachine
1388
1240}-
1241-
1242void QStateMachinePrivate::terminateActiveAnimations(QAbstractState *state,-
1243 const QHash<QAbstractState*, QVector<QPropertyAssignment> > &assignmentsForEnteredStates)-
1244{-
1245 QStateMachine * const q = q_func();-
1246 QList<QAbstractAnimation*> animations = animationsForState.take(state);-
1247 for (int i = 0; i < animations.size()
i < animations.size()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1298 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
20-1298
1248 QAbstractAnimation *anim = animations.at(i);-
1249 QObject::disconnect(anim, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1610"), q, qFlagLocation("1""_q_animationFinished()" "\0" __FILE__ ":" "1610"));-
1250 stateForAnimation.remove(anim);-
1251-
1252-
1253-
1254 QAbstractAnimation *topLevelAnim = anim;-
1255 while (QAnimationGroup *group = topLevelAnim->group()
QAnimationGrou...lAnim->group()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-20
1256 topLevelAnim = group;
never executed: topLevelAnim = group;
0
1257 topLevelAnim->stop();-
1258-
1259 if (resetAnimationEndValues.contains(anim)
resetAnimation...contains(anim)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-19
1260 qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant());-
1261 resetAnimationEndValues.remove(anim);-
1262 }
executed 19 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
19
1263 QPropertyAssignment assn = propertyForAnimation.take(anim);-
1264 ((!(assn.object != 0)) ? qt_assert("assn.object != 0",__FILE__,1625) : qt_noop());-
1265-
1266-
1267 bool found = false;-
1268 QHash<QAbstractState*, QVector<QPropertyAssignment> >::const_iterator it;-
1269 for (it = assignmentsForEnteredStates.constBegin(); it != assignmentsForEnteredStates.constEnd()
it != assignme...tes.constEnd()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++it) {
18-20
1270 const QVector<QPropertyAssignment> &assignments = it.value();-
1271 for (int j = 0; j < assignments.size()
j < assignments.size()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++j) {
8-18
1272 if (assignments.at(j).hasTarget(assn.object, assn.propertyName)
assignments.at....propertyName)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
8-10
1273 found = true;-
1274 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_QStateMachine
10
1275 }-
1276 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
8
1277 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
18
1278 if (!found
!foundDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
10
1279 assn.write();-
1280 if (!assn.explicitlySet
!assn.explicitlySetDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-10
1281 unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
never executed: unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
0
1282 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
10
1283 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
20
1284}
executed 1298 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1298
1285-
1286void QStateMachinePrivate::initializeAnimations(QAbstractState *state, const QList<QAbstractAnimation *> &selectedAnimations,-
1287 const QList<QAbstractState*> &exitedStates_sorted,-
1288 QHash<QAbstractState*, QVector<QPropertyAssignment> > &assignmentsForEnteredStates)-
1289{-
1290 QStateMachine * const q = q_func();-
1291 if (!assignmentsForEnteredStates.contains(state)
!assignmentsFo...ontains(state)Description
TRUEevaluated 1392 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 115 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
115-1392
1292 return;
executed 1392 times by 2 tests: return;
Executed by:
  • tst_QState
  • tst_QStateMachine
1392
1293 QVector<QPropertyAssignment> &assignments = assignmentsForEnteredStates[state];-
1294 for (int i = 0; i < selectedAnimations.size()
i < selectedAnimations.size()Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 85 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
41-85
1295 QAbstractAnimation *anim = selectedAnimations.at(i);-
1296 QVector<QPropertyAssignment>::iterator it;-
1297 for (it = assignments.begin(); it != assignments.end()
it != assignments.end()Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ) {
41-47
1298 const QPropertyAssignment &assn = *it;-
1299 const auto ret = initializeAnimation(anim, assn);-
1300 if (!ret.handledAnimations.isEmpty()
!ret.handledAn...ions.isEmpty()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
11-36
1301 for (int j = 0; j < ret.handledAnimations.size()
j < ret.handle...mations.size()Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++j) {
36
1302 QAbstractAnimation *a = ret.handledAnimations.at(j);-
1303 propertyForAnimation.insert(a, assn);-
1304 stateForAnimation.insert(a, state);-
1305 animationsForState[state].append(a);-
1306-
1307 QObject::connect(a, qFlagLocation("2""finished()" "\0" __FILE__ ":" "1668"), q, qFlagLocation("1""_q_animationFinished()" "\0" __FILE__ ":" "1668"), Qt::UniqueConnection);-
1308 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
36
1309 if ((
(globalRestore...oreProperties)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QStateMachine
globalRestorePolicy == QState::RestoreProperties)
(globalRestore...oreProperties)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QStateMachine
12-24
1310 && !hasRestorable(state, assn.object, assn.propertyName)
!hasRestorable....propertyName)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-12
1311 QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName);-
1312 unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);-
1313 registerRestorable(state, assn.object, assn.propertyName, value);-
1314 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
12
1315 it = assignments.erase(it);-
1316 }
executed 36 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
36
1317 ++it;-
1318 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
11
1319 for (int j = 0; j < ret.localResetEndValues.size()
j < ret.localR...dValues.size()Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++j)
35-47
1320 resetAnimationEndValues.insert(ret.localResetEndValues.at(j));
executed 35 times by 1 test: resetAnimationEndValues.insert(ret.localResetEndValues.at(j));
Executed by:
  • tst_QStateMachine
35
1321 }
executed 47 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
47
1322-
1323-
1324 QList<QVariantAnimation*> variantAnims = anim->findChildren<QVariantAnimation*>();-
1325 if (QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim)
QVariantAnimat...mation*>(anim)Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
3-38
1326 variantAnims.append(va);
executed 38 times by 1 test: variantAnims.append(va);
Executed by:
  • tst_QStateMachine
38
1327-
1328 bool hasValidEndValue = false;-
1329 for (int j = 0; j < variantAnims.size()
j < variantAnims.size()Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++j) {
2-41
1330 if (variantAnims.at(j)->endValue().isValid()
variantAnims.a...ue().isValid()Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-39
1331 hasValidEndValue = true;-
1332 break;
executed 39 times by 1 test: break;
Executed by:
  • tst_QStateMachine
39
1333 }-
1334 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
1335-
1336 if (hasValidEndValue
hasValidEndValueDescription
TRUEevaluated 39 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-39
1337 if (anim->state() == QAbstractAnimation::Running
anim->state() ...ation::RunningDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
5-34
1338-
1339-
1340-
1341-
1342-
1343 anim->stop();-
1344 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
5
1345 anim->start();-
1346 }
executed 39 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
39
1347-
1348 if (assignments.isEmpty()
assignments.isEmpty()Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
11-30
1349 assignmentsForEnteredStates.remove(state);-
1350 break;
executed 30 times by 1 test: break;
Executed by:
  • tst_QStateMachine
30
1351 }-
1352 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
11
1353}
executed 115 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
115
1354-
1355-
1356-
1357QAbstractTransition *QStateMachinePrivate::createInitialTransition() const-
1358{-
1359 class InitialTransition : public QAbstractTransition-
1360 {-
1361 public:-
1362 InitialTransition(const QList<QAbstractState *> &targets)-
1363 : QAbstractTransition()-
1364 { setTargetStates(targets); }
executed 153 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
153
1365 protected:-
1366 virtual bool eventTest(QEvent *) override { return
never executed: return true;
true;
never executed: return true;
}
0
1367 virtual void onTransition(QEvent *) override {}-
1368 };-
1369-
1370 QState *root = rootState();-
1371 ((!(root != 0)) ? qt_assert("root != 0",__FILE__,1732) : qt_noop());-
1372 QList<QAbstractState *> targets;-
1373 switch (root->childMode()) {-
1374 case
executed 152 times by 2 tests: case QState::ExclusiveStates:
Executed by:
  • tst_QState
  • tst_QStateMachine
QState::ExclusiveStates:
executed 152 times by 2 tests: case QState::ExclusiveStates:
Executed by:
  • tst_QState
  • tst_QStateMachine
152
1375 targets.append(root->initialState());-
1376 break;
executed 152 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
152
1377 case
executed 1 time by 1 test: case QState::ParallelStates:
Executed by:
  • tst_QStateMachine
QState::ParallelStates:
executed 1 time by 1 test: case QState::ParallelStates:
Executed by:
  • tst_QStateMachine
1
1378 targets = QStatePrivate::get(root)->childStates();-
1379 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QStateMachine
1
1380 }-
1381 return
executed 153 times by 2 tests: return new InitialTransition(targets);
Executed by:
  • tst_QState
  • tst_QStateMachine
new InitialTransition(targets);
executed 153 times by 2 tests: return new InitialTransition(targets);
Executed by:
  • tst_QState
  • tst_QStateMachine
153
1382}-
1383-
1384void QStateMachinePrivate::clearHistory()-
1385{-
1386 QStateMachine * const q = q_func();-
1387 QList<QHistoryState*> historyStates = q->findChildren<QHistoryState*>();-
1388 for (int i = 0; i < historyStates.size()
i < historyStates.size()Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 153 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
10-153
1389 QHistoryState *h = historyStates.at(i);-
1390 QHistoryStatePrivate::get(h)->configuration.clear();-
1391 }
executed 10 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
10
1392}
executed 153 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
153
1393void QStateMachinePrivate::registerMultiThreadedSignalTransitions()-
1394{-
1395 QStateMachine * const q = q_func();-
1396 QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>();-
1397 for (int i = 0; i < transitions.size()
i < transitions.size()Description
TRUEevaluated 81 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 153 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
81-153
1398 QSignalTransition *t = transitions.at(i);-
1399 if ((
(t->machine() == q)Description
TRUEevaluated 78 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
t->machine() == q)
(t->machine() == q)Description
TRUEevaluated 78 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& t->senderObject()
t->senderObject()Description
TRUEevaluated 77 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& (
(t->senderObje...= q->thread())Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
t->senderObject()->thread() != q->thread())
(t->senderObje...= q->thread())Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1-78
1400 registerSignalTransition(t);
executed 7 times by 1 test: registerSignalTransition(t);
Executed by:
  • tst_QStateMachine
7
1401 }
executed 81 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
81
1402}
executed 153 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
153
1403-
1404void QStateMachinePrivate::_q_start()-
1405{-
1406 QStateMachine * const q = q_func();-
1407 ((!(state == Starting)) ? qt_assert("state == Starting",__FILE__,1780) : qt_noop());-
1408-
1409-
1410-
1411 const auto config = configuration;-
1412 for (QAbstractState *state : config) {-
1413 QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state);-
1414 abstractStatePrivate->active = false;-
1415 state->activeChanged(false);-
1416 }
executed 25 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
25
1417 configuration.clear();-
1418 qDeleteAll(internalEventQueue);-
1419 internalEventQueue.clear();-
1420 qDeleteAll(externalEventQueue);-
1421 externalEventQueue.clear();-
1422 clearHistory();-
1423-
1424 registerMultiThreadedSignalTransitions();-
1425-
1426 startupHook();-
1427-
1428-
1429-
1430-
1431 state = Running;-
1432 processingScheduled = true;-
1433-
1434 QList<QAbstractTransition*> transitions;-
1435 CalculationCache calculationCache;-
1436 QAbstractTransition *initialTransition = createInitialTransition();-
1437 transitions.append(initialTransition);-
1438-
1439 QEvent nullEvent(QEvent::None);-
1440 executeTransitionContent(&nullEvent, transitions);-
1441 QList<QAbstractState*> exitedStates = QList<QAbstractState*>();-
1442 QSet<QAbstractState*> statesForDefaultEntry;-
1443 QList<QAbstractState*> enteredStates = computeEntrySet(transitions, statesForDefaultEntry, &calculationCache);-
1444 QHash<RestorableId, QVariant> pendingRestorables;-
1445 QHash<QAbstractState*, QVector<QPropertyAssignment> > assignmentsForEnteredStates =-
1446 computePropertyAssignments(enteredStates, pendingRestorables);-
1447-
1448 QList<QAbstractAnimation*> selectedAnimations = selectAnimations(transitions);-
1449-
1450-
1451-
1452 stopProcessingReason = EventQueueEmpty;-
1453 enterStates(&nullEvent, exitedStates, enteredStates, statesForDefaultEntry,-
1454 assignmentsForEnteredStates-
1455-
1456 , selectedAnimations-
1457-
1458 );-
1459 delete initialTransition;-
1460-
1461-
1462-
1463-
1464-
1465 q->started(QStateMachine::QPrivateSignal());-
1466 q->runningChanged(true);-
1467-
1468 if (stopProcessingReason == Finished
stopProcessing...on == FinishedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 151 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
2-151
1469-
1470 processingScheduled = false;-
1471 state = NotRunning;-
1472 unregisterAllTransitions();-
1473 emitFinished();-
1474 q->runningChanged(false);-
1475 exitInterpreter();-
1476 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
2
1477 _q_process();-
1478 }
executed 151 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
151
1479}-
1480-
1481void QStateMachinePrivate::_q_process()-
1482{-
1483 QStateMachine * const q = q_func();-
1484 ((!(state == Running)) ? qt_assert("state == Running",__FILE__,1857) : qt_noop());-
1485 ((!(!processing)) ? qt_assert("!processing",__FILE__,1858) : qt_noop());-
1486 processing = true;-
1487 processingScheduled = false;-
1488 beginMacrostep();-
1489-
1490-
1491-
1492 bool didChange = false;-
1493 while (processing
processingDescription
TRUEevaluated 1548 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 355 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
355-1548
1494 if (stop
stopDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1529 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
19-1529
1495 processing = false;-
1496 break;
executed 19 times by 1 test: break;
Executed by:
  • tst_QStateMachine
19
1497 }-
1498 QList<QAbstractTransition*> enabledTransitions;-
1499 CalculationCache calculationCache;-
1500-
1501 QEvent *e = new QEvent(QEvent::None);-
1502 enabledTransitions = selectTransitions(e, &calculationCache);-
1503 if (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 1504 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 25 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
25-1504
1504 delete e;-
1505 e = 0;-
1506 }
executed 1504 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1504
1507 while (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 1512 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& ((
((e = dequeueI...Event()) != 0)Description
TRUEevaluated 99 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1413 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
e = dequeueInternalEvent()) != 0)
((e = dequeueI...Event()) != 0)Description
TRUEevaluated 99 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1413 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
99-1512
1508-
1509-
1510-
1511 enabledTransitions = selectTransitions(e, &calculationCache);-
1512 if (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 91 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
8-91
1513 delete e;-
1514 e = 0;-
1515 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
8
1516 }
executed 99 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
99
1517 while (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 2416 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& ((
((e = dequeueE...Event()) != 0)Description
TRUEevaluated 2122 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
e = dequeueExternalEvent()) != 0)
((e = dequeueE...Event()) != 0)Description
TRUEevaluated 2122 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
294-2416
1518-
1519-
1520-
1521 enabledTransitions = selectTransitions(e, &calculationCache);-
1522 if (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 1003 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1119 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1003-1119
1523 delete e;-
1524 e = 0;-
1525 }
executed 1003 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
1003
1526 }
executed 2122 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2122
1527 if (enabledTransitions.isEmpty()
enabledTransitions.isEmpty()Description
TRUEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1235 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
294-1235
1528 if (isInternalEventQueueEmpty()
isInternalEventQueueEmpty()Description
TRUEevaluated 293 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-293
1529 processing = false;-
1530 stopProcessingReason = EventQueueEmpty;-
1531 noMicrostep();-
1532-
1533-
1534-
1535 }
executed 293 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
293
1536 }
executed 294 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
else {
294
1537 didChange = true;-
1538 q->beginMicrostep(e);-
1539 microstep(e, enabledTransitions, &calculationCache);-
1540 q->endMicrostep(e);-
1541 }
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
1542 delete e;-
1543 }
executed 1529 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1529
1544-
1545-
1546-
1547 if (stop
stopDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 352 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
22-352
1548 stop = false;-
1549 stopProcessingReason = Stopped;-
1550 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
22
1551-
1552 switch (stopProcessingReason) {-
1553 case
executed 291 times by 2 tests: case EventQueueEmpty:
Executed by:
  • tst_QState
  • tst_QStateMachine
EventQueueEmpty:
executed 291 times by 2 tests: case EventQueueEmpty:
Executed by:
  • tst_QState
  • tst_QStateMachine
291
1554 processedPendingEvents(didChange);-
1555 break;
executed 291 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
291
1556 case
executed 61 times by 1 test: case Finished:
Executed by:
  • tst_QStateMachine
Finished:
executed 61 times by 1 test: case Finished:
Executed by:
  • tst_QStateMachine
61
1557 state = NotRunning;-
1558 cancelAllDelayedEvents();-
1559 unregisterAllTransitions();-
1560 emitFinished();-
1561 q->runningChanged(false);-
1562 break;
executed 61 times by 1 test: break;
Executed by:
  • tst_QStateMachine
61
1563 case
executed 22 times by 1 test: case Stopped:
Executed by:
  • tst_QStateMachine
Stopped:
executed 22 times by 1 test: case Stopped:
Executed by:
  • tst_QStateMachine
22
1564 state = NotRunning;-
1565 cancelAllDelayedEvents();-
1566 unregisterAllTransitions();-
1567 q->stopped(QStateMachine::QPrivateSignal());-
1568 q->runningChanged(false);-
1569 break;
executed 22 times by 1 test: break;
Executed by:
  • tst_QStateMachine
22
1570 }-
1571 endMacrostep(didChange);-
1572 if (stopProcessingReason == Finished
stopProcessing...on == FinishedDescription
TRUEevaluated 61 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 313 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
61-313
1573 exitInterpreter();
executed 61 times by 1 test: exitInterpreter();
Executed by:
  • tst_QStateMachine
61
1574}
executed 374 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
374
1575-
1576void QStateMachinePrivate::_q_startDelayedEventTimer(int id, int delay)-
1577{-
1578 QStateMachine * const q = q_func();-
1579 QMutexLocker locker(&delayedEventsMutex);-
1580 QHash<int, DelayedEvent>::iterator it = delayedEvents.find(id);-
1581 if (it != delayedEvents.end()
it != delayedEvents.end()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1
1582 DelayedEvent &e = it.value();-
1583 ((!(!e.timerId)) ? qt_assert("!e.timerId",__FILE__,1956) : qt_noop());-
1584 e.timerId = q->startTimer(delay);-
1585 if (!e.timerId
!e.timerIdDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-1
1586 QMessageLogger(__FILE__, 1959, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: failed to start timer (id=%d, delay=%d)", id, delay);-
1587 delete e.event;-
1588 delayedEvents.erase(it);-
1589 delayedEventIdFreeList.release(id);-
1590 }
never executed: end of block
else {
0
1591 timerIdToDelayedEventId.insert(e.timerId, id);-
1592 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
1593 } else {-
1594-
1595 delayedEventIdFreeList.release(id);-
1596 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
1597}-
1598-
1599void QStateMachinePrivate::_q_killDelayedEventTimer(int id, int timerId)-
1600{-
1601 QStateMachine * const q = q_func();-
1602 q->killTimer(timerId);-
1603 QMutexLocker locker(&delayedEventsMutex);-
1604 delayedEventIdFreeList.release(id);-
1605}
never executed: end of block
0
1606-
1607void QStateMachinePrivate::postInternalEvent(QEvent *e)-
1608{-
1609 QMutexLocker locker(&internalEventMutex);-
1610 internalEventQueue.append(e);-
1611}
executed 99 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
99
1612-
1613void QStateMachinePrivate::postExternalEvent(QEvent *e)-
1614{-
1615 QMutexLocker locker(&externalEventMutex);-
1616 externalEventQueue.append(e);-
1617}
executed 2123 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2123
1618-
1619QEvent *QStateMachinePrivate::dequeueInternalEvent()-
1620{-
1621 QMutexLocker locker(&internalEventMutex);-
1622 if (internalEventQueue.isEmpty()
internalEventQueue.isEmpty()Description
TRUEevaluated 1413 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 99 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
99-1413
1623 return
executed 1413 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
0;
executed 1413 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
1413
1624 return
executed 99 times by 2 tests: return internalEventQueue.takeFirst();
Executed by:
  • tst_QState
  • tst_QStateMachine
internalEventQueue.takeFirst();
executed 99 times by 2 tests: return internalEventQueue.takeFirst();
Executed by:
  • tst_QState
  • tst_QStateMachine
99
1625}-
1626-
1627QEvent *QStateMachinePrivate::dequeueExternalEvent()-
1628{-
1629 QMutexLocker locker(&externalEventMutex);-
1630 if (externalEventQueue.isEmpty()
externalEventQueue.isEmpty()Description
TRUEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2122 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
294-2122
1631 return
executed 294 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
0;
executed 294 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
294
1632 return
executed 2122 times by 2 tests: return externalEventQueue.takeFirst();
Executed by:
  • tst_QState
  • tst_QStateMachine
externalEventQueue.takeFirst();
executed 2122 times by 2 tests: return externalEventQueue.takeFirst();
Executed by:
  • tst_QState
  • tst_QStateMachine
2122
1633}-
1634-
1635bool QStateMachinePrivate::isInternalEventQueueEmpty()-
1636{-
1637 QMutexLocker locker(&internalEventMutex);-
1638 return
executed 294 times by 2 tests: return internalEventQueue.isEmpty();
Executed by:
  • tst_QState
  • tst_QStateMachine
internalEventQueue.isEmpty();
executed 294 times by 2 tests: return internalEventQueue.isEmpty();
Executed by:
  • tst_QState
  • tst_QStateMachine
294
1639}-
1640-
1641bool QStateMachinePrivate::isExternalEventQueueEmpty()-
1642{-
1643 QMutexLocker locker(&externalEventMutex);-
1644 return
never executed: return externalEventQueue.isEmpty();
externalEventQueue.isEmpty();
never executed: return externalEventQueue.isEmpty();
0
1645}-
1646-
1647void QStateMachinePrivate::processEvents(EventProcessingMode processingMode)-
1648{-
1649 QStateMachine * const q = q_func();-
1650 if ((
(state != Running)Description
TRUEnever evaluated
FALSEevaluated 2249 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
state != Running)
(state != Running)Description
TRUEnever evaluated
FALSEevaluated 2249 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| processing
processingDescription
TRUEevaluated 1524 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 725 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| processingScheduled
processingScheduledDescription
TRUEevaluated 502 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 223 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-2249
1651 return;
executed 2026 times by 1 test: return;
Executed by:
  • tst_QStateMachine
2026
1652 switch (processingMode) {-
1653 case
executed 93 times by 2 tests: case DirectProcessing:
Executed by:
  • tst_QState
  • tst_QStateMachine
DirectProcessing:
executed 93 times by 2 tests: case DirectProcessing:
Executed by:
  • tst_QState
  • tst_QStateMachine
93
1654 if (QThread::currentThread() == q->thread()
QThread::curre...== q->thread()Description
TRUEevaluated 93 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
) {
0-93
1655 _q_process();-
1656 break;
executed 93 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
93
1657 }-
1658 case
executed 130 times by 2 tests: case QueuedProcessing:
Executed by:
  • tst_QState
  • tst_QStateMachine
code before this statement never executed: case QueuedProcessing:
executed 130 times by 2 tests: case QueuedProcessing:
Executed by:
  • tst_QState
  • tst_QStateMachine
QueuedProcessing:
code before this statement never executed: case QueuedProcessing:
executed 130 times by 2 tests: case QueuedProcessing:
Executed by:
  • tst_QState
  • tst_QStateMachine
0-130
1659 processingScheduled = true;-
1660 QMetaObject::invokeMethod(q, "_q_process", Qt::QueuedConnection);-
1661 break;
executed 130 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
130
1662 }-
1663}
executed 223 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
223
1664-
1665void QStateMachinePrivate::cancelAllDelayedEvents()-
1666{-
1667 QStateMachine * const q = q_func();-
1668 QMutexLocker locker(&delayedEventsMutex);-
1669 QHash<int, DelayedEvent>::const_iterator it;-
1670 for (it = delayedEvents.constBegin(); it != delayedEvents.constEnd()
it != delayedEvents.constEnd()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 83 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++it) {
2-83
1671 const DelayedEvent &e = it.value();-
1672 if (e.timerId
e.timerIdDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-2
1673 timerIdToDelayedEventId.remove(e.timerId);-
1674 q->killTimer(e.timerId);-
1675 delayedEventIdFreeList.release(it.key());-
1676 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
2
1677-
1678 }
never executed: end of block
0
1679 delete e.event;-
1680 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
1681 delayedEvents.clear();-
1682}
executed 83 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
83
1683-
1684-
1685-
1686-
1687-
1688-
1689-
1690void QStateMachinePrivate::noMicrostep()-
1691{ }-
1692void QStateMachinePrivate::processedPendingEvents(bool didChange)-
1693{-
1694 (void)didChange;;-
1695}
executed 291 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
291
1696-
1697void QStateMachinePrivate::beginMacrostep()-
1698{ }-
1699-
1700void QStateMachinePrivate::endMacrostep(bool didChange)-
1701{-
1702 (void)didChange;;-
1703}
executed 374 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
374
1704-
1705void QStateMachinePrivate::exitInterpreter()-
1706{-
1707}-
1708-
1709void QStateMachinePrivate::emitStateFinished(QState *forState, QFinalState *guiltyState)-
1710{-
1711 (void)guiltyState;;-
1712 ((!(guiltyState)) ? qt_assert("guiltyState",__FILE__,2106) : qt_noop());-
1713-
1714-
1715-
1716-
1717-
1718-
1719 QStatePrivate::get(forState)->emitFinished();-
1720}
executed 11 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
11
1721-
1722void QStateMachinePrivate::startupHook()-
1723{-
1724}-
1725-
1726namespace _QStateMachine_Internal{-
1727-
1728class GoToStateTransition : public QAbstractTransition-
1729{-
1730 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
1731#pragma GCC diagnostic push-
1732 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: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
1733#pragma GCC diagnostic pop-
1734 struct QPrivateSignal {};-
1735public:-
1736 GoToStateTransition(QAbstractState *target)-
1737 : QAbstractTransition()-
1738 { setTargetState(target); }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
4
1739protected:-
1740 void onTransition(QEvent *) override { deleteLater(); }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
4
1741 bool eventTest(QEvent *) override { return
executed 4 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
}
4
1742};-
1743-
1744}-
1745-
1746-
1747using namespace _QStateMachine_Internal;-
1748void QStateMachinePrivate::goToState(QAbstractState *targetState)-
1749{-
1750 if (!targetState
!targetStateDescription
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-7
1751 QMessageLogger(__FILE__, 2152, __PRETTY_FUNCTION__).warning("QStateMachine::goToState(): cannot go to null state");-
1752 return;
never executed: return;
0
1753 }-
1754-
1755 if (configuration.contains(targetState)
configuration....s(targetState)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
2-5
1756 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QStateMachine
2
1757-
1758 ((!(state == Running)) ? qt_assert("state == Running",__FILE__,2159) : qt_noop());-
1759 QState *sourceState = 0;-
1760 QSet<QAbstractState*>::const_iterator it;-
1761 for (it = configuration.constBegin(); it != configuration.constEnd()
it != configuration.constEnd()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
; ++it) {
0-5
1762 sourceState = toStandardState(*it);-
1763 if (sourceState != 0
sourceState != 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-5
1764 break;
executed 5 times by 1 test: break;
Executed by:
  • tst_QStateMachine
5
1765 }
never executed: end of block
0
1766-
1767 ((!(sourceState != 0)) ? qt_assert("sourceState != 0",__FILE__,2168) : qt_noop());-
1768-
1769-
1770 GoToStateTransition *trans = sourceState->findChild<GoToStateTransition*>();-
1771 if (!trans
!transDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-4
1772 trans = new GoToStateTransition(targetState);-
1773 sourceState->addTransition(trans);-
1774 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
4
1775 trans->setTargetState(targetState);-
1776 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
1777-
1778 processEvents(QueuedProcessing);-
1779}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
5
1780-
1781void QStateMachinePrivate::registerTransitions(QAbstractState *state)-
1782{-
1783 QState *group = toStandardState(state);-
1784 if (!group
!groupDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
72-1435
1785 return;
executed 72 times by 1 test: return;
Executed by:
  • tst_QStateMachine
72
1786 QList<QAbstractTransition*> transitions = QStatePrivate::get(group)->transitions();-
1787 for (int i = 0; i < transitions.size()
i < transitions.size()Description
TRUEevaluated 2314 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1435 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
1435-2314
1788 QAbstractTransition *t = transitions.at(i);-
1789 registerTransition(t);-
1790 }
executed 2314 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2314
1791}
executed 1435 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1435
1792-
1793void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transition)-
1794{-
1795 if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
QSignalTransit...*>(transition)Description
TRUEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
70-154
1796 maybeRegisterSignalTransition(st);-
1797 }
executed 70 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
70
1798-
1799 else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)
QEventTransiti...*>(transition)Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 138 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
16-138
1800 maybeRegisterEventTransition(et);-
1801 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
16
1802-
1803}
executed 224 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
224
1804-
1805void QStateMachinePrivate::registerTransition(QAbstractTransition *transition)-
1806{-
1807 if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
QSignalTransit...*>(transition)Description
TRUEevaluated 1083 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1231 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1083-1231
1808 registerSignalTransition(st);-
1809 }
executed 1083 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1083
1810-
1811 else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)
QEventTransiti...*>(transition)Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1211 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
20-1211
1812 registerEventTransition(oet);-
1813 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
20
1814-
1815}
executed 2314 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2314
1816-
1817void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition)-
1818{-
1819 if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
QSignalTransit...*>(transition)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-3
1820 unregisterSignalTransition(st);-
1821 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
1822-
1823 else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)
QEventTransiti...*>(transition)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-2
1824 unregisterEventTransition(oet);-
1825 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
1826-
1827}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
5
1828-
1829void QStateMachinePrivate::maybeRegisterSignalTransition(QSignalTransition *transition)-
1830{-
1831 QStateMachine * const q = q_func();-
1832 if ((
(state == Running)Description
TRUEevaluated 200012 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
state == Running)
(state == Running)Description
TRUEevaluated 200012 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 68 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& (configuration.contains(transition->sourceState())
configuration....sourceState())Description
TRUEevaluated 200011 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
1-200012
1833 || (transition->senderObject()
transition->senderObject()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
&& (
(transition->s...= q->thread())Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
transition->senderObject()->thread() != q->thread())
(transition->s...= q->thread())Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
))) {
0-1
1834 registerSignalTransition(transition);-
1835 }
executed 200011 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
200011
1836}
executed 200080 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
200080
1837-
1838void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transition)-
1839{-
1840 QStateMachine * const q = q_func();-
1841 if (QSignalTransitionPrivate::get(transition)->signalIndex != -1
QSignalTransit...nalIndex != -1Description
TRUEevaluated 1011 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 200090 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1011-200090
1842 return;
executed 1011 times by 1 test: return;
Executed by:
  • tst_QStateMachine
1011
1843 const QObject *sender = QSignalTransitionPrivate::get(transition)->sender;-
1844 if (!sender
!senderDescription
TRUEevaluated 100003 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 99734 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
99734-100003
1845 return;
executed 100003 times by 1 test: return;
Executed by:
  • tst_QStateMachine
100003
1846 QByteArray signal = QSignalTransitionPrivate::get(transition)->signal;-
1847 if (signal.isEmpty()
signal.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 100086 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1-100086
1848 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
1849 if (signal.startsWith('0'+2)
signal.startsWith('0'+2)Description
TRUEevaluated 100084 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
2-100084
1850 signal.remove(0, 1);
executed 100084 times by 2 tests: signal.remove(0, 1);
Executed by:
  • tst_QState
  • tst_QStateMachine
100084
1851 const QMetaObject *meta = sender->metaObject();-
1852 int signalIndex = meta->indexOfSignal(signal);-
1853 int originalSignalIndex = signalIndex;-
1854 if (signalIndex == -1
signalIndex == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 100085 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-100085
1855 signalIndex = meta->indexOfSignal(QMetaObject::normalizedSignature(signal));-
1856 if (signalIndex == -1
signalIndex == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-1
1857 QMessageLogger(__FILE__, 2258, __PRETTY_FUNCTION__).warning("QSignalTransition: no such signal: %s::%s",-
1858 meta->className(), signal.constData());-
1859 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
1860 }-
1861 originalSignalIndex = signalIndex;-
1862 }
never executed: end of block
0
1863-
1864-
1865 while (meta->method(signalIndex).attributes() & QMetaMethod::Cloned
meta->method(s...Method::ClonedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 100085 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
2-100085
1866 --
executed 2 times by 1 test: --signalIndex;
Executed by:
  • tst_QStateMachine
signalIndex;
executed 2 times by 1 test: --signalIndex;
Executed by:
  • tst_QStateMachine
2
1867-
1868 connectionsMutex.lock();-
1869 QVector<int> &connectedSignalIndexes = connections[sender];-
1870 if (connectedSignalIndexes.size() <= signalIndex
connectedSigna...<= signalIndexDescription
TRUEevaluated 100072 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
13-100072
1871 connectedSignalIndexes.resize(signalIndex+1);
executed 100072 times by 2 tests: connectedSignalIndexes.resize(signalIndex+1);
Executed by:
  • tst_QState
  • tst_QStateMachine
100072
1872 if (connectedSignalIndexes.at(signalIndex) == 0
connectedSigna...nalIndex) == 0Description
TRUEevaluated 100073 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
12-100073
1873 if (!signalEventGenerator
!signalEventGeneratorDescription
TRUEevaluated 43 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 100030 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
43-100030
1874 signalEventGenerator = new QSignalEventGenerator(q);
executed 43 times by 2 tests: signalEventGenerator = new QSignalEventGenerator(q);
Executed by:
  • tst_QState
  • tst_QStateMachine
43
1875 static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset();-
1876 bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, generatorMethodOffset);-
1877 if (!ok
!okDescription
TRUEnever evaluated
FALSEevaluated 100073 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
0-100073
1878-
1879-
1880-
1881-
1882-
1883 return;
never executed: return;
0
1884 }-
1885 }
executed 100073 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
100073
1886 ++connectedSignalIndexes[signalIndex];-
1887 connectionsMutex.unlock();-
1888-
1889 QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex;-
1890 QSignalTransitionPrivate::get(transition)->originalSignalIndex = originalSignalIndex;-
1891-
1892-
1893-
1894-
1895-
1896}
executed 100085 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
100085
1897-
1898void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transition)-
1899{-
1900 int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex;-
1901 if (signalIndex == -1
signalIndex == -1Description
TRUEnever evaluated
FALSEevaluated 100049 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-100049
1902 return;
never executed: return;
0
1903 const QObject *sender = QSignalTransitionPrivate::get(transition)->sender;-
1904 QSignalTransitionPrivate::get(transition)->signalIndex = -1;-
1905-
1906 connectionsMutex.lock();-
1907 QVector<int> &connectedSignalIndexes = connections[sender];-
1908 ((!(connectedSignalIndexes.size() > signalIndex)) ? qt_assert("connectedSignalIndexes.size() > signalIndex",__FILE__,2309) : qt_noop());-
1909 ((!(connectedSignalIndexes.at(signalIndex) != 0)) ? qt_assert("connectedSignalIndexes.at(signalIndex) != 0",__FILE__,2310) : qt_noop());-
1910 if (--
--connectedSig...nalIndex] == 0Description
TRUEevaluated 100048 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
connectedSignalIndexes[signalIndex] == 0
--connectedSig...nalIndex] == 0Description
TRUEevaluated 100048 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-100048
1911 ((!(signalEventGenerator != 0)) ? qt_assert("signalEventGenerator != 0",__FILE__,2312) : qt_noop());-
1912 static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset();-
1913 QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset);-
1914 int sum = 0;-
1915 for (int i = 0; i < connectedSignalIndexes.size()
i < connectedS...Indexes.size()Description
TRUEevaluated 300412 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 100048 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i)
100048-300412
1916 sum += connectedSignalIndexes.at(i);
executed 300412 times by 1 test: sum += connectedSignalIndexes.at(i);
Executed by:
  • tst_QStateMachine
300412
1917 if (sum == 0
sum == 0Description
TRUEevaluated 100038 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
10-100038
1918 connections.remove(sender);
executed 100038 times by 1 test: connections.remove(sender);
Executed by:
  • tst_QStateMachine
100038
1919 }
executed 100048 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
100048
1920 connectionsMutex.unlock();-
1921}
executed 100049 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
100049
1922-
1923void QStateMachinePrivate::unregisterAllTransitions()-
1924{-
1925 QStateMachine * const q = q_func();-
1926 {-
1927 QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>();-
1928 for (int i = 0; i < transitions.size()
i < transitions.size()Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 85 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
47-85
1929 QSignalTransition *t = transitions.at(i);-
1930 if (t->machine() == q
t->machine() == qDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
3-44
1931 unregisterSignalTransition(t);
executed 44 times by 1 test: unregisterSignalTransition(t);
Executed by:
  • tst_QStateMachine
44
1932 }
executed 47 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
47
1933 }-
1934 {-
1935 QList<QEventTransition*> transitions = rootState()->findChildren<QEventTransition*>();-
1936 for (int i = 0; i < transitions.size()
i < transitions.size()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 85 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
15-85
1937 QEventTransition *t = transitions.at(i);-
1938 if (t->machine() == q
t->machine() == qDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
)
0-15
1939 unregisterEventTransition(t);
executed 15 times by 1 test: unregisterEventTransition(t);
Executed by:
  • tst_QStateMachine
15
1940 }
executed 15 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
15
1941 }-
1942}
executed 85 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
85
1943-
1944-
1945void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition)-
1946{-
1947 if ((
(state == Running)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
state == Running)
(state == Running)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& configuration.contains(transition->sourceState())
configuration....sourceState())Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-15
1948 registerEventTransition(transition);
executed 7 times by 1 test: registerEventTransition(transition);
Executed by:
  • tst_QStateMachine
7
1949}
executed 23 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
23
1950-
1951void QStateMachinePrivate::registerEventTransition(QEventTransition *transition)-
1952{-
1953 QStateMachine * const q = q_func();-
1954 if (QEventTransitionPrivate::get(transition)->registered
QEventTransiti...n)->registeredDescription
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-27
1955 return;
never executed: return;
0
1956 if (transition->eventType() >= QEvent::User
transition->ev...= QEvent::UserDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-26
1957 QMessageLogger(__FILE__, 2358, __PRETTY_FUNCTION__).warning("QObject event transitions are not supported for custom types");-
1958 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
1959 }-
1960 QObject *object = QEventTransitionPrivate::get(transition)->object;-
1961 if (!object
!objectDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-26
1962 return;
never executed: return;
0
1963 QObjectPrivate *od = QObjectPrivate::get(object);-
1964 if (!od->extraData
!od->extraDataDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QStateMachine
|| !od->extraData->eventFilters.contains(q)
!od->extraData...rs.contains(q)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
5-21
1965 object->installEventFilter(q);
executed 19 times by 1 test: object->installEventFilter(q);
Executed by:
  • tst_QStateMachine
19
1966 ++qobjectEvents[object][transition->eventType()];-
1967 QEventTransitionPrivate::get(transition)->registered = true;-
1968-
1969-
1970-
1971-
1972-
1973}
executed 26 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
26
1974-
1975void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transition)-
1976{-
1977 QStateMachine * const q = q_func();-
1978 if (!QEventTransitionPrivate::get(transition)->registered
!QEventTransit...n)->registeredDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-20
1979 return;
never executed: return;
0
1980 QObject *object = QEventTransitionPrivate::get(transition)->object;-
1981 QHash<QEvent::Type, int> &events = qobjectEvents[object];-
1982 ((!(events.value(transition->eventType()) > 0)) ? qt_assert("events.value(transition->eventType()) > 0",__FILE__,2383) : qt_noop());-
1983 if (--
--events[trans...ntType()] == 0Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
events[transition->eventType()] == 0
--events[trans...ntType()] == 0Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-19
1984 events.remove(transition->eventType());-
1985 int sum = 0;-
1986 QHash<QEvent::Type, int>::const_iterator it;-
1987 for (it = events.constBegin(); it != events.constEnd()
it != events.constEnd()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 19 times by 1 test
Evaluated by:
  • tst_QStateMachine
; ++it)
3-19
1988 sum += it.value();
executed 3 times by 1 test: sum += it.value();
Executed by:
  • tst_QStateMachine
3
1989 if (sum == 0
sum == 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
3-16
1990 qobjectEvents.remove(object);-
1991 object->removeEventFilter(q);-
1992 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
16
1993 }
executed 19 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
19
1994 QEventTransitionPrivate::get(transition)->registered = false;-
1995}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
20
1996-
1997void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event)-
1998{-
1999 if (qobjectEvents.value(watched).contains(event->type())
qobjectEvents....event->type())Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-25
2000 postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event)));-
2001 processEvents(DirectProcessing);-
2002 }
executed 25 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
25
2003}
executed 27 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
27
2004-
2005-
2006void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalIndex,-
2007 void **argv)-
2008{-
2009-
2010 connectionsMutex.lock();-
2011 ((!(connections[sender].at(signalIndex) != 0)) ? qt_assert("connections[sender].at(signalIndex) != 0",__FILE__,2412) : qt_noop());-
2012 connectionsMutex.unlock();-
2013-
2014 const QMetaObject *meta = sender->metaObject();-
2015 QMetaMethod method = meta->method(signalIndex);-
2016 int argc = method.parameterCount();-
2017 QList<QVariant> vargs;-
2018 vargs.reserve(argc);-
2019 for (int i = 0; i < argc
i < argcDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
10-70
2020 int type = method.parameterType(i);-
2021 vargs.append(QVariant(type, argv[i+1]));-
2022 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
10
2023-
2024-
2025-
2026-
2027-
2028 postInternalEvent(new QStateMachine::SignalEvent(sender, signalIndex, vargs));-
2029 processEvents(DirectProcessing);-
2030}
executed 70 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
70
2031-
2032-
2033-
2034-
2035QStateMachine::QStateMachine(QObject *parent)-
2036 : QState(*new QStateMachinePrivate, 0)-
2037{-
2038-
2039-
2040 setParent(parent);-
2041}
executed 139 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
139
2042-
2043-
2044-
2045-
2046-
2047-
2048-
2049QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent)-
2050 : QState(*new QStateMachinePrivate, 0)-
2051{-
2052 QStateMachinePrivate * const d = d_func();-
2053 d->childMode = childMode;-
2054 setParent(parent);-
2055}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
6
2056-
2057-
2058-
2059-
2060QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent)-
2061 : QState(dd, 0)-
2062{-
2063 setParent(parent);-
2064}
never executed: end of block
0
2065-
2066-
2067-
2068-
2069QStateMachine::~QStateMachine()-
2070{-
2071}-
2072QStateMachine::Error QStateMachine::error() const-
2073{-
2074 const QStateMachinePrivate * const d = d_func();-
2075 return
executed 13 times by 1 test: return d->error;
Executed by:
  • tst_QStateMachine
d->error;
executed 13 times by 1 test: return d->error;
Executed by:
  • tst_QStateMachine
13
2076}-
2077-
2078-
2079-
2080-
2081QString QStateMachine::errorString() const-
2082{-
2083 const QStateMachinePrivate * const d = d_func();-
2084 return
executed 11 times by 1 test: return d->errorString;
Executed by:
  • tst_QStateMachine
d->errorString;
executed 11 times by 1 test: return d->errorString;
Executed by:
  • tst_QStateMachine
11
2085}-
2086-
2087-
2088-
2089-
2090void QStateMachine::clearError()-
2091{-
2092 QStateMachinePrivate * const d = d_func();-
2093 d->errorString.clear();-
2094 d->error = NoError;-
2095}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
2096-
2097-
2098-
2099-
2100-
2101-
2102QState::RestorePolicy QStateMachine::globalRestorePolicy() const-
2103{-
2104 const QStateMachinePrivate * const d = d_func();-
2105 return
executed 1 time by 1 test: return d->globalRestorePolicy;
Executed by:
  • tst_QStateMachine
d->globalRestorePolicy;
executed 1 time by 1 test: return d->globalRestorePolicy;
Executed by:
  • tst_QStateMachine
1
2106}-
2107-
2108-
2109-
2110-
2111-
2112-
2113-
2114void QStateMachine::setGlobalRestorePolicy(QState::RestorePolicy restorePolicy)-
2115{-
2116 QStateMachinePrivate * const d = d_func();-
2117 d->globalRestorePolicy = restorePolicy;-
2118}
executed 18 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
18
2119void QStateMachine::addState(QAbstractState *state)-
2120{-
2121 if (!state
!stateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-47
2122 QMessageLogger(__FILE__, 2572, __PRETTY_FUNCTION__).warning("QStateMachine::addState: cannot add null state");-
2123 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
2124 }-
2125 if (QAbstractStatePrivate::get(state)->machine() == this
QAbstractState...hine() == thisDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 45 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-45
2126 QMessageLogger(__FILE__, 2576, __PRETTY_FUNCTION__).warning("QStateMachine::addState: state has already been added to this machine");-
2127 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QStateMachine
2
2128 }-
2129 state->setParent(this);-
2130}
executed 45 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
45
2131-
2132-
2133-
2134-
2135-
2136-
2137-
2138void QStateMachine::removeState(QAbstractState *state)-
2139{-
2140 if (!state
!stateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-3
2141 QMessageLogger(__FILE__, 2591, __PRETTY_FUNCTION__).warning("QStateMachine::removeState: cannot remove null state");-
2142 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
2143 }-
2144 if (QAbstractStatePrivate::get(state)->machine() != this
QAbstractState...hine() != thisDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-2
2145 QMessageLogger(__FILE__, 2595, __PRETTY_FUNCTION__).warning("QStateMachine::removeState: state %p's machine (%p)"-
2146 " is different from this machine (%p)",-
2147 state, QAbstractStatePrivate::get(state)->machine(), this);-
2148 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
2149 }-
2150 state->setParent(0);-
2151}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
2152-
2153bool QStateMachine::isRunning() const-
2154{-
2155 const QStateMachinePrivate * const d = d_func();-
2156 return
executed 174 times by 1 test: return (d->state == QStateMachinePrivate::Running);
Executed by:
  • tst_QStateMachine
(d->state == QStateMachinePrivate::Running);
executed 174 times by 1 test: return (d->state == QStateMachinePrivate::Running);
Executed by:
  • tst_QStateMachine
174
2157}-
2158void QStateMachine::start()-
2159{-
2160 QStateMachinePrivate * const d = d_func();-
2161-
2162 if ((
(childMode() =...clusiveStates)Description
TRUEevaluated 157 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
childMode() == QState::ExclusiveStates)
(childMode() =...clusiveStates)Description
TRUEevaluated 157 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& (
(initialState() == 0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
initialState() == 0)
(initialState() == 0)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-157
2163 QMessageLogger(__FILE__, 2625, __PRETTY_FUNCTION__).warning("QStateMachine::start: No initial state set for machine. Refusing to start.");-
2164 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QStateMachine
3
2165 }-
2166-
2167 switch (d->state) {-
2168 case
executed 153 times by 2 tests: case QStateMachinePrivate::NotRunning:
Executed by:
  • tst_QState
  • tst_QStateMachine
QStateMachinePrivate::NotRunning:
executed 153 times by 2 tests: case QStateMachinePrivate::NotRunning:
Executed by:
  • tst_QState
  • tst_QStateMachine
153
2169 d->state = QStateMachinePrivate::Starting;-
2170 QMetaObject::invokeMethod(this, "_q_start", Qt::QueuedConnection);-
2171 break;
executed 153 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
153
2172 case
never executed: case QStateMachinePrivate::Starting:
QStateMachinePrivate::Starting:
never executed: case QStateMachinePrivate::Starting:
0
2173 break;
never executed: break;
0
2174 case
executed 2 times by 1 test: case QStateMachinePrivate::Running:
Executed by:
  • tst_QStateMachine
QStateMachinePrivate::Running:
executed 2 times by 1 test: case QStateMachinePrivate::Running:
Executed by:
  • tst_QStateMachine
2
2175 QMessageLogger(__FILE__, 2637, __PRETTY_FUNCTION__).warning("QStateMachine::start(): already running");-
2176 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QStateMachine
2
2177 }-
2178}
executed 155 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
155
2179-
2180-
2181-
2182-
2183-
2184-
2185-
2186void QStateMachine::stop()-
2187{-
2188 QStateMachinePrivate * const d = d_func();-
2189 switch (d->state) {-
2190 case
executed 7 times by 1 test: case QStateMachinePrivate::NotRunning:
Executed by:
  • tst_QStateMachine
QStateMachinePrivate::NotRunning:
executed 7 times by 1 test: case QStateMachinePrivate::NotRunning:
Executed by:
  • tst_QStateMachine
7
2191 break;
executed 7 times by 1 test: break;
Executed by:
  • tst_QStateMachine
7
2192 case
never executed: case QStateMachinePrivate::Starting:
QStateMachinePrivate::Starting:
never executed: case QStateMachinePrivate::Starting:
0
2193-
2194 d->stop = true;-
2195 break;
never executed: break;
0
2196 case
executed 22 times by 1 test: case QStateMachinePrivate::Running:
Executed by:
  • tst_QStateMachine
QStateMachinePrivate::Running:
executed 22 times by 1 test: case QStateMachinePrivate::Running:
Executed by:
  • tst_QStateMachine
22
2197 d->stop = true;-
2198 d->processEvents(QStateMachinePrivate::QueuedProcessing);-
2199 break;
executed 22 times by 1 test: break;
Executed by:
  • tst_QStateMachine
22
2200 }-
2201}
executed 29 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
29
2202-
2203void QStateMachine::setRunning(bool running)-
2204{-
2205 if (running
runningDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
4-5
2206 start();
executed 4 times by 1 test: start();
Executed by:
  • tst_QStateMachine
4
2207 else-
2208 stop();
executed 5 times by 1 test: stop();
Executed by:
  • tst_QStateMachine
5
2209}-
2210void QStateMachine::postEvent(QEvent *event, EventPriority priority)-
2211{-
2212 QStateMachinePrivate * const d = d_func();-
2213 switch (d->state) {-
2214 case
executed 2123 times by 2 tests: case QStateMachinePrivate::Running:
Executed by:
  • tst_QState
  • tst_QStateMachine
QStateMachinePrivate::Running:
executed 2123 times by 2 tests: case QStateMachinePrivate::Running:
Executed by:
  • tst_QState
  • tst_QStateMachine
2123
2215 case
never executed: case QStateMachinePrivate::Starting:
QStateMachinePrivate::Starting:
never executed: case QStateMachinePrivate::Starting:
0
2216 break;
executed 2123 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
2123
2217 default
executed 2 times by 1 test: default:
Executed by:
  • tst_QStateMachine
:
executed 2 times by 1 test: default:
Executed by:
  • tst_QStateMachine
2
2218 QMessageLogger(__FILE__, 2695, __PRETTY_FUNCTION__).warning("QStateMachine::postEvent: cannot post event when the state machine is not running");-
2219 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QStateMachine
2
2220 }-
2221 if (!event
!eventDescription
TRUEnever evaluated
FALSEevaluated 2123 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
0-2123
2222 QMessageLogger(__FILE__, 2699, __PRETTY_FUNCTION__).warning("QStateMachine::postEvent: cannot post null event");-
2223 return;
never executed: return;
0
2224 }-
2225-
2226-
2227-
2228 switch (priority) {-
2229 case
executed 2119 times by 2 tests: case NormalPriority:
Executed by:
  • tst_QState
  • tst_QStateMachine
NormalPriority:
executed 2119 times by 2 tests: case NormalPriority:
Executed by:
  • tst_QState
  • tst_QStateMachine
2119
2230 d->postExternalEvent(event);-
2231 break;
executed 2119 times by 2 tests: break;
Executed by:
  • tst_QState
  • tst_QStateMachine
2119
2232 case
executed 4 times by 1 test: case HighPriority:
Executed by:
  • tst_QStateMachine
HighPriority:
executed 4 times by 1 test: case HighPriority:
Executed by:
  • tst_QStateMachine
4
2233 d->postInternalEvent(event);-
2234 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_QStateMachine
4
2235 }-
2236 d->processEvents(QStateMachinePrivate::QueuedProcessing);-
2237}
executed 2123 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2123
2238int QStateMachine::postDelayedEvent(QEvent *event, int delay)-
2239{-
2240 QStateMachinePrivate * const d = d_func();-
2241 if (d->state != QStateMachinePrivate::Running
d->state != QS...ivate::RunningDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-9
2242 QMessageLogger(__FILE__, 2736, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: cannot post event when the state machine is not running");-
2243 return
never executed: return -1;
-1;
never executed: return -1;
0
2244 }-
2245 if (!event
!eventDescription
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-9
2246 QMessageLogger(__FILE__, 2740, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: cannot post null event");-
2247 return
never executed: return -1;
-1;
never executed: return -1;
0
2248 }-
2249 if (delay < 0
delay < 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-9
2250 QMessageLogger(__FILE__, 2744, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: delay cannot be negative");-
2251 return
never executed: return -1;
-1;
never executed: return -1;
0
2252 }-
2253-
2254-
2255-
2256 QMutexLocker locker(&d->delayedEventsMutex);-
2257 int id = d->delayedEventIdFreeList.next();-
2258 bool inMachineThread = (QThread::currentThread() == thread());-
2259 int timerId = inMachineThread
inMachineThreadDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
? startTimer(delay) : 0;
2-7
2260 if (inMachineThread
inMachineThreadDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& !timerId
!timerIdDescription
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-7
2261 QMessageLogger(__FILE__, 2755, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: failed to start timer with interval %d", delay);-
2262 d->delayedEventIdFreeList.release(id);-
2263 return
never executed: return -1;
-1;
never executed: return -1;
0
2264 }-
2265 QStateMachinePrivate::DelayedEvent delayedEvent(event, timerId);-
2266 d->delayedEvents.insert(id, delayedEvent);-
2267 if (timerId
timerIdDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-7
2268 d->timerIdToDelayedEventId.insert(timerId, id);-
2269 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
7
2270 ((!(!inMachineThread)) ? qt_assert("!inMachineThread",__FILE__,2764) : qt_noop());-
2271 QMetaObject::invokeMethod(this, "_q_startDelayedEventTimer",-
2272 Qt::QueuedConnection,-
2273 QArgument<int >("int", id),-
2274 QArgument<int >("int", delay));-
2275 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
2276 return
executed 9 times by 1 test: return id;
Executed by:
  • tst_QStateMachine
id;
executed 9 times by 1 test: return id;
Executed by:
  • tst_QStateMachine
9
2277}-
2278bool QStateMachine::cancelDelayedEvent(int id)-
2279{-
2280 QStateMachinePrivate * const d = d_func();-
2281 if (d->state != QStateMachinePrivate::Running
d->state != QS...ivate::RunningDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-5
2282 QMessageLogger(__FILE__, 2786, __PRETTY_FUNCTION__).warning("QStateMachine::cancelDelayedEvent: the machine is not running");-
2283 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QStateMachine
1
2284 }-
2285 QMutexLocker locker(&d->delayedEventsMutex);-
2286 QStateMachinePrivate::DelayedEvent e = d->delayedEvents.take(id);-
2287 if (!e.event
!e.eventDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
2-3
2288 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
2
2289 if (e.timerId
e.timerIdDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-2
2290 d->timerIdToDelayedEventId.remove(e.timerId);-
2291 bool inMachineThread = (QThread::currentThread() == thread());-
2292 if (inMachineThread
inMachineThreadDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-2
2293 killTimer(e.timerId);-
2294 d->delayedEventIdFreeList.release(id);-
2295 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
else {
2
2296 QMetaObject::invokeMethod(this, "_q_killDelayedEventTimer",-
2297 Qt::QueuedConnection,-
2298 QArgument<int >("int", id),-
2299 QArgument<int >("int", e.timerId));-
2300 }
never executed: end of block
0
2301 } else {-
2302-
2303 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
2304 delete e.event;-
2305 return
executed 3 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 3 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
3
2306}-
2307QSet<QAbstractState*> QStateMachine::configuration() const-
2308{-
2309 const QStateMachinePrivate * const d = d_func();-
2310 return
executed 938 times by 2 tests: return d->configuration;
Executed by:
  • tst_QState
  • tst_QStateMachine
d->configuration;
executed 938 times by 2 tests: return d->configuration;
Executed by:
  • tst_QState
  • tst_QStateMachine
938
2311}-
2312bool QStateMachine::event(QEvent *e)-
2313{-
2314 QStateMachinePrivate * const d = d_func();-
2315 if (e->type() == QEvent::Timer
e->type() == QEvent::TimerDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 685 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
4-685
2316 QTimerEvent *te = static_cast<QTimerEvent*>(e);-
2317 int tid = te->timerId();-
2318 if (d->state != QStateMachinePrivate::Running
d->state != QS...ivate::RunningDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-4
2319-
2320 QMutexLocker locker(&d->delayedEventsMutex);-
2321 ((!(!d->timerIdToDelayedEventId.contains(tid))) ? qt_assert("!d->timerIdToDelayedEventId.contains(tid)",__FILE__,2854) : qt_noop());-
2322 return
never executed: return true;
true;
never executed: return true;
0
2323 }-
2324 d->delayedEventsMutex.lock();-
2325 int id = d->timerIdToDelayedEventId.take(tid);-
2326 QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id);-
2327 if (ee.event != 0
ee.event != 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-4
2328 ((!(ee.timerId == tid)) ? qt_assert("ee.timerId == tid",__FILE__,2861) : qt_noop());-
2329 killTimer(tid);-
2330 d->delayedEventIdFreeList.release(id);-
2331 d->delayedEventsMutex.unlock();-
2332 d->postExternalEvent(ee.event);-
2333 d->processEvents(QStateMachinePrivate::DirectProcessing);-
2334 return
executed 4 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
4
2335 } else {-
2336 d->delayedEventsMutex.unlock();-
2337 }
never executed: end of block
0
2338 }-
2339 return
executed 685 times by 2 tests: return QState::event(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
QState::event(e);
executed 685 times by 2 tests: return QState::event(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
685
2340}-
2341-
2342-
2343-
2344-
2345-
2346bool QStateMachine::eventFilter(QObject *watched, QEvent *event)-
2347{-
2348 QStateMachinePrivate * const d = d_func();-
2349 d->handleFilteredEvent(watched, event);-
2350 return
executed 27 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
false;
executed 27 times by 1 test: return false;
Executed by:
  • tst_QStateMachine
27
2351}-
2352void QStateMachine::beginSelectTransitions(QEvent *event)-
2353{-
2354 (void)event;;-
2355}
executed 3744 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
3744
2356void QStateMachine::endSelectTransitions(QEvent *event)-
2357{-
2358 (void)event;;-
2359}
executed 3750 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
3750
2360void QStateMachine::beginMicrostep(QEvent *event)-
2361{-
2362 (void)event;;-
2363}
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
2364void QStateMachine::endMicrostep(QEvent *event)-
2365{-
2366 (void)event;;-
2367}
executed 1235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1235
2368-
2369-
2370-
2371-
2372-
2373void QStateMachine::onEntry(QEvent *event)-
2374{-
2375 start();-
2376 QState::onEntry(event);-
2377}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
3
2378-
2379-
2380-
2381-
2382-
2383-
2384void QStateMachine::onExit(QEvent *event)-
2385{-
2386 stop();-
2387 QState::onExit(event);-
2388}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
3
2389-
2390-
2391-
2392-
2393-
2394-
2395bool QStateMachine::isAnimated() const-
2396{-
2397 const QStateMachinePrivate * const d = d_func();-
2398 return
executed 3 times by 1 test: return d->animated;
Executed by:
  • tst_QStateMachine
d->animated;
executed 3 times by 1 test: return d->animated;
Executed by:
  • tst_QStateMachine
3
2399}-
2400-
2401-
2402-
2403-
2404void QStateMachine::setAnimated(bool enabled)-
2405{-
2406 QStateMachinePrivate * const d = d_func();-
2407 d->animated = enabled;-
2408}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
2
2409-
2410-
2411-
2412-
2413void QStateMachine::addDefaultAnimation(QAbstractAnimation *animation)-
2414{-
2415 QStateMachinePrivate * const d = d_func();-
2416 d->defaultAnimations.append(animation);-
2417}
executed 9 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
9
2418-
2419-
2420-
2421-
2422QList<QAbstractAnimation*> QStateMachine::defaultAnimations() const-
2423{-
2424 const QStateMachinePrivate * const d = d_func();-
2425 return
executed 10 times by 1 test: return d->defaultAnimations;
Executed by:
  • tst_QStateMachine
d->defaultAnimations;
executed 10 times by 1 test: return d->defaultAnimations;
Executed by:
  • tst_QStateMachine
10
2426}-
2427-
2428-
2429-
2430-
2431void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation)-
2432{-
2433 QStateMachinePrivate * const d = d_func();-
2434 d->defaultAnimations.removeAll(animation);-
2435}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
3
2436-
2437-
2438-
2439-
2440-
2441struct qt_meta_stringdata_QSignalEventGenerator_t {-
2442 QByteArrayData data[3];-
2443 char stringdata[32];-
2444};-
2445-
2446-
2447-
2448-
2449-
2450static const qt_meta_stringdata_QSignalEventGenerator_t qt_meta_stringdata_QSignalEventGenerator = {-
2451 {-
2452{ { { -1 } }, 21, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 0 - 0 * sizeof(QByteArrayData) },-
2453{ { { -1 } }, 7, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 22 - 1 * sizeof(QByteArrayData) },-
2454{ { { -1 } }, 0, 0, 0, __builtin_offsetof (qt_meta_stringdata_QSignalEventGenerator_t, stringdata) + 30 - 2 * sizeof(QByteArrayData) }-
2455 },-
2456 "QSignalEventGenerator\0execute\0\0"-
2457};-
2458-
2459-
2460static const uint qt_meta_data_QSignalEventGenerator[] = {-
2461-
2462-
2463 7,-
2464 0,-
2465 0, 0,-
2466 1, 14,-
2467 0, 0,-
2468 0, 0,-
2469 0, 0,-
2470 0,-
2471 0,-
2472-
2473-
2474 1, 0, 19, 2, 0x0a,-
2475-
2476-
2477 QMetaType::Void,-
2478-
2479 0-
2480};-
2481-
2482void QSignalEventGenerator::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)-
2483{-
2484 if (_c == QMetaObject::InvokeMetaMethod) {-
2485 ((!(staticMetaObject.cast(_o))) ? qt_assert("staticMetaObject.cast(_o)",__FILE__,3054) : qt_noop());-
2486 QSignalEventGenerator *_t = static_cast<QSignalEventGenerator *>(_o);-
2487 switch (_id) {-
2488 case 0: _t->execute(_a); break;-
2489 default: ;-
2490 }-
2491 }-
2492 (void)_a;;-
2493}-
2494-
2495const QMetaObject QSignalEventGenerator::staticMetaObject = {-
2496 { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data,-
2497 qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 }-
2498};-
2499-
2500const QMetaObject *QSignalEventGenerator::metaObject() const-
2501{-
2502 return &staticMetaObject;-
2503}-
2504-
2505void *QSignalEventGenerator::qt_metacast(const char *_clname)-
2506{-
2507 if (!_clname) return 0;-
2508 if (!strcmp(_clname, qt_meta_stringdata_QSignalEventGenerator.stringdata))-
2509 return static_cast<void*>(const_cast< QSignalEventGenerator*>(this));-
2510 return QObject::qt_metacast(_clname);-
2511}-
2512-
2513int QSignalEventGenerator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)-
2514{-
2515 _id = QObject::qt_metacall(_c, _id, _a);-
2516 if (_id < 0)-
2517 return _id;-
2518 if (_c == QMetaObject::InvokeMetaMethod) {-
2519 if (_id < 1)-
2520 qt_static_metacall(this, _c, _id, _a);-
2521 _id -= 1;-
2522 }-
2523 return _id;-
2524}-
2525-
2526-
2527void QSignalEventGenerator::execute(void **_a)-
2528{-
2529 int signalIndex = senderSignalIndex();-
2530 ((!(signalIndex != -1)) ? qt_assert("signalIndex != -1",__FILE__,3099) : qt_noop());-
2531 QStateMachine *machine = qobject_cast<QStateMachine*>(parent());-
2532 QStateMachinePrivate::get(machine)->handleTransitionSignal(sender(), signalIndex, _a);-
2533}
executed 70 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
70
2534-
2535QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)-
2536 : QObject(parent)-
2537{-
2538}
executed 43 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
43
2539QStateMachine::SignalEvent::SignalEvent(QObject *sender, int signalIndex,-
2540 const QList<QVariant> &arguments)-
2541 : QEvent(QEvent::StateMachineSignal), m_sender(sender),-
2542 m_signalIndex(signalIndex), m_arguments(arguments)-
2543{-
2544}
executed 71 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
71
2545-
2546-
2547-
2548-
2549QStateMachine::SignalEvent::~SignalEvent()-
2550{-
2551}-
2552QStateMachine::WrappedEvent::WrappedEvent(QObject *object, QEvent *event)-
2553 : QEvent(QEvent::StateMachineWrapped), m_object(object), m_event(event)-
2554{-
2555}
executed 26 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
26
2556-
2557-
2558-
2559-
2560QStateMachine::WrappedEvent::~WrappedEvent()-
2561{-
2562 delete m_event;-
2563}
executed 25 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
25
2564-
2565-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9