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

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