Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qstatemachine.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||
15 | struct 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:
| 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()
| 0-1394 | ||||||||||||||||||||||||||||||
42 | return executed 1394 times by 2 tests: false;return false; Executed by:
executed 1394 times by 2 tests: return false; Executed by:
| 1394 | ||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||
44 | *targets = cacheIt->effectiveTargetStates; | - | ||||||||||||||||||||||||||||||
45 | return executed 1237 times by 2 tests: true;return true; Executed by:
executed 1237 times by 2 tests: return true; Executed by:
| 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()
| 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:
| 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()
| 0-1241 | ||||||||||||||||||||||||||||||
66 | return executed 1241 times by 2 tests: false;return false; Executed by:
executed 1241 times by 2 tests: return false; Executed by:
| 1241 | ||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||
68 | *exits = cacheIt->exitSet; | - | ||||||||||||||||||||||||||||||
69 | return executed 19 times by 1 test: true;return true; Executed by:
executed 19 times by 1 test: return true; Executed by:
| 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()
| 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:
| 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()
| 0-2620 | ||||||||||||||||||||||||||||||
90 | return executed 1389 times by 2 tests: false;return false; Executed by:
executed 1389 times by 2 tests: return false; Executed by:
| 1389 | ||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||
92 | *domain = cacheIt->transitionDomain; | - | ||||||||||||||||||||||||||||||
93 | return executed 1231 times by 2 tests: true;return true; Executed by:
executed 1231 times by 2 tests: return true; Executed by:
| 1231 | ||||||||||||||||||||||||||||||
94 | } | - | ||||||||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||||||||
96 | void insert(QAbstractTransition *t, QAbstractState *domain) | - | ||||||||||||||||||||||||||||||
97 | { | - | ||||||||||||||||||||||||||||||
98 | TransitionInfoCache::iterator cacheIt = cache.find(t); | - | ||||||||||||||||||||||||||||||
99 | TransitionInfo &ti = cacheIt == cache.end()
| 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:
| 1387 | ||||||||||||||||||||||||||||||
107 | }; | - | ||||||||||||||||||||||||||||||
108 | static 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
| 1548-9215 | ||||||||||||||||||||||||||||||
113 | if (it == state2
| 3427-5788 | ||||||||||||||||||||||||||||||
114 | return executed 3427 times by 2 tests: true;return true; Executed by:
executed 3427 times by 2 tests: return true; Executed by:
| 3427 | ||||||||||||||||||||||||||||||
115 | } executed 5788 times by 2 tests: end of block Executed by:
| 5788 | ||||||||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||||||||
117 | return executed 1548 times by 2 tests: false;return false; Executed by:
executed 1548 times by 2 tests: return false; Executed by:
| 1548 | ||||||||||||||||||||||||||||||
118 | } | - | ||||||||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||||||||
120 | static 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)
| 36-401 | ||||||||||||||||||||||||||||||
124 | return executed 36 times by 1 test: true;return true; Executed by:
executed 36 times by 1 test: return true; Executed by:
| 36 | ||||||||||||||||||||||||||||||
125 | - | |||||||||||||||||||||||||||||||
126 | return executed 56 times by 1 test: false;return false; Executed by:
executed 56 times by 1 test: return false; Executed by:
| 56 | ||||||||||||||||||||||||||||||
127 | } | - | ||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||
129 | static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor) | - | ||||||||||||||||||||||||||||||
130 | { | - | ||||||||||||||||||||||||||||||
131 | int depth = 0; | - | ||||||||||||||||||||||||||||||
132 | for (const QAbstractState *it = state; it != 0
| 0-62 | ||||||||||||||||||||||||||||||
133 | if (it == ancestor
| 24-38 | ||||||||||||||||||||||||||||||
134 | break; executed 24 times by 1 test: break; Executed by:
| 24 | ||||||||||||||||||||||||||||||
135 | ++depth; | - | ||||||||||||||||||||||||||||||
136 | } executed 38 times by 1 test: end of block Executed by:
| 38 | ||||||||||||||||||||||||||||||
137 | return executed 24 times by 1 test: depth;return depth; Executed by:
executed 24 times by 1 test: return depth; Executed by:
| 24 | ||||||||||||||||||||||||||||||
138 | } | - | ||||||||||||||||||||||||||||||
139 | static 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
| 1468-8246 | ||||||||||||||||||||||||||||||
145 | result.append(it); | - | ||||||||||||||||||||||||||||||
146 | } executed 6778 times by 2 tests: end of block Executed by:
| 6778 | ||||||||||||||||||||||||||||||
147 | return executed 6913 times by 2 tests: result;return result; Executed by:
executed 6913 times by 2 tests: return result; Executed by:
| 6913 | ||||||||||||||||||||||||||||||
148 | } | - | ||||||||||||||||||||||||||||||
149 | static 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)
| 1237-1394 | ||||||||||||||||||||||||||||||
155 | return executed 1237 times by 2 tests: targetsList;return targetsList; Executed by:
executed 1237 times by 2 tests: return targetsList; Executed by:
| 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)
| 9-1381 | ||||||||||||||||||||||||||||||
160 | QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(historyState)->configuration; | - | ||||||||||||||||||||||||||||||
161 | if (!historyConfiguration.isEmpty()
| 4-5 | ||||||||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||||||||
163 | targets.unite(historyConfiguration.toSet()); | - | ||||||||||||||||||||||||||||||
164 | } executed 5 times by 1 test: else if (QAbstractTransition *defaultTransition = historyState->defaultTransition()end of block Executed by:
| 1-5 | ||||||||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||||||||
166 | targets.unite(defaultTransition->targetStates().toSet()); | - | ||||||||||||||||||||||||||||||
167 | } executed 3 times by 1 test: else {end of block Executed by:
| 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:
| 1 | ||||||||||||||||||||||||||||||
172 | } else { | - | ||||||||||||||||||||||||||||||
173 | targets.insert(s); | - | ||||||||||||||||||||||||||||||
174 | } executed 1381 times by 2 tests: end of block Executed by:
| 1381 | ||||||||||||||||||||||||||||||
175 | } | - | ||||||||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||||||||
177 | targetsList = targets.toList(); | - | ||||||||||||||||||||||||||||||
178 | cache->insert(transition, targetsList); | - | ||||||||||||||||||||||||||||||
179 | return executed 1394 times by 2 tests: targetsList;return targetsList; Executed by:
executed 1394 times by 2 tests: return targetsList; Executed by:
| 1394 | ||||||||||||||||||||||||||||||
180 | } | - | ||||||||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||||||||
182 | QStateMachinePrivate::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:
| 145 | ||||||||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||||||||
199 | QStateMachinePrivate::~QStateMachinePrivate() | - | ||||||||||||||||||||||||||||||
200 | { | - | ||||||||||||||||||||||||||||||
201 | qDeleteAll(internalEventQueue); | - | ||||||||||||||||||||||||||||||
202 | qDeleteAll(externalEventQueue); | - | ||||||||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||||||||
204 | for (QHash<int, DelayedEvent>::const_iterator it = delayedEvents.begin(), eit = delayedEvents.end(); it != eit
| 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:
| 145 | ||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||
209 | QState *QStateMachinePrivate::rootState() const | - | ||||||||||||||||||||||||||||||
210 | { | - | ||||||||||||||||||||||||||||||
211 | return executed 5217 times by 2 tests: const_cast<QStateMachine*>(q_func());return const_cast<QStateMachine*>(q_func()); Executed by:
executed 5217 times by 2 tests: return const_cast<QStateMachine*>(q_func()); Executed by:
| 5217 | ||||||||||||||||||||||||||||||
212 | } | - | ||||||||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||||||||
214 | static QEvent *cloneEvent(QEvent *e) | - | ||||||||||||||||||||||||||||||
215 | { | - | ||||||||||||||||||||||||||||||
216 | switch (e->type()) { | - | ||||||||||||||||||||||||||||||
217 | case never executed: QEvent::None:case QEvent::None: never executed: case QEvent::None: | 0 | ||||||||||||||||||||||||||||||
218 | return never executed: new QEvent(*e);return new QEvent(*e); never executed: return new QEvent(*e); | 0 | ||||||||||||||||||||||||||||||
219 | case executed 7 times by 1 test: QEvent::Timer:case QEvent::Timer: Executed by:
executed 7 times by 1 test: case QEvent::Timer: Executed by:
| 7 | ||||||||||||||||||||||||||||||
220 | return executed 7 times by 1 test: new QTimerEvent(*static_cast<QTimerEvent*>(e));return new QTimerEvent(*static_cast<QTimerEvent*>(e)); Executed by:
executed 7 times by 1 test: return new QTimerEvent(*static_cast<QTimerEvent*>(e)); Executed by:
| 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: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
226 | } | - | ||||||||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||||||||
228 | const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = { | - | ||||||||||||||||||||||||||||||
229 | cloneEvent | - | ||||||||||||||||||||||||||||||
230 | }; | - | ||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||
232 | const 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: &qt_kernel_statemachine_handler;return &qt_kernel_statemachine_handler; Executed by:
executed 7 times by 1 test: return &qt_kernel_statemachine_handler; Executed by:
| 7 | ||||||||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||
239 | static int indexOfDescendant(QState *s, QAbstractState *desc) | - | ||||||||||||||||||||||||||||||
240 | { | - | ||||||||||||||||||||||||||||||
241 | QList<QAbstractState*> childStates = QStatePrivate::get(s)->childStates(); | - | ||||||||||||||||||||||||||||||
242 | for (int i = 0; i < childStates.size()
| 0-680 | ||||||||||||||||||||||||||||||
243 | QAbstractState *c = childStates.at(i); | - | ||||||||||||||||||||||||||||||
244 | if ((
| 130-550 | ||||||||||||||||||||||||||||||
245 | return executed 426 times by 1 test: i;return i; Executed by:
executed 426 times by 1 test: return i; Executed by:
| 426 | ||||||||||||||||||||||||||||||
246 | } | - | ||||||||||||||||||||||||||||||
247 | } executed 254 times by 1 test: end of block Executed by:
| 254 | ||||||||||||||||||||||||||||||
248 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
249 | } | - | ||||||||||||||||||||||||||||||
250 | - | |||||||||||||||||||||||||||||||
251 | bool QStateMachinePrivate::transitionStateEntryLessThan(QAbstractTransition *t1, QAbstractTransition *t2) | - | ||||||||||||||||||||||||||||||
252 | { | - | ||||||||||||||||||||||||||||||
253 | QState *s1 = t1->sourceState(), *s2 = t2->sourceState(); | - | ||||||||||||||||||||||||||||||
254 | if (s1 == s2
| 6-12 | ||||||||||||||||||||||||||||||
255 | QList<QAbstractTransition*> transitions = QStatePrivate::get(s1)->transitions(); | - | ||||||||||||||||||||||||||||||
256 | return executed 6 times by 1 test: transitions.indexOf(t1) < transitions.indexOf(t2);return transitions.indexOf(t1) < transitions.indexOf(t2); Executed by:
executed 6 times by 1 test: return transitions.indexOf(t1) < transitions.indexOf(t2); Executed by:
| 6 | ||||||||||||||||||||||||||||||
257 | } else if (isDescendant(s1, s2)
| 0-12 | ||||||||||||||||||||||||||||||
258 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
259 | } else if (isDescendant(s2, s1)
| 0-12 | ||||||||||||||||||||||||||||||
260 | return never executed: false;return 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
| 4-8 | ||||||||||||||||||||||||||||||
269 | return executed 8 times by 1 test: (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); Executed by:
executed 8 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); Executed by:
| 8 | ||||||||||||||||||||||||||||||
270 | else | - | ||||||||||||||||||||||||||||||
271 | return executed 4 times by 1 test: s1Depth > s2Depth;return s1Depth > s2Depth; Executed by:
executed 4 times by 1 test: return s1Depth > s2Depth; Executed by:
| 4 | ||||||||||||||||||||||||||||||
272 | } | - | ||||||||||||||||||||||||||||||
273 | } | - | ||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||
275 | bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState *s2) | - | ||||||||||||||||||||||||||||||
276 | { | - | ||||||||||||||||||||||||||||||
277 | if (s1->parent() == s2->parent()
| 41-403 | ||||||||||||||||||||||||||||||
278 | return executed 41 times by 1 test: s1->parent()->children().indexOf(s1)return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2); Executed by:
executed 41 times by 1 test: return s1->parent()->children().indexOf(s1) < s2->parent()->children().indexOf(s2); Executed by:
| 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:
| 41 | ||||||||||||||||||||||||||||||
280 | } else if (isDescendant(s1, s2)
| 128-275 | ||||||||||||||||||||||||||||||
281 | return executed 128 times by 2 tests: false;return false; Executed by:
executed 128 times by 2 tests: return false; Executed by:
| 128 | ||||||||||||||||||||||||||||||
282 | } else if (isDescendant(s2, s1)
| 94-181 | ||||||||||||||||||||||||||||||
283 | return executed 94 times by 1 test: true;return true; Executed by:
executed 94 times by 1 test: return true; Executed by:
| 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: (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); Executed by:
executed 181 times by 1 test: return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2)); Executed by:
| 181 | ||||||||||||||||||||||||||||||
290 | } | - | ||||||||||||||||||||||||||||||
291 | } | - | ||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||
293 | bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState *s2) | - | ||||||||||||||||||||||||||||||
294 | { | - | ||||||||||||||||||||||||||||||
295 | if (s1->parent() == s2->parent()
| 9-122 | ||||||||||||||||||||||||||||||
296 | return executed 9 times by 1 test: s2->parent()->children().indexOf(s2)return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1); Executed by:
executed 9 times by 1 test: return s2->parent()->children().indexOf(s2) < s1->parent()->children().indexOf(s1); Executed by:
| 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:
| 9 | ||||||||||||||||||||||||||||||
298 | } else if (isDescendant(s1, s2)
| 43-79 | ||||||||||||||||||||||||||||||
299 | return executed 43 times by 2 tests: true;return true; Executed by:
executed 43 times by 2 tests: return true; Executed by:
| 43 | ||||||||||||||||||||||||||||||
300 | } else if (isDescendant(s2, s1)
| 24-55 | ||||||||||||||||||||||||||||||
301 | return executed 55 times by 2 tests: false;return false; Executed by:
executed 55 times by 2 tests: return false; Executed by:
| 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: (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); Executed by:
executed 24 times by 1 test: return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1)); Executed by:
| 24 | ||||||||||||||||||||||||||||||
308 | } | - | ||||||||||||||||||||||||||||||
309 | } | - | ||||||||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||||||||
311 | QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states, bool onlyCompound) const | - | ||||||||||||||||||||||||||||||
312 | { | - | ||||||||||||||||||||||||||||||
313 | if (states.isEmpty()
| 0-1608 | ||||||||||||||||||||||||||||||
314 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
315 | QVector<QState*> ancestors = getProperAncestors(states.at(0), rootState()->parentState()); | - | ||||||||||||||||||||||||||||||
316 | for (int i = 0; i < ancestors.size()
| 4-1819 | ||||||||||||||||||||||||||||||
317 | QState *anc = ancestors.at(i); | - | ||||||||||||||||||||||||||||||
318 | if (onlyCompound
| 12-1415 | ||||||||||||||||||||||||||||||
319 | continue; executed 12 times by 1 test: continue; Executed by:
| 12 | ||||||||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||||||||
321 | bool ok = true; | - | ||||||||||||||||||||||||||||||
322 | for (int j = states.size() - 1; (
| 0-1807 | ||||||||||||||||||||||||||||||
323 | const QAbstractState *s = states.at(j); | - | ||||||||||||||||||||||||||||||
324 | if (!isDescendant(s, anc)
| 203-1453 | ||||||||||||||||||||||||||||||
325 | ok = false; executed 203 times by 1 test: ok = false; Executed by:
| 203 | ||||||||||||||||||||||||||||||
326 | } executed 1656 times by 2 tests: end of block Executed by:
| 1656 | ||||||||||||||||||||||||||||||
327 | if (ok
| 203-1604 | ||||||||||||||||||||||||||||||
328 | return executed 1604 times by 2 tests: anc;return anc; Executed by:
executed 1604 times by 2 tests: return anc; Executed by:
| 1604 | ||||||||||||||||||||||||||||||
329 | } executed 203 times by 1 test: end of block Executed by:
| 203 | ||||||||||||||||||||||||||||||
330 | return executed 4 times by 1 test: 0;return 0; Executed by:
executed 4 times by 1 test: return 0; Executed by:
| 4 | ||||||||||||||||||||||||||||||
331 | } | - | ||||||||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||||||||
333 | QState *QStateMachinePrivate::findLCCA(const QList<QAbstractState*> &states) const | - | ||||||||||||||||||||||||||||||
334 | { | - | ||||||||||||||||||||||||||||||
335 | return executed 1391 times by 2 tests: findLCA(states, true);return findLCA(states, true); Executed by:
executed 1391 times by 2 tests: return findLCA(states, true); Executed by:
| 1391 | ||||||||||||||||||||||||||||||
336 | } | - | ||||||||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||||||||
338 | QList<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)
| 386-3838 | ||||||||||||||||||||||||||||||
346 | configuration_sorted.append(s); executed 3838 times by 2 tests: configuration_sorted.append(s); Executed by:
| 3838 | ||||||||||||||||||||||||||||||
347 | } executed 4224 times by 2 tests: end of block Executed by:
| 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)
| 23-3815 | ||||||||||||||||||||||||||||||
355 | lst.prepend(grp); executed 3815 times by 2 tests: lst.prepend(grp); Executed by:
| 3815 | ||||||||||||||||||||||||||||||
356 | bool found = false; | - | ||||||||||||||||||||||||||||||
357 | for (int j = 0; (
| 1244-8136 | ||||||||||||||||||||||||||||||
358 | QState *s = lst.at(j); | - | ||||||||||||||||||||||||||||||
359 | QList<QAbstractTransition*> transitions = QStatePrivate::get(s)->transitions(); | - | ||||||||||||||||||||||||||||||
360 | for (int k = 0; k < transitions.size()
| 5648-5945 | ||||||||||||||||||||||||||||||
361 | QAbstractTransition *t = transitions.at(k); | - | ||||||||||||||||||||||||||||||
362 | if (QAbstractTransitionPrivate::get(t)->callEventTest(event)
| 1244-4701 | ||||||||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||||||||
364 | - | |||||||||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||||||||
366 | enabledTransitions.append(t); | - | ||||||||||||||||||||||||||||||
367 | found = true; | - | ||||||||||||||||||||||||||||||
368 | break; executed 1244 times by 2 tests: break; Executed by:
| 1244 | ||||||||||||||||||||||||||||||
369 | } | - | ||||||||||||||||||||||||||||||
370 | } executed 4701 times by 2 tests: end of block Executed by:
| 4701 | ||||||||||||||||||||||||||||||
371 | } executed 6892 times by 2 tests: end of block Executed by:
| 6892 | ||||||||||||||||||||||||||||||
372 | } executed 3838 times by 2 tests: end of block Executed by:
| 3838 | ||||||||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||||||||
374 | if (!enabledTransitions.isEmpty()
| 1235-2515 | ||||||||||||||||||||||||||||||
375 | removeConflictingTransitions(enabledTransitions, cache); | - | ||||||||||||||||||||||||||||||
376 | - | |||||||||||||||||||||||||||||||
377 | - | |||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||
379 | } executed 1235 times by 2 tests: end of block Executed by:
| 1235 | ||||||||||||||||||||||||||||||
380 | const_cast<QStateMachine*>(q)->endSelectTransitions(event); | - | ||||||||||||||||||||||||||||||
381 | return executed 3750 times by 2 tests: enabledTransitions;return enabledTransitions; Executed by:
executed 3750 times by 2 tests: return enabledTransitions; Executed by:
| 3750 | ||||||||||||||||||||||||||||||
382 | } | - | ||||||||||||||||||||||||||||||
383 | void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache) | - | ||||||||||||||||||||||||||||||
384 | { | - | ||||||||||||||||||||||||||||||
385 | ((!(cache)) ? qt_assert("cache",__FILE__,616) : qt_noop()); | - | ||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||
387 | if (enabledTransitions.size() < 2
| 6-1229 | ||||||||||||||||||||||||||||||
388 | return; executed 1229 times by 2 tests: return; Executed by:
| 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()
| 9-10 | ||||||||||||||||||||||||||||||
399 | QAbstractTransition *t2 = *t2It; | - | ||||||||||||||||||||||||||||||
400 | if (t1 == t2
| 3-7 | ||||||||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||||||||
403 | t1Preempted = true; | - | ||||||||||||||||||||||||||||||
404 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||||||||
405 | } | - | ||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||
407 | QSet<QAbstractState*> exitSetT2 = computeExitSet_Unordered(t2, cache); | - | ||||||||||||||||||||||||||||||
408 | if (!exitSetT1.intersects(exitSetT2)
| 3-4 | ||||||||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||||||||
410 | ++t2It; | - | ||||||||||||||||||||||||||||||
411 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||||||||
413 | if (isDescendant(t1->sourceState(), t2->sourceState())
| 0-3 | ||||||||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||||||||
415 | t2It = filteredTransitions.erase(t2It); | - | ||||||||||||||||||||||||||||||
416 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
417 | - | |||||||||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||||||||
419 | t1Preempted = true; | - | ||||||||||||||||||||||||||||||
420 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||||||||
421 | } | - | ||||||||||||||||||||||||||||||
422 | } | - | ||||||||||||||||||||||||||||||
423 | } | - | ||||||||||||||||||||||||||||||
424 | if (!t1Preempted
| 6-9 | ||||||||||||||||||||||||||||||
425 | filteredTransitions.append(t1); executed 9 times by 1 test: filteredTransitions.append(t1); Executed by:
| 9 | ||||||||||||||||||||||||||||||
426 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||
427 | - | |||||||||||||||||||||||||||||||
428 | enabledTransitions = filteredTransitions; | - | ||||||||||||||||||||||||||||||
429 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||||||||
431 | void 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()
| 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:
| 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:
| 1235 | ||||||||||||||||||||||||||||||
482 | QList<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: statesToExit_sorted;return statesToExit_sorted; Executed by:
executed 1235 times by 2 tests: return statesToExit_sorted; Executed by:
| 1235 | ||||||||||||||||||||||||||||||
490 | } | - | ||||||||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||||||||
492 | QSet<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:
| 1238 | ||||||||||||||||||||||||||||||
500 | return executed 1235 times by 2 tests: statesToExit;return statesToExit; Executed by:
executed 1235 times by 2 tests: return statesToExit; Executed by:
| 1235 | ||||||||||||||||||||||||||||||
501 | } | - | ||||||||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||||||||
503 | QSet<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)
| 19-1241 | ||||||||||||||||||||||||||||||
510 | return executed 19 times by 1 test: statesToExit;return statesToExit; Executed by:
executed 19 times by 1 test: return statesToExit; Executed by:
| 19 | ||||||||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||||||||
512 | QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache); | - | ||||||||||||||||||||||||||||||
513 | QAbstractState *domain = getTransitionDomain(t, effectiveTargetStates, cache); | - | ||||||||||||||||||||||||||||||
514 | if (domain == nullptr
| 4-1232 | ||||||||||||||||||||||||||||||
515 | - | |||||||||||||||||||||||||||||||
516 | - | |||||||||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||||||||
521 | - | |||||||||||||||||||||||||||||||
522 | if (error == QStateMachine::NoError
| 1-3 | ||||||||||||||||||||||||||||||
523 | setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState()); executed 3 times by 1 test: setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState()); Executed by:
| 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:
| 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)
| 104-1315 | ||||||||||||||||||||||||||||||
533 | statesToExit.insert(s); executed 1315 times by 2 tests: statesToExit.insert(s); Executed by:
| 1315 | ||||||||||||||||||||||||||||||
534 | } executed 1419 times by 2 tests: end of block Executed by:
| 1419 | ||||||||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||||||||
536 | cache->insert(t, statesToExit); | - | ||||||||||||||||||||||||||||||
537 | return executed 1241 times by 2 tests: statesToExit;return statesToExit; Executed by:
executed 1241 times by 2 tests: return statesToExit; Executed by:
| 1241 | ||||||||||||||||||||||||||||||
538 | } | - | ||||||||||||||||||||||||||||||
539 | - | |||||||||||||||||||||||||||||||
540 | void 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()
| 1235-1298 | ||||||||||||||||||||||||||||||
544 | QAbstractState *s = statesToExit_sorted.at(i); | - | ||||||||||||||||||||||||||||||
545 | if (QState *grp = toStandardState(s)
| 7-1291 | ||||||||||||||||||||||||||||||
546 | QList<QHistoryState*> hlst = QStatePrivate::get(grp)->historyStates(); | - | ||||||||||||||||||||||||||||||
547 | for (int j = 0; j < hlst.size()
| 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()
| 9-27 | ||||||||||||||||||||||||||||||
552 | QAbstractState *s0 = *it; | - | ||||||||||||||||||||||||||||||
553 | if (QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory
| 11-16 | ||||||||||||||||||||||||||||||
554 | if (isAtomic(s0)
| 0-6 | ||||||||||||||||||||||||||||||
555 | QHistoryStatePrivate::get(h)->configuration.append(s0); executed 5 times by 1 test: QHistoryStatePrivate::get(h)->configuration.append(s0); Executed by:
| 5 | ||||||||||||||||||||||||||||||
556 | } executed 11 times by 1 test: else if (s0->parentState() == send of block Executed by:
| 8-11 | ||||||||||||||||||||||||||||||
557 | QHistoryStatePrivate::get(h)->configuration.append(s0); | - | ||||||||||||||||||||||||||||||
558 | } executed 8 times by 2 tests: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
559 | } executed 27 times by 2 tests: end of block Executed by:
| 27 | ||||||||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||||||||
564 | } executed 9 times by 2 tests: end of block Executed by:
| 9 | ||||||||||||||||||||||||||||||
565 | } executed 1291 times by 2 tests: end of block Executed by:
| 1291 | ||||||||||||||||||||||||||||||
566 | } executed 1298 times by 2 tests: end of block Executed by:
| 1298 | ||||||||||||||||||||||||||||||
567 | for (int i = 0; i < statesToExit_sorted.size()
| 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:
| 1298 | ||||||||||||||||||||||||||||||
583 | } executed 1235 times by 2 tests: end of block Executed by:
| 1235 | ||||||||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||||||||
585 | void QStateMachinePrivate::executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions) | - | ||||||||||||||||||||||||||||||
586 | { | - | ||||||||||||||||||||||||||||||
587 | for (int i = 0; i < enabledTransitions.size()
| 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:
| 1391 | ||||||||||||||||||||||||||||||
595 | } executed 1388 times by 2 tests: end of block Executed by:
| 1388 | ||||||||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||||||||
597 | QList<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()
| 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:
| 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:
| 1390 | ||||||||||||||||||||||||||||||
615 | } executed 1390 times by 2 tests: end of block Executed by:
| 1390 | ||||||||||||||||||||||||||||||
616 | } executed 1387 times by 2 tests: end of block Executed by:
| 1387 | ||||||||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||
619 | if (!pendingErrorStates.isEmpty()
| 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:
| 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: statesToEnter_sorted;return statesToEnter_sorted; Executed by:
executed 1388 times by 2 tests: return statesToEnter_sorted; Executed by:
| 1388 | ||||||||||||||||||||||||||||||
630 | } | - | ||||||||||||||||||||||||||||||
631 | QAbstractState *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()
| 11-2620 | ||||||||||||||||||||||||||||||
638 | return executed 11 times by 1 test: 0;return 0; Executed by:
executed 11 times by 1 test: return 0; Executed by:
| 11 | ||||||||||||||||||||||||||||||
639 | - | |||||||||||||||||||||||||||||||
640 | QAbstractState *domain = nullptr; | - | ||||||||||||||||||||||||||||||
641 | if (cache->transitionDomain(t, &domain)
| 1231-1389 | ||||||||||||||||||||||||||||||
642 | return executed 1231 times by 2 tests: domain;return domain; Executed by:
executed 1231 times by 2 tests: return domain; Executed by:
| 1231 | ||||||||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||||||||
644 | if (t->transitionType() == QAbstractTransition::InternalTransition
| 2-1387 | ||||||||||||||||||||||||||||||
645 | if (QState *tSource = t->sourceState()
| 0-2 | ||||||||||||||||||||||||||||||
646 | if (isCompound(tSource)
| 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)
| 0-2 | ||||||||||||||||||||||||||||||
650 | allDescendants = false; | - | ||||||||||||||||||||||||||||||
651 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
652 | } | - | ||||||||||||||||||||||||||||||
653 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||||||||
655 | if (allDescendants
| 0-2 | ||||||||||||||||||||||||||||||
656 | return executed 2 times by 1 test: tSource;return tSource; Executed by:
executed 2 times by 1 test: return tSource; Executed by:
| 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()
| 153-1234 | ||||||||||||||||||||||||||||||
663 | states.prepend(src); executed 1234 times by 2 tests: states.prepend(src); Executed by:
| 1234 | ||||||||||||||||||||||||||||||
664 | domain = findLCCA(states); | - | ||||||||||||||||||||||||||||||
665 | cache->insert(t, domain); | - | ||||||||||||||||||||||||||||||
666 | return executed 1387 times by 2 tests: domain;return domain; Executed by:
executed 1387 times by 2 tests: return domain; Executed by:
| 1387 | ||||||||||||||||||||||||||||||
667 | } | - | ||||||||||||||||||||||||||||||
668 | - | |||||||||||||||||||||||||||||||
669 | void 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()
| 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()
| 97-1507 | ||||||||||||||||||||||||||||||
697 | const QPropertyAssignment &assn = assignments.at(i); | - | ||||||||||||||||||||||||||||||
698 | if (globalRestorePolicy == QState::RestoreProperties
| 43-54 | ||||||||||||||||||||||||||||||
699 | if (assn.explicitlySet
| 18-36 | ||||||||||||||||||||||||||||||
700 | if (!hasRestorable(s, assn.object, assn.propertyName)
| 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:
| 34 | ||||||||||||||||||||||||||||||
705 | } executed 36 times by 1 test: else {end of block Executed by:
| 36 | ||||||||||||||||||||||||||||||
706 | - | |||||||||||||||||||||||||||||||
707 | - | |||||||||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||||||||
709 | unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName); | - | ||||||||||||||||||||||||||||||
710 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
711 | } | - | ||||||||||||||||||||||||||||||
712 | assn.write(); | - | ||||||||||||||||||||||||||||||
713 | } executed 97 times by 2 tests: end of block Executed by:
| 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)
| 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
| 72-1435 | ||||||||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||||||||
734 | && !animationsForState.contains(s)
| 32-1403 | ||||||||||||||||||||||||||||||
735 | - | |||||||||||||||||||||||||||||||
736 | ) | - | ||||||||||||||||||||||||||||||
737 | QStatePrivate::get(ss)->emitPropertiesAssigned(); executed 1403 times by 2 tests: QStatePrivate::get(ss)->emitPropertiesAssigned(); Executed by:
| 1403 | ||||||||||||||||||||||||||||||
738 | } | - | ||||||||||||||||||||||||||||||
739 | - | |||||||||||||||||||||||||||||||
740 | if (isFinal(s)
| 72-1435 | ||||||||||||||||||||||||||||||
741 | QState *parent = s->parentState(); | - | ||||||||||||||||||||||||||||||
742 | if (parent
| 0-72 | ||||||||||||||||||||||||||||||
743 | if (parent != rootState()
| 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:
| 9 | ||||||||||||||||||||||||||||||
748 | QState *grandparent = parent->parentState(); | - | ||||||||||||||||||||||||||||||
749 | if (grandparent
| 5-60 | ||||||||||||||||||||||||||||||
750 | bool allChildStatesFinal = true; | - | ||||||||||||||||||||||||||||||
751 | QList<QAbstractState*> childStates = QStatePrivate::get(grandparent)->childStates(); | - | ||||||||||||||||||||||||||||||
752 | for (int j = 0; j < childStates.size()
| 3-16 | ||||||||||||||||||||||||||||||
753 | QAbstractState *cs = childStates.at(j); | - | ||||||||||||||||||||||||||||||
754 | if (!isInFinalState(cs)
| 4-12 | ||||||||||||||||||||||||||||||
755 | allChildStatesFinal = false; | - | ||||||||||||||||||||||||||||||
756 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||
757 | } | - | ||||||||||||||||||||||||||||||
758 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||
759 | if (allChildStatesFinal
| 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:
| 2 | ||||||||||||||||||||||||||||||
764 | } executed 7 times by 1 test: end of block Executed by:
| 7 | ||||||||||||||||||||||||||||||
765 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||
766 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||
767 | } executed 1507 times by 2 tests: end of block Executed by:
| 1507 | ||||||||||||||||||||||||||||||
768 | { | - | ||||||||||||||||||||||||||||||
769 | QSet<QAbstractState*>::const_iterator it; | - | ||||||||||||||||||||||||||||||
770 | for (it = configuration.constBegin(); it != configuration.constEnd()
| 1324-1591 | ||||||||||||||||||||||||||||||
771 | if (isFinal(*it)
| 74-1517 | ||||||||||||||||||||||||||||||
772 | QState *parent = (*it)->parentState(); | - | ||||||||||||||||||||||||||||||
773 | if (((
| 11-63 | ||||||||||||||||||||||||||||||
774 | && (
| 0-63 | ||||||||||||||||||||||||||||||
775 | || ((
| 3-8 | ||||||||||||||||||||||||||||||
776 | && (
| 1-2 | ||||||||||||||||||||||||||||||
777 | && isInFinalState(rootState())
| 0-1 | ||||||||||||||||||||||||||||||
778 | processing = false; | - | ||||||||||||||||||||||||||||||
779 | stopProcessingReason = Finished; | - | ||||||||||||||||||||||||||||||
780 | break; executed 64 times by 1 test: break; Executed by:
| 64 | ||||||||||||||||||||||||||||||
781 | } | - | ||||||||||||||||||||||||||||||
782 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
783 | } executed 1527 times by 2 tests: end of block Executed by:
| 1527 | ||||||||||||||||||||||||||||||
784 | } | - | ||||||||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||||||||
786 | } executed 1388 times by 2 tests: end of block Executed by:
| 1388 | ||||||||||||||||||||||||||||||
787 | void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state, | - | ||||||||||||||||||||||||||||||
788 | QSet<QAbstractState*> &statesToEnter, | - | ||||||||||||||||||||||||||||||
789 | QSet<QAbstractState*> &statesForDefaultEntry) | - | ||||||||||||||||||||||||||||||
790 | { | - | ||||||||||||||||||||||||||||||
791 | if (QHistoryState *h = toHistoryState(state)
| 13-1506 | ||||||||||||||||||||||||||||||
792 | QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(h)->configuration; | - | ||||||||||||||||||||||||||||||
793 | if (!historyConfiguration.isEmpty()
| 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:
| 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:
| 11 | ||||||||||||||||||||||||||||||
798 | - | |||||||||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||||||||
802 | - | |||||||||||||||||||||||||||||||
803 | - | |||||||||||||||||||||||||||||||
804 | } executed 7 times by 2 tests: else {end of block Executed by:
| 7 | ||||||||||||||||||||||||||||||
805 | QList<QAbstractState*> defaultHistoryContent; | - | ||||||||||||||||||||||||||||||
806 | if (QAbstractTransition *t = QHistoryStatePrivate::get(h)->defaultTransition
| 0-6 | ||||||||||||||||||||||||||||||
807 | defaultHistoryContent = t->targetStates(); executed 6 times by 2 tests: defaultHistoryContent = t->targetStates(); Executed by:
| 6 | ||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||
809 | if (defaultHistoryContent.isEmpty()
| 0-6 | ||||||||||||||||||||||||||||||
810 | setError(QStateMachine::NoDefaultStateInHistoryStateError, h); | - | ||||||||||||||||||||||||||||||
811 | } never executed: else {end of block | 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:
| 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:
| 7 | ||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||
817 | - | |||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||
819 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
820 | } | - | ||||||||||||||||||||||||||||||
821 | } else { | - | ||||||||||||||||||||||||||||||
822 | if (state == rootState()
| 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:
| 1 | ||||||||||||||||||||||||||||||
826 | } | - | ||||||||||||||||||||||||||||||
827 | statesToEnter.insert(state); | - | ||||||||||||||||||||||||||||||
828 | if (isCompound(state)
| 65-1440 | ||||||||||||||||||||||||||||||
829 | statesForDefaultEntry.insert(state); | - | ||||||||||||||||||||||||||||||
830 | if (QAbstractState *initial = toStandardState(state)->initialState()
| 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: else {end of block Executed by:
| 49 | ||||||||||||||||||||||||||||||
842 | setError(QStateMachine::NoInitialStateError, state); | - | ||||||||||||||||||||||||||||||
843 | return; executed 16 times by 1 test: return; Executed by:
| 16 | ||||||||||||||||||||||||||||||
844 | } | - | ||||||||||||||||||||||||||||||
845 | } else if (isParallel(state)
| 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)
| 0-29 | ||||||||||||||||||||||||||||||
849 | addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry); executed 29 times by 1 test: addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry); Executed by:
| 29 | ||||||||||||||||||||||||||||||
850 | } executed 29 times by 1 test: end of block Executed by:
| 29 | ||||||||||||||||||||||||||||||
851 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||
852 | } executed 1489 times by 2 tests: end of block Executed by:
| 1489 | ||||||||||||||||||||||||||||||
853 | } | - | ||||||||||||||||||||||||||||||
854 | void 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()
| 2-66 | ||||||||||||||||||||||||||||||
860 | continue; executed 2 times by 1 test: continue; Executed by:
| 2 | ||||||||||||||||||||||||||||||
861 | statesToEnter.insert(anc); | - | ||||||||||||||||||||||||||||||
862 | if (isParallel(anc)
| 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)
| 27-36 | ||||||||||||||||||||||||||||||
865 | addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry); executed 27 times by 1 test: addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry); Executed by:
| 27 | ||||||||||||||||||||||||||||||
866 | } executed 63 times by 1 test: end of block Executed by:
| 63 | ||||||||||||||||||||||||||||||
867 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||||||||||||||
868 | } executed 66 times by 1 test: end of block Executed by:
| 66 | ||||||||||||||||||||||||||||||
869 | } executed 1467 times by 2 tests: end of block Executed by:
| 1467 | ||||||||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||||||||
871 | bool QStateMachinePrivate::isFinal(const QAbstractState *s) | - | ||||||||||||||||||||||||||||||
872 | { | - | ||||||||||||||||||||||||||||||
873 | return executed 3561 times by 2 tests: sreturn s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState); Executed by:
executed 3561 times by 2 tests: return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState); Executed by:
| 0-3561 | ||||||||||||||||||||||||||||||
874 | } | - | ||||||||||||||||||||||||||||||
875 | - | |||||||||||||||||||||||||||||||
876 | bool QStateMachinePrivate::isParallel(const QAbstractState *s) | - | ||||||||||||||||||||||||||||||
877 | { | - | ||||||||||||||||||||||||||||||
878 | const QState *ss = toStandardState(s); | - | ||||||||||||||||||||||||||||||
879 | return executed 4385 times by 2 tests: ssreturn ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates); Executed by:
executed 4385 times by 2 tests: return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates); Executed by:
| 72-4385 | ||||||||||||||||||||||||||||||
880 | } | - | ||||||||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||||||||
882 | bool QStateMachinePrivate::isCompound(const QAbstractState *s) const | - | ||||||||||||||||||||||||||||||
883 | { | - | ||||||||||||||||||||||||||||||
884 | const QState *group = toStandardState(s); | - | ||||||||||||||||||||||||||||||
885 | if (!group
| 72-2869 | ||||||||||||||||||||||||||||||
886 | return executed 72 times by 1 test: false;return false; Executed by:
executed 72 times by 1 test: return false; Executed by:
| 72 | ||||||||||||||||||||||||||||||
887 | bool isMachine = QStatePrivate::get(group)->isMachine; | - | ||||||||||||||||||||||||||||||
888 | - | |||||||||||||||||||||||||||||||
889 | if (isMachine
| 3-1517 | ||||||||||||||||||||||||||||||
890 | return executed 3 times by 1 test: false;return false; Executed by:
executed 3 times by 1 test: return false; Executed by:
| 3 | ||||||||||||||||||||||||||||||
891 | return executed 2866 times by 2 tests: (!isParallel(group)return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty()); Executed by:
executed 2866 times by 2 tests: return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty()); Executed by:
| 28-2866 | ||||||||||||||||||||||||||||||
892 | } | - | ||||||||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||||||||
894 | bool QStateMachinePrivate::isAtomic(const QAbstractState *s) const | - | ||||||||||||||||||||||||||||||
895 | { | - | ||||||||||||||||||||||||||||||
896 | const QState *ss = toStandardState(s); | - | ||||||||||||||||||||||||||||||
897 | return executed 4235 times by 2 tests: (ssreturn (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); Executed by:
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); Executed by:
| 23-4235 | ||||||||||||||||||||||||||||||
898 | || isFinal(s)
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); Executed by:
| 23-4235 | ||||||||||||||||||||||||||||||
899 | 4235 | |||||||||||||||||||||||||||||||
900 | || (ss
executed 4235 times by 2 tests: return (ss && QStatePrivate::get(ss)->childStates().isEmpty()) || isFinal(s) || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState())); Executed by:
| 0-4235 | ||||||||||||||||||||||||||||||
901 | } | - | ||||||||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||||||||
903 | QState *QStateMachinePrivate::toStandardState(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
904 | { | - | ||||||||||||||||||||||||||||||
905 | if (state
| 0-9813 | ||||||||||||||||||||||||||||||
906 | return executed 9566 times by 2 tests: static_cast<QState*>(state);return static_cast<QState*>(state); Executed by:
executed 9566 times by 2 tests: return static_cast<QState*>(state); Executed by:
| 9566 | ||||||||||||||||||||||||||||||
907 | return executed 247 times by 1 test: 0;return 0; Executed by:
executed 247 times by 1 test: return 0; Executed by:
| 247 | ||||||||||||||||||||||||||||||
908 | } | - | ||||||||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||||||||
910 | const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state) | - | ||||||||||||||||||||||||||||||
911 | { | - | ||||||||||||||||||||||||||||||
912 | if (state
| 0-11561 | ||||||||||||||||||||||||||||||
913 | return executed 11394 times by 2 tests: static_cast<const QState*>(state);return static_cast<const QState*>(state); Executed by:
executed 11394 times by 2 tests: return static_cast<const QState*>(state); Executed by:
| 11394 | ||||||||||||||||||||||||||||||
914 | return executed 167 times by 1 test: 0;return 0; Executed by:
executed 167 times by 1 test: return 0; Executed by:
| 167 | ||||||||||||||||||||||||||||||
915 | } | - | ||||||||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||||||||
917 | QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
918 | { | - | ||||||||||||||||||||||||||||||
919 | if (state
| 0 | ||||||||||||||||||||||||||||||
920 | return never executed: static_cast<QFinalState*>(state);return static_cast<QFinalState*>(state); never executed: return static_cast<QFinalState*>(state); | 0 | ||||||||||||||||||||||||||||||
921 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
922 | } | - | ||||||||||||||||||||||||||||||
923 | - | |||||||||||||||||||||||||||||||
924 | QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
925 | { | - | ||||||||||||||||||||||||||||||
926 | if (state
| 0-4416 | ||||||||||||||||||||||||||||||
927 | return executed 22 times by 2 tests: static_cast<QHistoryState*>(state);return static_cast<QHistoryState*>(state); Executed by:
executed 22 times by 2 tests: return static_cast<QHistoryState*>(state); Executed by:
| 22 | ||||||||||||||||||||||||||||||
928 | return executed 4394 times by 2 tests: 0;return 0; Executed by:
executed 4394 times by 2 tests: return 0; Executed by:
| 4394 | ||||||||||||||||||||||||||||||
929 | } | - | ||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||
931 | bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const | - | ||||||||||||||||||||||||||||||
932 | { | - | ||||||||||||||||||||||||||||||
933 | if (isCompound(s)
| 1-18 | ||||||||||||||||||||||||||||||
934 | QState *grp = toStandardState(s); | - | ||||||||||||||||||||||||||||||
935 | QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates(); | - | ||||||||||||||||||||||||||||||
936 | for (int i = 0; i < lst.size()
| 4-30 | ||||||||||||||||||||||||||||||
937 | QAbstractState *cs = lst.at(i); | - | ||||||||||||||||||||||||||||||
938 | if (isFinal(cs)
| 4-18 | ||||||||||||||||||||||||||||||
939 | return executed 14 times by 1 test: true;return true; Executed by:
executed 14 times by 1 test: return true; Executed by:
| 14 | ||||||||||||||||||||||||||||||
940 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
941 | return executed 4 times by 1 test: false;return false; Executed by:
executed 4 times by 1 test: return false; Executed by:
| 4 | ||||||||||||||||||||||||||||||
942 | } else if (isParallel(s)
| 0-1 | ||||||||||||||||||||||||||||||
943 | QState *grp = toStandardState(s); | - | ||||||||||||||||||||||||||||||
944 | QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates(); | - | ||||||||||||||||||||||||||||||
945 | for (int i = 0; i < lst.size()
| 1-2 | ||||||||||||||||||||||||||||||
946 | QAbstractState *cs = lst.at(i); | - | ||||||||||||||||||||||||||||||
947 | if (!isInFinalState(cs)
| 0-2 | ||||||||||||||||||||||||||||||
948 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
949 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
950 | return executed 1 time by 1 test: true;return true; Executed by:
executed 1 time by 1 test: return true; Executed by:
| 1 | ||||||||||||||||||||||||||||||
951 | } | - | ||||||||||||||||||||||||||||||
952 | else | - | ||||||||||||||||||||||||||||||
953 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
954 | } | - | ||||||||||||||||||||||||||||||
955 | bool 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: registeredRestorablesForState.value(state).contains(id);return registeredRestorablesForState.value(state).contains(id); Executed by:
executed 48 times by 1 test: return registeredRestorablesForState.value(state).contains(id); Executed by:
| 48 | ||||||||||||||||||||||||||||||
960 | } | - | ||||||||||||||||||||||||||||||
961 | QVariant 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
| 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()
| 17-21 | ||||||||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||||||||
974 | - | |||||||||||||||||||||||||||||||
975 | return executed 17 times by 1 test: it.value();return it.value(); Executed by:
executed 17 times by 1 test: return it.value(); Executed by:
| 17 | ||||||||||||||||||||||||||||||
976 | } | - | ||||||||||||||||||||||||||||||
977 | } executed 21 times by 1 test: end of block Executed by:
| 21 | ||||||||||||||||||||||||||||||
978 | - | |||||||||||||||||||||||||||||||
979 | - | |||||||||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||||||||
981 | return executed 29 times by 1 test: object->property(propertyName);return object->property(propertyName); Executed by:
executed 29 times by 1 test: return object->property(propertyName); Executed by:
| 29 | ||||||||||||||||||||||||||||||
982 | } | - | ||||||||||||||||||||||||||||||
983 | - | |||||||||||||||||||||||||||||||
984 | void 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)
| 0-46 | ||||||||||||||||||||||||||||||
993 | restorables.insert(id, value); executed 46 times by 1 test: restorables.insert(id, value); Executed by:
| 46 | ||||||||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||||||||
998 | } executed 46 times by 1 test: end of block Executed by:
| 46 | ||||||||||||||||||||||||||||||
999 | - | |||||||||||||||||||||||||||||||
1000 | void 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()
| 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()
| 24-46 | ||||||||||||||||||||||||||||||
1012 | continue; executed 24 times by 1 test: continue; Executed by:
| 24 | ||||||||||||||||||||||||||||||
1013 | QHash<RestorableId, QVariant> &restorables = it.value(); | - | ||||||||||||||||||||||||||||||
1014 | QHash<RestorableId, QVariant>::iterator it2; | - | ||||||||||||||||||||||||||||||
1015 | it2 = restorables.find(id); | - | ||||||||||||||||||||||||||||||
1016 | if (it2 == restorables.end()
| 9-37 | ||||||||||||||||||||||||||||||
1017 | continue; executed 9 times by 1 test: continue; Executed by:
| 9 | ||||||||||||||||||||||||||||||
1018 | - | |||||||||||||||||||||||||||||||
1019 | - | |||||||||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||||||||
1021 | restorables.erase(it2); | - | ||||||||||||||||||||||||||||||
1022 | if (restorables.isEmpty()
| 5-32 | ||||||||||||||||||||||||||||||
1023 | registeredRestorablesForState.erase(it); executed 32 times by 1 test: registeredRestorablesForState.erase(it); Executed by:
| 32 | ||||||||||||||||||||||||||||||
1024 | } executed 37 times by 1 test: end of block Executed by:
| 37 | ||||||||||||||||||||||||||||||
1025 | } executed 65 times by 1 test: end of block Executed by:
| 65 | ||||||||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||||||||
1027 | QVector<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()
| 23-25 | ||||||||||||||||||||||||||||||
1032 | const RestorableId &id = it.key(); | - | ||||||||||||||||||||||||||||||
1033 | if (!id.object()
| 1-24 | ||||||||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||||||||
1035 | continue; executed 1 time by 1 test: continue; Executed by:
| 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:
| 24 | ||||||||||||||||||||||||||||||
1042 | return executed 23 times by 1 test: result;return result; Executed by:
executed 23 times by 1 test: return result; Executed by:
| 23 | ||||||||||||||||||||||||||||||
1043 | } | - | ||||||||||||||||||||||||||||||
1044 | QHash<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
| 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()
| 39-1298 | ||||||||||||||||||||||||||||||
1053 | if (!restorables.contains(it.key())
| 1-38 | ||||||||||||||||||||||||||||||
1054 | restorables.insert(it.key(), it.value()); executed 38 times by 1 test: restorables.insert(it.key(), it.value()); Executed by:
| 38 | ||||||||||||||||||||||||||||||
1055 | } executed 39 times by 1 test: end of block Executed by:
| 39 | ||||||||||||||||||||||||||||||
1056 | } executed 1298 times by 2 tests: end of block Executed by:
| 1298 | ||||||||||||||||||||||||||||||
1057 | return executed 1235 times by 2 tests: restorables;return restorables; Executed by:
executed 1235 times by 2 tests: return restorables; Executed by:
| 1235 | ||||||||||||||||||||||||||||||
1058 | } | - | ||||||||||||||||||||||||||||||
1059 | QHash<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()
| 1388-1507 | ||||||||||||||||||||||||||||||
1064 | QState *s = toStandardState(statesToEnter_sorted.at(i)); | - | ||||||||||||||||||||||||||||||
1065 | if (!s
| 72-1435 | ||||||||||||||||||||||||||||||
1066 | continue; executed 72 times by 1 test: continue; Executed by:
| 72 | ||||||||||||||||||||||||||||||
1067 | - | |||||||||||||||||||||||||||||||
1068 | QVector<QPropertyAssignment> &assignments = QStatePrivate::get(s)->propertyAssignments; | - | ||||||||||||||||||||||||||||||
1069 | for (int j = 0; j < assignments.size()
| 110-1435 | ||||||||||||||||||||||||||||||
1070 | const QPropertyAssignment &assn = assignments.at(j); | - | ||||||||||||||||||||||||||||||
1071 | if (assn.objectDeleted()
| 1-109 | ||||||||||||||||||||||||||||||
1072 | assignments.removeAt(j--); | - | ||||||||||||||||||||||||||||||
1073 | } executed 1 time by 1 test: else {end of block Executed by:
| 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:
| 109 | ||||||||||||||||||||||||||||||
1077 | } | - | ||||||||||||||||||||||||||||||
1078 | } executed 1435 times by 2 tests: end of block Executed by:
| 1435 | ||||||||||||||||||||||||||||||
1079 | return executed 1388 times by 2 tests: assignmentsForState;return assignmentsForState; Executed by:
executed 1388 times by 2 tests: return assignmentsForState; Executed by:
| 1388 | ||||||||||||||||||||||||||||||
1080 | } | - | ||||||||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||||||||
1083 | - | |||||||||||||||||||||||||||||||
1084 | QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context) | - | ||||||||||||||||||||||||||||||
1085 | { | - | ||||||||||||||||||||||||||||||
1086 | - | |||||||||||||||||||||||||||||||
1087 | QAbstractState *errorState = 0; | - | ||||||||||||||||||||||||||||||
1088 | if (context != 0
| 9-40 | ||||||||||||||||||||||||||||||
1089 | QState *s = toStandardState(context); | - | ||||||||||||||||||||||||||||||
1090 | if (s != 0
| 1-39 | ||||||||||||||||||||||||||||||
1091 | errorState = s->errorState(); executed 39 times by 1 test: errorState = s->errorState(); Executed by:
| 39 | ||||||||||||||||||||||||||||||
1092 | - | |||||||||||||||||||||||||||||||
1093 | if (errorState == 0
| 11-29 | ||||||||||||||||||||||||||||||
1094 | errorState = findErrorState(context->parentState()); executed 29 times by 1 test: errorState = findErrorState(context->parentState()); Executed by:
| 29 | ||||||||||||||||||||||||||||||
1095 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||
1096 | - | |||||||||||||||||||||||||||||||
1097 | return executed 49 times by 1 test: errorState;return errorState; Executed by:
executed 49 times by 1 test: return errorState; Executed by:
| 49 | ||||||||||||||||||||||||||||||
1098 | } | - | ||||||||||||||||||||||||||||||
1099 | - | |||||||||||||||||||||||||||||||
1100 | void 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: QStateMachine::NoInitialStateError:case QStateMachine::NoInitialStateError: Executed by:
executed 16 times by 1 test: case QStateMachine::NoInitialStateError: Executed by:
| 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:
| 16 | ||||||||||||||||||||||||||||||
1113 | case executed 1 time by 1 test: QStateMachine::NoDefaultStateInHistoryStateError:case QStateMachine::NoDefaultStateInHistoryStateError: Executed by:
executed 1 time by 1 test: case QStateMachine::NoDefaultStateInHistoryStateError: Executed by:
| 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:
| 1 | ||||||||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||||||||
1120 | case executed 3 times by 1 test: QStateMachine::NoCommonAncestorForTransitionError:case QStateMachine::NoCommonAncestorForTransitionError: Executed by:
executed 3 times by 1 test: case QStateMachine::NoCommonAncestorForTransitionError: Executed by:
| 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:
| 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
| 1-19 | ||||||||||||||||||||||||||||||
1137 | currentErrorState = 0; executed 1 time by 1 test: currentErrorState = 0; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1138 | - | |||||||||||||||||||||||||||||||
1139 | ((!(currentErrorState != rootState())) ? qt_assert("currentErrorState != rootState()",__FILE__,1494) : qt_noop()); | - | ||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||
1141 | if (currentErrorState != 0
| 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:
| 10 | ||||||||||||||||||||||||||||||
1150 | } executed 10 times by 1 test: else {end of block Executed by:
| 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:
| 10 | ||||||||||||||||||||||||||||||
1155 | } | - | ||||||||||||||||||||||||||||||
1156 | - | |||||||||||||||||||||||||||||||
1157 | - | |||||||||||||||||||||||||||||||
1158 | - | |||||||||||||||||||||||||||||||
1159 | QPair<QList<QAbstractAnimation*>, QList<QAbstractAnimation*> > | - | ||||||||||||||||||||||||||||||
1160 | QStateMachinePrivate::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
| 5-50 | ||||||||||||||||||||||||||||||
1167 | for (int i = 0; i < group->animationCount()
| 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:
| 8 | ||||||||||||||||||||||||||||||
1174 | } executed 5 times by 1 test: else {end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
1175 | QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation); | - | ||||||||||||||||||||||||||||||
1176 | if (animation != 0
| 0-50 | ||||||||||||||||||||||||||||||
1177 | && prop.object == animation->targetObject()
| 4-46 | ||||||||||||||||||||||||||||||
1178 | && prop.propertyName == animation->propertyName()
| 10-36 | ||||||||||||||||||||||||||||||
1179 | - | |||||||||||||||||||||||||||||||
1180 | - | |||||||||||||||||||||||||||||||
1181 | if (!animation->endValue().isValid()
| 1-35 | ||||||||||||||||||||||||||||||
1182 | animation->setEndValue(prop.value); | - | ||||||||||||||||||||||||||||||
1183 | localResetEndValues.append(animation); | - | ||||||||||||||||||||||||||||||
1184 | } executed 35 times by 1 test: end of block Executed by:
| 35 | ||||||||||||||||||||||||||||||
1185 | handledAnimations.append(animation); | - | ||||||||||||||||||||||||||||||
1186 | } executed 36 times by 1 test: end of block Executed by:
| 36 | ||||||||||||||||||||||||||||||
1187 | } executed 50 times by 1 test: end of block Executed by:
| 50 | ||||||||||||||||||||||||||||||
1188 | return executed 55 times by 1 test: qMakePair(handledAnimations, localResetEndValues);return qMakePair(handledAnimations, localResetEndValues); Executed by:
executed 55 times by 1 test: return qMakePair(handledAnimations, localResetEndValues); Executed by:
| 55 | ||||||||||||||||||||||||||||||
1189 | } | - | ||||||||||||||||||||||||||||||
1190 | - | |||||||||||||||||||||||||||||||
1191 | void 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)
| 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:
| 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
| 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:
| 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()
| 3-12 | ||||||||||||||||||||||||||||||
1219 | animationsForState.erase(it); | - | ||||||||||||||||||||||||||||||
1220 | QStatePrivate::get(toStandardState(state))->emitPropertiesAssigned(); | - | ||||||||||||||||||||||||||||||
1221 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||
1222 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||
1223 | - | |||||||||||||||||||||||||||||||
1224 | QList<QAbstractAnimation *> QStateMachinePrivate::selectAnimations(const QList<QAbstractTransition *> &transitionList) const | - | ||||||||||||||||||||||||||||||
1225 | { | - | ||||||||||||||||||||||||||||||
1226 | QList<QAbstractAnimation *> selectedAnimations; | - | ||||||||||||||||||||||||||||||
1227 | if (animated
| 0-1388 | ||||||||||||||||||||||||||||||
1228 | for (int i = 0; i < transitionList.size()
| 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()
| 1387-1391 | ||||||||||||||||||||||||||||||
1236 | selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j)); executed 1387 times by 2 tests: selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j)); Executed by:
| 1387 | ||||||||||||||||||||||||||||||
1237 | } executed 1391 times by 2 tests: end of block Executed by:
| 1391 | ||||||||||||||||||||||||||||||
1238 | selectedAnimations << defaultAnimations; | - | ||||||||||||||||||||||||||||||
1239 | } executed 1388 times by 2 tests: end of block Executed by:
| 1388 | ||||||||||||||||||||||||||||||
1240 | return executed 1388 times by 2 tests: selectedAnimations;return selectedAnimations; Executed by:
executed 1388 times by 2 tests: return selectedAnimations; Executed by:
| 1388 | ||||||||||||||||||||||||||||||
1241 | } | - | ||||||||||||||||||||||||||||||
1242 | - | |||||||||||||||||||||||||||||||
1243 | void 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()
| 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()
| 0-20 | ||||||||||||||||||||||||||||||
1257 | topLevelAnim = group; never executed: topLevelAnim = group; | 0 | ||||||||||||||||||||||||||||||
1258 | topLevelAnim->stop(); | - | ||||||||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||||||||
1260 | if (resetAnimationEndValues.contains(anim)
| 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:
| 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()
| 18-20 | ||||||||||||||||||||||||||||||
1271 | const QVector<QPropertyAssignment> &assignments = it.value(); | - | ||||||||||||||||||||||||||||||
1272 | for (int j = 0; j < assignments.size()
| 8-18 | ||||||||||||||||||||||||||||||
1273 | if (assignments.at(j).hasTarget(assn.object, assn.propertyName)
| 8-10 | ||||||||||||||||||||||||||||||
1274 | found = true; | - | ||||||||||||||||||||||||||||||
1275 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||||||||||||||||||||
1276 | } | - | ||||||||||||||||||||||||||||||
1277 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
1278 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1279 | if (!found
| 10 | ||||||||||||||||||||||||||||||
1280 | assn.write(); | - | ||||||||||||||||||||||||||||||
1281 | if (!assn.explicitlySet
| 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:
| 10 | ||||||||||||||||||||||||||||||
1284 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1285 | } executed 1298 times by 2 tests: end of block Executed by:
| 1298 | ||||||||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||||||||
1287 | void 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)
| 115-1392 | ||||||||||||||||||||||||||||||
1293 | return; executed 1392 times by 2 tests: return; Executed by:
| 1392 | ||||||||||||||||||||||||||||||
1294 | QVector<QPropertyAssignment> &assignments = assignmentsForEnteredStates[state]; | - | ||||||||||||||||||||||||||||||
1295 | for (int i = 0; i < selectedAnimations.size()
| 41-85 | ||||||||||||||||||||||||||||||
1296 | QAbstractAnimation *anim = selectedAnimations.at(i); | - | ||||||||||||||||||||||||||||||
1297 | QVector<QPropertyAssignment>::iterator it; | - | ||||||||||||||||||||||||||||||
1298 | for (it = assignments.begin(); it != assignments.end()
| 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()
| 11-36 | ||||||||||||||||||||||||||||||
1304 | for (int j = 0; j < handlers.size()
| 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:
| 36 | ||||||||||||||||||||||||||||||
1312 | if ((
| 12-24 | ||||||||||||||||||||||||||||||
1313 | && !hasRestorable(state, assn.object, assn.propertyName)
| 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:
| 12 | ||||||||||||||||||||||||||||||
1318 | it = assignments.erase(it); | - | ||||||||||||||||||||||||||||||
1319 | } executed 36 times by 1 test: else {end of block Executed by:
| 36 | ||||||||||||||||||||||||||||||
1320 | ++it; | - | ||||||||||||||||||||||||||||||
1321 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||||||||
1322 | for (int j = 0; j < ret.second.size()
| 35-47 | ||||||||||||||||||||||||||||||
1323 | resetAnimationEndValues.insert(ret.second.at(j)); executed 35 times by 1 test: resetAnimationEndValues.insert(ret.second.at(j)); Executed by:
| 35 | ||||||||||||||||||||||||||||||
1324 | } executed 47 times by 1 test: end of block Executed by:
| 47 | ||||||||||||||||||||||||||||||
1325 | - | |||||||||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||||||||
1327 | QList<QVariantAnimation*> variantAnims = anim->findChildren<QVariantAnimation*>(); | - | ||||||||||||||||||||||||||||||
1328 | if (QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim)
| 3-38 | ||||||||||||||||||||||||||||||
1329 | variantAnims.append(va); executed 38 times by 1 test: variantAnims.append(va); Executed by:
| 38 | ||||||||||||||||||||||||||||||
1330 | - | |||||||||||||||||||||||||||||||
1331 | bool hasValidEndValue = false; | - | ||||||||||||||||||||||||||||||
1332 | for (int j = 0; j < variantAnims.size()
| 2-41 | ||||||||||||||||||||||||||||||
1333 | if (variantAnims.at(j)->endValue().isValid()
| 2-39 | ||||||||||||||||||||||||||||||
1334 | hasValidEndValue = true; | - | ||||||||||||||||||||||||||||||
1335 | break; executed 39 times by 1 test: break; Executed by:
| 39 | ||||||||||||||||||||||||||||||
1336 | } | - | ||||||||||||||||||||||||||||||
1337 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1338 | - | |||||||||||||||||||||||||||||||
1339 | if (hasValidEndValue
| 2-39 | ||||||||||||||||||||||||||||||
1340 | if (anim->state() == QAbstractAnimation::Running
| 5-34 | ||||||||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||||||||
1342 | - | |||||||||||||||||||||||||||||||
1343 | - | |||||||||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||||||||
1345 | - | |||||||||||||||||||||||||||||||
1346 | anim->stop(); | - | ||||||||||||||||||||||||||||||
1347 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
1348 | anim->start(); | - | ||||||||||||||||||||||||||||||
1349 | } executed 39 times by 1 test: end of block Executed by:
| 39 | ||||||||||||||||||||||||||||||
1350 | - | |||||||||||||||||||||||||||||||
1351 | if (assignments.isEmpty()
| 11-30 | ||||||||||||||||||||||||||||||
1352 | assignmentsForEnteredStates.remove(state); | - | ||||||||||||||||||||||||||||||
1353 | break; executed 30 times by 1 test: break; Executed by:
| 30 | ||||||||||||||||||||||||||||||
1354 | } | - | ||||||||||||||||||||||||||||||
1355 | } executed 11 times by 1 test: end of block Executed by:
| 11 | ||||||||||||||||||||||||||||||
1356 | } executed 115 times by 2 tests: end of block Executed by:
| 115 | ||||||||||||||||||||||||||||||
1357 | - | |||||||||||||||||||||||||||||||
1358 | - | |||||||||||||||||||||||||||||||
1359 | - | |||||||||||||||||||||||||||||||
1360 | QAbstractTransition *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:
| 153 | ||||||||||||||||||||||||||||||
1368 | protected: | - | ||||||||||||||||||||||||||||||
1369 | virtual bool eventTest(QEvent *) override { return never executed: true;return 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: QState::ExclusiveStates:case QState::ExclusiveStates: Executed by:
executed 152 times by 2 tests: case QState::ExclusiveStates: Executed by:
| 152 | ||||||||||||||||||||||||||||||
1378 | targets.append(root->initialState()); | - | ||||||||||||||||||||||||||||||
1379 | break; executed 152 times by 2 tests: break; Executed by:
| 152 | ||||||||||||||||||||||||||||||
1380 | case executed 1 time by 1 test: QState::ParallelStates:case QState::ParallelStates: Executed by:
executed 1 time by 1 test: case QState::ParallelStates: Executed by:
| 1 | ||||||||||||||||||||||||||||||
1381 | targets = QStatePrivate::get(root)->childStates(); | - | ||||||||||||||||||||||||||||||
1382 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1383 | } | - | ||||||||||||||||||||||||||||||
1384 | return executed 153 times by 2 tests: new InitialTransition(targets);return new InitialTransition(targets); Executed by:
executed 153 times by 2 tests: return new InitialTransition(targets); Executed by:
| 153 | ||||||||||||||||||||||||||||||
1385 | } | - | ||||||||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||||||||
1387 | void QStateMachinePrivate::clearHistory() | - | ||||||||||||||||||||||||||||||
1388 | { | - | ||||||||||||||||||||||||||||||
1389 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1390 | QList<QHistoryState*> historyStates = q->findChildren<QHistoryState*>(); | - | ||||||||||||||||||||||||||||||
1391 | for (int i = 0; i < historyStates.size()
| 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:
| 10 | ||||||||||||||||||||||||||||||
1395 | } executed 153 times by 2 tests: end of block Executed by:
| 153 | ||||||||||||||||||||||||||||||
1396 | void QStateMachinePrivate::registerMultiThreadedSignalTransitions() | - | ||||||||||||||||||||||||||||||
1397 | { | - | ||||||||||||||||||||||||||||||
1398 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1399 | QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>(); | - | ||||||||||||||||||||||||||||||
1400 | for (int i = 0; i < transitions.size()
| 81-153 | ||||||||||||||||||||||||||||||
1401 | QSignalTransition *t = transitions.at(i); | - | ||||||||||||||||||||||||||||||
1402 | if ((
| 1-78 | ||||||||||||||||||||||||||||||
1403 | registerSignalTransition(t); executed 7 times by 1 test: registerSignalTransition(t); Executed by:
| 7 | ||||||||||||||||||||||||||||||
1404 | } executed 81 times by 2 tests: end of block Executed by:
| 81 | ||||||||||||||||||||||||||||||
1405 | } executed 153 times by 2 tests: end of block Executed by:
| 153 | ||||||||||||||||||||||||||||||
1406 | - | |||||||||||||||||||||||||||||||
1407 | void 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:
| 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
| 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: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1476 | _q_process(); | - | ||||||||||||||||||||||||||||||
1477 | } executed 151 times by 2 tests: end of block Executed by:
| 151 | ||||||||||||||||||||||||||||||
1478 | } | - | ||||||||||||||||||||||||||||||
1479 | - | |||||||||||||||||||||||||||||||
1480 | void 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
| 355-1548 | ||||||||||||||||||||||||||||||
1493 | if (stop
| 19-1529 | ||||||||||||||||||||||||||||||
1494 | processing = false; | - | ||||||||||||||||||||||||||||||
1495 | break; executed 19 times by 1 test: break; Executed by:
| 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()
| 25-1504 | ||||||||||||||||||||||||||||||
1503 | delete e; | - | ||||||||||||||||||||||||||||||
1504 | e = 0; | - | ||||||||||||||||||||||||||||||
1505 | } executed 1504 times by 2 tests: end of block Executed by:
| 1504 | ||||||||||||||||||||||||||||||
1506 | while (enabledTransitions.isEmpty()
| 99-1512 | ||||||||||||||||||||||||||||||
1507 | - | |||||||||||||||||||||||||||||||
1508 | - | |||||||||||||||||||||||||||||||
1509 | - | |||||||||||||||||||||||||||||||
1510 | enabledTransitions = selectTransitions(e, &calculationCache); | - | ||||||||||||||||||||||||||||||
1511 | if (enabledTransitions.isEmpty()
| 8-91 | ||||||||||||||||||||||||||||||
1512 | delete e; | - | ||||||||||||||||||||||||||||||
1513 | e = 0; | - | ||||||||||||||||||||||||||||||
1514 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
1515 | } executed 99 times by 2 tests: end of block Executed by:
| 99 | ||||||||||||||||||||||||||||||
1516 | while (enabledTransitions.isEmpty()
| 294-2416 | ||||||||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||||||||
1520 | enabledTransitions = selectTransitions(e, &calculationCache); | - | ||||||||||||||||||||||||||||||
1521 | if (enabledTransitions.isEmpty()
| 1003-1119 | ||||||||||||||||||||||||||||||
1522 | delete e; | - | ||||||||||||||||||||||||||||||
1523 | e = 0; | - | ||||||||||||||||||||||||||||||
1524 | } executed 1003 times by 1 test: end of block Executed by:
| 1003 | ||||||||||||||||||||||||||||||
1525 | } executed 2122 times by 2 tests: end of block Executed by:
| 2122 | ||||||||||||||||||||||||||||||
1526 | if (enabledTransitions.isEmpty()
| 294-1235 | ||||||||||||||||||||||||||||||
1527 | if (isInternalEventQueueEmpty()
| 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:
| 293 | ||||||||||||||||||||||||||||||
1535 | } executed 294 times by 2 tests: else {end of block Executed by:
| 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:
| 1235 | ||||||||||||||||||||||||||||||
1541 | delete e; | - | ||||||||||||||||||||||||||||||
1542 | } executed 1529 times by 2 tests: end of block Executed by:
| 1529 | ||||||||||||||||||||||||||||||
1543 | - | |||||||||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||||||||
1545 | - | |||||||||||||||||||||||||||||||
1546 | if (stop
| 22-352 | ||||||||||||||||||||||||||||||
1547 | stop = false; | - | ||||||||||||||||||||||||||||||
1548 | stopProcessingReason = Stopped; | - | ||||||||||||||||||||||||||||||
1549 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||||||||
1551 | switch (stopProcessingReason) { | - | ||||||||||||||||||||||||||||||
1552 | case executed 291 times by 2 tests: EventQueueEmpty:case EventQueueEmpty: Executed by:
executed 291 times by 2 tests: case EventQueueEmpty: Executed by:
| 291 | ||||||||||||||||||||||||||||||
1553 | processedPendingEvents(didChange); | - | ||||||||||||||||||||||||||||||
1554 | break; executed 291 times by 2 tests: break; Executed by:
| 291 | ||||||||||||||||||||||||||||||
1555 | case executed 61 times by 1 test: Finished:case Finished: Executed by:
executed 61 times by 1 test: case Finished: Executed by:
| 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:
| 61 | ||||||||||||||||||||||||||||||
1562 | case executed 22 times by 1 test: Stopped:case Stopped: Executed by:
executed 22 times by 1 test: case Stopped: Executed by:
| 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:
| 22 | ||||||||||||||||||||||||||||||
1569 | } | - | ||||||||||||||||||||||||||||||
1570 | endMacrostep(didChange); | - | ||||||||||||||||||||||||||||||
1571 | if (stopProcessingReason == Finished
| 61-313 | ||||||||||||||||||||||||||||||
1572 | exitInterpreter(); executed 61 times by 1 test: exitInterpreter(); Executed by:
| 61 | ||||||||||||||||||||||||||||||
1573 | } executed 374 times by 2 tests: end of block Executed by:
| 374 | ||||||||||||||||||||||||||||||
1574 | - | |||||||||||||||||||||||||||||||
1575 | void 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()
| 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
| 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: else {end of block | 0 | ||||||||||||||||||||||||||||||
1590 | timerIdToDelayedEventId.insert(e.timerId, id); | - | ||||||||||||||||||||||||||||||
1591 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1592 | } else { | - | ||||||||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||||||||
1594 | delayedEventIdFreeList.release(id); | - | ||||||||||||||||||||||||||||||
1595 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1596 | } | - | ||||||||||||||||||||||||||||||
1597 | - | |||||||||||||||||||||||||||||||
1598 | void 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 | - | |||||||||||||||||||||||||||||||
1606 | void 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:
| 99 | ||||||||||||||||||||||||||||||
1611 | - | |||||||||||||||||||||||||||||||
1612 | void 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:
| 2123 | ||||||||||||||||||||||||||||||
1617 | - | |||||||||||||||||||||||||||||||
1618 | QEvent *QStateMachinePrivate::dequeueInternalEvent() | - | ||||||||||||||||||||||||||||||
1619 | { | - | ||||||||||||||||||||||||||||||
1620 | QMutexLocker locker(&internalEventMutex); | - | ||||||||||||||||||||||||||||||
1621 | if (internalEventQueue.isEmpty()
| 99-1413 | ||||||||||||||||||||||||||||||
1622 | return executed 1413 times by 2 tests: 0;return 0; Executed by:
executed 1413 times by 2 tests: return 0; Executed by:
| 1413 | ||||||||||||||||||||||||||||||
1623 | return executed 99 times by 2 tests: internalEventQueue.takeFirst();return internalEventQueue.takeFirst(); Executed by:
executed 99 times by 2 tests: return internalEventQueue.takeFirst(); Executed by:
| 99 | ||||||||||||||||||||||||||||||
1624 | } | - | ||||||||||||||||||||||||||||||
1625 | - | |||||||||||||||||||||||||||||||
1626 | QEvent *QStateMachinePrivate::dequeueExternalEvent() | - | ||||||||||||||||||||||||||||||
1627 | { | - | ||||||||||||||||||||||||||||||
1628 | QMutexLocker locker(&externalEventMutex); | - | ||||||||||||||||||||||||||||||
1629 | if (externalEventQueue.isEmpty()
| 294-2122 | ||||||||||||||||||||||||||||||
1630 | return executed 294 times by 2 tests: 0;return 0; Executed by:
executed 294 times by 2 tests: return 0; Executed by:
| 294 | ||||||||||||||||||||||||||||||
1631 | return executed 2122 times by 2 tests: externalEventQueue.takeFirst();return externalEventQueue.takeFirst(); Executed by:
executed 2122 times by 2 tests: return externalEventQueue.takeFirst(); Executed by:
| 2122 | ||||||||||||||||||||||||||||||
1632 | } | - | ||||||||||||||||||||||||||||||
1633 | - | |||||||||||||||||||||||||||||||
1634 | bool QStateMachinePrivate::isInternalEventQueueEmpty() | - | ||||||||||||||||||||||||||||||
1635 | { | - | ||||||||||||||||||||||||||||||
1636 | QMutexLocker locker(&internalEventMutex); | - | ||||||||||||||||||||||||||||||
1637 | return executed 294 times by 2 tests: internalEventQueue.isEmpty();return internalEventQueue.isEmpty(); Executed by:
executed 294 times by 2 tests: return internalEventQueue.isEmpty(); Executed by:
| 294 | ||||||||||||||||||||||||||||||
1638 | } | - | ||||||||||||||||||||||||||||||
1639 | - | |||||||||||||||||||||||||||||||
1640 | bool QStateMachinePrivate::isExternalEventQueueEmpty() | - | ||||||||||||||||||||||||||||||
1641 | { | - | ||||||||||||||||||||||||||||||
1642 | QMutexLocker locker(&externalEventMutex); | - | ||||||||||||||||||||||||||||||
1643 | return never executed: externalEventQueue.isEmpty();return externalEventQueue.isEmpty(); never executed: return externalEventQueue.isEmpty(); | 0 | ||||||||||||||||||||||||||||||
1644 | } | - | ||||||||||||||||||||||||||||||
1645 | - | |||||||||||||||||||||||||||||||
1646 | void QStateMachinePrivate::processEvents(EventProcessingMode processingMode) | - | ||||||||||||||||||||||||||||||
1647 | { | - | ||||||||||||||||||||||||||||||
1648 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1649 | if ((
| 0-2249 | ||||||||||||||||||||||||||||||
1650 | return; executed 2026 times by 1 test: return; Executed by:
| 2026 | ||||||||||||||||||||||||||||||
1651 | switch (processingMode) { | - | ||||||||||||||||||||||||||||||
1652 | case executed 93 times by 2 tests: DirectProcessing:case DirectProcessing: Executed by:
executed 93 times by 2 tests: case DirectProcessing: Executed by:
| 93 | ||||||||||||||||||||||||||||||
1653 | if (QThread::currentThread() == q->thread()
| 0-93 | ||||||||||||||||||||||||||||||
1654 | _q_process(); | - | ||||||||||||||||||||||||||||||
1655 | break; executed 93 times by 2 tests: break; Executed by:
| 93 | ||||||||||||||||||||||||||||||
1656 | } | - | ||||||||||||||||||||||||||||||
1657 | case executed 130 times by 2 tests: case QueuedProcessing: Executed by:
code before this statement never executed: case QueuedProcessing: executed 130 times by 2 tests: QueuedProcessing:case QueuedProcessing: Executed by:
code before this statement never executed: case QueuedProcessing: executed 130 times by 2 tests: case QueuedProcessing: Executed by:
| 0-130 | ||||||||||||||||||||||||||||||
1658 | processingScheduled = true; | - | ||||||||||||||||||||||||||||||
1659 | QMetaObject::invokeMethod(q, "_q_process", Qt::QueuedConnection); | - | ||||||||||||||||||||||||||||||
1660 | break; executed 130 times by 2 tests: break; Executed by:
| 130 | ||||||||||||||||||||||||||||||
1661 | } | - | ||||||||||||||||||||||||||||||
1662 | } executed 223 times by 2 tests: end of block Executed by:
| 223 | ||||||||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||||||||
1664 | void 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()
| 2-83 | ||||||||||||||||||||||||||||||
1670 | const DelayedEvent &e = it.value(); | - | ||||||||||||||||||||||||||||||
1671 | if (e.timerId
| 0-2 | ||||||||||||||||||||||||||||||
1672 | timerIdToDelayedEventId.remove(e.timerId); | - | ||||||||||||||||||||||||||||||
1673 | q->killTimer(e.timerId); | - | ||||||||||||||||||||||||||||||
1674 | delayedEventIdFreeList.release(it.key()); | - | ||||||||||||||||||||||||||||||
1675 | } executed 2 times by 1 test: else {end of block Executed by:
| 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:
| 2 | ||||||||||||||||||||||||||||||
1680 | delayedEvents.clear(); | - | ||||||||||||||||||||||||||||||
1681 | } executed 83 times by 1 test: end of block Executed by:
| 83 | ||||||||||||||||||||||||||||||
1682 | - | |||||||||||||||||||||||||||||||
1683 | - | |||||||||||||||||||||||||||||||
1684 | - | |||||||||||||||||||||||||||||||
1685 | - | |||||||||||||||||||||||||||||||
1686 | - | |||||||||||||||||||||||||||||||
1687 | - | |||||||||||||||||||||||||||||||
1688 | - | |||||||||||||||||||||||||||||||
1689 | void QStateMachinePrivate::noMicrostep() | - | ||||||||||||||||||||||||||||||
1690 | { } | - | ||||||||||||||||||||||||||||||
1691 | void QStateMachinePrivate::processedPendingEvents(bool didChange) | - | ||||||||||||||||||||||||||||||
1692 | { | - | ||||||||||||||||||||||||||||||
1693 | (void)didChange;; | - | ||||||||||||||||||||||||||||||
1694 | } executed 291 times by 2 tests: end of block Executed by:
| 291 | ||||||||||||||||||||||||||||||
1695 | - | |||||||||||||||||||||||||||||||
1696 | void QStateMachinePrivate::beginMacrostep() | - | ||||||||||||||||||||||||||||||
1697 | { } | - | ||||||||||||||||||||||||||||||
1698 | - | |||||||||||||||||||||||||||||||
1699 | void QStateMachinePrivate::endMacrostep(bool didChange) | - | ||||||||||||||||||||||||||||||
1700 | { | - | ||||||||||||||||||||||||||||||
1701 | (void)didChange;; | - | ||||||||||||||||||||||||||||||
1702 | } executed 374 times by 2 tests: end of block Executed by:
| 374 | ||||||||||||||||||||||||||||||
1703 | - | |||||||||||||||||||||||||||||||
1704 | void QStateMachinePrivate::exitInterpreter() | - | ||||||||||||||||||||||||||||||
1705 | { | - | ||||||||||||||||||||||||||||||
1706 | } | - | ||||||||||||||||||||||||||||||
1707 | - | |||||||||||||||||||||||||||||||
1708 | void 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:
| 11 | ||||||||||||||||||||||||||||||
1720 | - | |||||||||||||||||||||||||||||||
1721 | void QStateMachinePrivate::startupHook() | - | ||||||||||||||||||||||||||||||
1722 | { | - | ||||||||||||||||||||||||||||||
1723 | } | - | ||||||||||||||||||||||||||||||
1724 | - | |||||||||||||||||||||||||||||||
1725 | namespace _QStateMachine_Internal{ | - | ||||||||||||||||||||||||||||||
1726 | - | |||||||||||||||||||||||||||||||
1727 | class 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 {}; | - | ||||||||||||||||||||||||||||||
1734 | public: | - | ||||||||||||||||||||||||||||||
1735 | GoToStateTransition(QAbstractState *target) | - | ||||||||||||||||||||||||||||||
1736 | : QAbstractTransition() | - | ||||||||||||||||||||||||||||||
1737 | { setTargetState(target); } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1738 | protected: | - | ||||||||||||||||||||||||||||||
1739 | void onTransition(QEvent *) override { deleteLater(); } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1740 | bool eventTest(QEvent *) override { return executed 4 times by 1 test: true;return true; Executed by:
executed 4 times by 1 test: }return true; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1741 | }; | - | ||||||||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||||||||
1743 | } | - | ||||||||||||||||||||||||||||||
1744 | - | |||||||||||||||||||||||||||||||
1745 | - | |||||||||||||||||||||||||||||||
1746 | using namespace _QStateMachine_Internal; | - | ||||||||||||||||||||||||||||||
1747 | void QStateMachinePrivate::goToState(QAbstractState *targetState) | - | ||||||||||||||||||||||||||||||
1748 | { | - | ||||||||||||||||||||||||||||||
1749 | if (!targetState
| 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)
| 2-5 | ||||||||||||||||||||||||||||||
1755 | return; executed 2 times by 1 test: return; Executed by:
| 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()
| 0-5 | ||||||||||||||||||||||||||||||
1761 | sourceState = toStandardState(*it); | - | ||||||||||||||||||||||||||||||
1762 | if (sourceState != 0
| 0-5 | ||||||||||||||||||||||||||||||
1763 | break; executed 5 times by 1 test: break; Executed by:
| 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
| 1-4 | ||||||||||||||||||||||||||||||
1771 | trans = new GoToStateTransition(targetState); | - | ||||||||||||||||||||||||||||||
1772 | sourceState->addTransition(trans); | - | ||||||||||||||||||||||||||||||
1773 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1774 | trans->setTargetState(targetState); | - | ||||||||||||||||||||||||||||||
1775 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||
1776 | - | |||||||||||||||||||||||||||||||
1777 | processEvents(QueuedProcessing); | - | ||||||||||||||||||||||||||||||
1778 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
1779 | - | |||||||||||||||||||||||||||||||
1780 | void QStateMachinePrivate::registerTransitions(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
1781 | { | - | ||||||||||||||||||||||||||||||
1782 | QState *group = toStandardState(state); | - | ||||||||||||||||||||||||||||||
1783 | if (!group
| 72-1435 | ||||||||||||||||||||||||||||||
1784 | return; executed 72 times by 1 test: return; Executed by:
| 72 | ||||||||||||||||||||||||||||||
1785 | QList<QAbstractTransition*> transitions = QStatePrivate::get(group)->transitions(); | - | ||||||||||||||||||||||||||||||
1786 | for (int i = 0; i < transitions.size()
| 1435-2314 | ||||||||||||||||||||||||||||||
1787 | QAbstractTransition *t = transitions.at(i); | - | ||||||||||||||||||||||||||||||
1788 | registerTransition(t); | - | ||||||||||||||||||||||||||||||
1789 | } executed 2314 times by 2 tests: end of block Executed by:
| 2314 | ||||||||||||||||||||||||||||||
1790 | } executed 1435 times by 2 tests: end of block Executed by:
| 1435 | ||||||||||||||||||||||||||||||
1791 | - | |||||||||||||||||||||||||||||||
1792 | void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transition) | - | ||||||||||||||||||||||||||||||
1793 | { | - | ||||||||||||||||||||||||||||||
1794 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
| 70-154 | ||||||||||||||||||||||||||||||
1795 | maybeRegisterSignalTransition(st); | - | ||||||||||||||||||||||||||||||
1796 | } executed 70 times by 2 tests: end of block Executed by:
| 70 | ||||||||||||||||||||||||||||||
1797 | - | |||||||||||||||||||||||||||||||
1798 | else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)
| 16-138 | ||||||||||||||||||||||||||||||
1799 | maybeRegisterEventTransition(et); | - | ||||||||||||||||||||||||||||||
1800 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
1801 | - | |||||||||||||||||||||||||||||||
1802 | } executed 224 times by 2 tests: end of block Executed by:
| 224 | ||||||||||||||||||||||||||||||
1803 | - | |||||||||||||||||||||||||||||||
1804 | void QStateMachinePrivate::registerTransition(QAbstractTransition *transition) | - | ||||||||||||||||||||||||||||||
1805 | { | - | ||||||||||||||||||||||||||||||
1806 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
| 1083-1231 | ||||||||||||||||||||||||||||||
1807 | registerSignalTransition(st); | - | ||||||||||||||||||||||||||||||
1808 | } executed 1083 times by 2 tests: end of block Executed by:
| 1083 | ||||||||||||||||||||||||||||||
1809 | - | |||||||||||||||||||||||||||||||
1810 | else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)
| 20-1211 | ||||||||||||||||||||||||||||||
1811 | registerEventTransition(oet); | - | ||||||||||||||||||||||||||||||
1812 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||||||||
1814 | } executed 2314 times by 2 tests: end of block Executed by:
| 2314 | ||||||||||||||||||||||||||||||
1815 | - | |||||||||||||||||||||||||||||||
1816 | void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition) | - | ||||||||||||||||||||||||||||||
1817 | { | - | ||||||||||||||||||||||||||||||
1818 | if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)
| 2-3 | ||||||||||||||||||||||||||||||
1819 | unregisterSignalTransition(st); | - | ||||||||||||||||||||||||||||||
1820 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1821 | - | |||||||||||||||||||||||||||||||
1822 | else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)
| 1-2 | ||||||||||||||||||||||||||||||
1823 | unregisterEventTransition(oet); | - | ||||||||||||||||||||||||||||||
1824 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1825 | - | |||||||||||||||||||||||||||||||
1826 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||
1827 | - | |||||||||||||||||||||||||||||||
1828 | void QStateMachinePrivate::maybeRegisterSignalTransition(QSignalTransition *transition) | - | ||||||||||||||||||||||||||||||
1829 | { | - | ||||||||||||||||||||||||||||||
1830 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1831 | if ((
| 1-200012 | ||||||||||||||||||||||||||||||
1832 | || (transition->senderObject()
| 0-1 | ||||||||||||||||||||||||||||||
1833 | registerSignalTransition(transition); | - | ||||||||||||||||||||||||||||||
1834 | } executed 200011 times by 1 test: end of block Executed by:
| 200011 | ||||||||||||||||||||||||||||||
1835 | } executed 200080 times by 2 tests: end of block Executed by:
| 200080 | ||||||||||||||||||||||||||||||
1836 | - | |||||||||||||||||||||||||||||||
1837 | void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transition) | - | ||||||||||||||||||||||||||||||
1838 | { | - | ||||||||||||||||||||||||||||||
1839 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1840 | if (QSignalTransitionPrivate::get(transition)->signalIndex != -1
| 1011-200090 | ||||||||||||||||||||||||||||||
1841 | return; executed 1011 times by 1 test: return; Executed by:
| 1011 | ||||||||||||||||||||||||||||||
1842 | const QObject *sender = QSignalTransitionPrivate::get(transition)->sender; | - | ||||||||||||||||||||||||||||||
1843 | if (!sender
| 100003-100087 | ||||||||||||||||||||||||||||||
1844 | return; executed 100003 times by 1 test: return; Executed by:
| 100003 | ||||||||||||||||||||||||||||||
1845 | QByteArray signal = QSignalTransitionPrivate::get(transition)->signal; | - | ||||||||||||||||||||||||||||||
1846 | if (signal.isEmpty()
| 1-100086 | ||||||||||||||||||||||||||||||
1847 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||||||||||||||||||||
1848 | if (signal.startsWith('0'+2)
| 2-100084 | ||||||||||||||||||||||||||||||
1849 | signal.remove(0, 1); executed 100084 times by 2 tests: signal.remove(0, 1); Executed by:
| 100084 | ||||||||||||||||||||||||||||||
1850 | const QMetaObject *meta = sender->metaObject(); | - | ||||||||||||||||||||||||||||||
1851 | int signalIndex = meta->indexOfSignal(signal); | - | ||||||||||||||||||||||||||||||
1852 | int originalSignalIndex = signalIndex; | - | ||||||||||||||||||||||||||||||
1853 | if (signalIndex == -1
| 1-100085 | ||||||||||||||||||||||||||||||
1854 | signalIndex = meta->indexOfSignal(QMetaObject::normalizedSignature(signal)); | - | ||||||||||||||||||||||||||||||
1855 | if (signalIndex == -1
| 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:
| 1 | ||||||||||||||||||||||||||||||
1859 | } | - | ||||||||||||||||||||||||||||||
1860 | originalSignalIndex = signalIndex; | - | ||||||||||||||||||||||||||||||
1861 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1862 | - | |||||||||||||||||||||||||||||||
1863 | - | |||||||||||||||||||||||||||||||
1864 | while (meta->method(signalIndex).attributes() & QMetaMethod::Cloned
| 2-100085 | ||||||||||||||||||||||||||||||
1865 | -- executed 2 times by 1 test: signalIndex;--signalIndex; Executed by:
executed 2 times by 1 test: --signalIndex; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1866 | - | |||||||||||||||||||||||||||||||
1867 | connectionsMutex.lock(); | - | ||||||||||||||||||||||||||||||
1868 | QVector<int> &connectedSignalIndexes = connections[sender]; | - | ||||||||||||||||||||||||||||||
1869 | if (connectedSignalIndexes.size() <= signalIndex
| 13-100072 | ||||||||||||||||||||||||||||||
1870 | connectedSignalIndexes.resize(signalIndex+1); executed 100072 times by 2 tests: connectedSignalIndexes.resize(signalIndex+1); Executed by:
| 100072 | ||||||||||||||||||||||||||||||
1871 | if (connectedSignalIndexes.at(signalIndex) == 0
| 12-100073 | ||||||||||||||||||||||||||||||
1872 | if (!signalEventGenerator
| 43-100030 | ||||||||||||||||||||||||||||||
1873 | signalEventGenerator = new QSignalEventGenerator(q); executed 43 times by 2 tests: signalEventGenerator = new QSignalEventGenerator(q); Executed by:
| 43 | ||||||||||||||||||||||||||||||
1874 | static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset(); | - | ||||||||||||||||||||||||||||||
1875 | bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, generatorMethodOffset); | - | ||||||||||||||||||||||||||||||
1876 | if (!ok
| 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:
| 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:
| 100085 | ||||||||||||||||||||||||||||||
1896 | - | |||||||||||||||||||||||||||||||
1897 | void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transition) | - | ||||||||||||||||||||||||||||||
1898 | { | - | ||||||||||||||||||||||||||||||
1899 | int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex; | - | ||||||||||||||||||||||||||||||
1900 | if (signalIndex == -1
| 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 (--
| 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()
| 100048-300412 | ||||||||||||||||||||||||||||||
1915 | sum += connectedSignalIndexes.at(i); executed 300412 times by 1 test: sum += connectedSignalIndexes.at(i); Executed by:
| 300412 | ||||||||||||||||||||||||||||||
1916 | if (sum == 0
| 10-100038 | ||||||||||||||||||||||||||||||
1917 | connections.remove(sender); executed 100038 times by 1 test: connections.remove(sender); Executed by:
| 100038 | ||||||||||||||||||||||||||||||
1918 | } executed 100048 times by 1 test: end of block Executed by:
| 100048 | ||||||||||||||||||||||||||||||
1919 | connectionsMutex.unlock(); | - | ||||||||||||||||||||||||||||||
1920 | } executed 100049 times by 1 test: end of block Executed by:
| 100049 | ||||||||||||||||||||||||||||||
1921 | - | |||||||||||||||||||||||||||||||
1922 | void 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()
| 47-85 | ||||||||||||||||||||||||||||||
1928 | QSignalTransition *t = transitions.at(i); | - | ||||||||||||||||||||||||||||||
1929 | if (t->machine() == q
| 3-44 | ||||||||||||||||||||||||||||||
1930 | unregisterSignalTransition(t); executed 44 times by 1 test: unregisterSignalTransition(t); Executed by:
| 44 | ||||||||||||||||||||||||||||||
1931 | } executed 47 times by 1 test: end of block Executed by:
| 47 | ||||||||||||||||||||||||||||||
1932 | } | - | ||||||||||||||||||||||||||||||
1933 | { | - | ||||||||||||||||||||||||||||||
1934 | QList<QEventTransition*> transitions = rootState()->findChildren<QEventTransition*>(); | - | ||||||||||||||||||||||||||||||
1935 | for (int i = 0; i < transitions.size()
| 15-85 | ||||||||||||||||||||||||||||||
1936 | QEventTransition *t = transitions.at(i); | - | ||||||||||||||||||||||||||||||
1937 | if (t->machine() == q
| 0-15 | ||||||||||||||||||||||||||||||
1938 | unregisterEventTransition(t); executed 15 times by 1 test: unregisterEventTransition(t); Executed by:
| 15 | ||||||||||||||||||||||||||||||
1939 | } executed 15 times by 1 test: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||
1940 | } | - | ||||||||||||||||||||||||||||||
1941 | } executed 85 times by 1 test: end of block Executed by:
| 85 | ||||||||||||||||||||||||||||||
1942 | - | |||||||||||||||||||||||||||||||
1943 | - | |||||||||||||||||||||||||||||||
1944 | void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition) | - | ||||||||||||||||||||||||||||||
1945 | { | - | ||||||||||||||||||||||||||||||
1946 | if ((
| 1-15 | ||||||||||||||||||||||||||||||
1947 | registerEventTransition(transition); executed 7 times by 1 test: registerEventTransition(transition); Executed by:
| 7 | ||||||||||||||||||||||||||||||
1948 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||||||||||||||
1949 | - | |||||||||||||||||||||||||||||||
1950 | void QStateMachinePrivate::registerEventTransition(QEventTransition *transition) | - | ||||||||||||||||||||||||||||||
1951 | { | - | ||||||||||||||||||||||||||||||
1952 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1953 | if (QEventTransitionPrivate::get(transition)->registered
| 0-27 | ||||||||||||||||||||||||||||||
1954 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1955 | if (transition->eventType() >= QEvent::User
| 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:
| 1 | ||||||||||||||||||||||||||||||
1958 | } | - | ||||||||||||||||||||||||||||||
1959 | QObject *object = QEventTransitionPrivate::get(transition)->object; | - | ||||||||||||||||||||||||||||||
1960 | if (!object
| 0-26 | ||||||||||||||||||||||||||||||
1961 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1962 | QObjectPrivate *od = QObjectPrivate::get(object); | - | ||||||||||||||||||||||||||||||
1963 | if (!od->extraData
| 5-21 | ||||||||||||||||||||||||||||||
1964 | object->installEventFilter(q); executed 19 times by 1 test: object->installEventFilter(q); Executed by:
| 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:
| 26 | ||||||||||||||||||||||||||||||
1973 | - | |||||||||||||||||||||||||||||||
1974 | void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transition) | - | ||||||||||||||||||||||||||||||
1975 | { | - | ||||||||||||||||||||||||||||||
1976 | QStateMachine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1977 | if (!QEventTransitionPrivate::get(transition)->registered
| 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 (--
| 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()
| 3-19 | ||||||||||||||||||||||||||||||
1987 | sum += it.value(); executed 3 times by 1 test: sum += it.value(); Executed by:
| 3 | ||||||||||||||||||||||||||||||
1988 | if (sum == 0
| 3-16 | ||||||||||||||||||||||||||||||
1989 | qobjectEvents.remove(object); | - | ||||||||||||||||||||||||||||||
1990 | object->removeEventFilter(q); | - | ||||||||||||||||||||||||||||||
1991 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
1992 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||||||||||||||||||||
1993 | QEventTransitionPrivate::get(transition)->registered = false; | - | ||||||||||||||||||||||||||||||
1994 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1995 | - | |||||||||||||||||||||||||||||||
1996 | void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event) | - | ||||||||||||||||||||||||||||||
1997 | { | - | ||||||||||||||||||||||||||||||
1998 | if (qobjectEvents.value(watched).contains(event->type())
| 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:
| 25 | ||||||||||||||||||||||||||||||
2002 | } executed 27 times by 1 test: end of block Executed by:
| 27 | ||||||||||||||||||||||||||||||
2003 | - | |||||||||||||||||||||||||||||||
2004 | - | |||||||||||||||||||||||||||||||
2005 | void 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
| 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:
| 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:
| 70 | ||||||||||||||||||||||||||||||
2030 | - | |||||||||||||||||||||||||||||||
2031 | - | |||||||||||||||||||||||||||||||
2032 | - | |||||||||||||||||||||||||||||||
2033 | - | |||||||||||||||||||||||||||||||
2034 | QStateMachine::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:
| 139 | ||||||||||||||||||||||||||||||
2041 | - | |||||||||||||||||||||||||||||||
2042 | - | |||||||||||||||||||||||||||||||
2043 | - | |||||||||||||||||||||||||||||||
2044 | - | |||||||||||||||||||||||||||||||
2045 | - | |||||||||||||||||||||||||||||||
2046 | - | |||||||||||||||||||||||||||||||
2047 | - | |||||||||||||||||||||||||||||||
2048 | QStateMachine::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:
| 6 | ||||||||||||||||||||||||||||||
2055 | - | |||||||||||||||||||||||||||||||
2056 | - | |||||||||||||||||||||||||||||||
2057 | - | |||||||||||||||||||||||||||||||
2058 | - | |||||||||||||||||||||||||||||||
2059 | QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent) | - | ||||||||||||||||||||||||||||||
2060 | : QState(dd, 0) | - | ||||||||||||||||||||||||||||||
2061 | { | - | ||||||||||||||||||||||||||||||
2062 | setParent(parent); | - | ||||||||||||||||||||||||||||||
2063 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2064 | - | |||||||||||||||||||||||||||||||
2065 | - | |||||||||||||||||||||||||||||||
2066 | - | |||||||||||||||||||||||||||||||
2067 | - | |||||||||||||||||||||||||||||||
2068 | QStateMachine::~QStateMachine() | - | ||||||||||||||||||||||||||||||
2069 | { | - | ||||||||||||||||||||||||||||||
2070 | } | - | ||||||||||||||||||||||||||||||
2071 | QStateMachine::Error QStateMachine::error() const | - | ||||||||||||||||||||||||||||||
2072 | { | - | ||||||||||||||||||||||||||||||
2073 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2074 | return executed 13 times by 1 test: d->error;return d->error; Executed by:
executed 13 times by 1 test: return d->error; Executed by:
| 13 | ||||||||||||||||||||||||||||||
2075 | } | - | ||||||||||||||||||||||||||||||
2076 | - | |||||||||||||||||||||||||||||||
2077 | - | |||||||||||||||||||||||||||||||
2078 | - | |||||||||||||||||||||||||||||||
2079 | - | |||||||||||||||||||||||||||||||
2080 | QString QStateMachine::errorString() const | - | ||||||||||||||||||||||||||||||
2081 | { | - | ||||||||||||||||||||||||||||||
2082 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2083 | return executed 11 times by 1 test: d->errorString;return d->errorString; Executed by:
executed 11 times by 1 test: return d->errorString; Executed by:
| 11 | ||||||||||||||||||||||||||||||
2084 | } | - | ||||||||||||||||||||||||||||||
2085 | - | |||||||||||||||||||||||||||||||
2086 | - | |||||||||||||||||||||||||||||||
2087 | - | |||||||||||||||||||||||||||||||
2088 | - | |||||||||||||||||||||||||||||||
2089 | void 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:
| 1 | ||||||||||||||||||||||||||||||
2095 | - | |||||||||||||||||||||||||||||||
2096 | - | |||||||||||||||||||||||||||||||
2097 | - | |||||||||||||||||||||||||||||||
2098 | - | |||||||||||||||||||||||||||||||
2099 | - | |||||||||||||||||||||||||||||||
2100 | - | |||||||||||||||||||||||||||||||
2101 | QState::RestorePolicy QStateMachine::globalRestorePolicy() const | - | ||||||||||||||||||||||||||||||
2102 | { | - | ||||||||||||||||||||||||||||||
2103 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2104 | return executed 1 time by 1 test: d->globalRestorePolicy;return d->globalRestorePolicy; Executed by:
executed 1 time by 1 test: return d->globalRestorePolicy; Executed by:
| 1 | ||||||||||||||||||||||||||||||
2105 | } | - | ||||||||||||||||||||||||||||||
2106 | - | |||||||||||||||||||||||||||||||
2107 | - | |||||||||||||||||||||||||||||||
2108 | - | |||||||||||||||||||||||||||||||
2109 | - | |||||||||||||||||||||||||||||||
2110 | - | |||||||||||||||||||||||||||||||
2111 | - | |||||||||||||||||||||||||||||||
2112 | - | |||||||||||||||||||||||||||||||
2113 | void 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:
| 18 | ||||||||||||||||||||||||||||||
2118 | void QStateMachine::addState(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
2119 | { | - | ||||||||||||||||||||||||||||||
2120 | if (!state
| 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:
| 1 | ||||||||||||||||||||||||||||||
2123 | } | - | ||||||||||||||||||||||||||||||
2124 | if (QAbstractStatePrivate::get(state)->machine() == this
| 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:
| 2 | ||||||||||||||||||||||||||||||
2127 | } | - | ||||||||||||||||||||||||||||||
2128 | state->setParent(this); | - | ||||||||||||||||||||||||||||||
2129 | } executed 45 times by 1 test: end of block Executed by:
| 45 | ||||||||||||||||||||||||||||||
2130 | - | |||||||||||||||||||||||||||||||
2131 | - | |||||||||||||||||||||||||||||||
2132 | - | |||||||||||||||||||||||||||||||
2133 | - | |||||||||||||||||||||||||||||||
2134 | - | |||||||||||||||||||||||||||||||
2135 | - | |||||||||||||||||||||||||||||||
2136 | - | |||||||||||||||||||||||||||||||
2137 | void QStateMachine::removeState(QAbstractState *state) | - | ||||||||||||||||||||||||||||||
2138 | { | - | ||||||||||||||||||||||||||||||
2139 | if (!state
| 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:
| 1 | ||||||||||||||||||||||||||||||
2142 | } | - | ||||||||||||||||||||||||||||||
2143 | if (QAbstractStatePrivate::get(state)->machine() != this
| 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:
| 1 | ||||||||||||||||||||||||||||||
2148 | } | - | ||||||||||||||||||||||||||||||
2149 | state->setParent(0); | - | ||||||||||||||||||||||||||||||
2150 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
2151 | - | |||||||||||||||||||||||||||||||
2152 | bool QStateMachine::isRunning() const | - | ||||||||||||||||||||||||||||||
2153 | { | - | ||||||||||||||||||||||||||||||
2154 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2155 | return executed 174 times by 1 test: (d->state == QStateMachinePrivate::Running);return (d->state == QStateMachinePrivate::Running); Executed by:
executed 174 times by 1 test: return (d->state == QStateMachinePrivate::Running); Executed by:
| 174 | ||||||||||||||||||||||||||||||
2156 | } | - | ||||||||||||||||||||||||||||||
2157 | void QStateMachine::start() | - | ||||||||||||||||||||||||||||||
2158 | { | - | ||||||||||||||||||||||||||||||
2159 | QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2160 | - | |||||||||||||||||||||||||||||||
2161 | if ((
| 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:
| 3 | ||||||||||||||||||||||||||||||
2164 | } | - | ||||||||||||||||||||||||||||||
2165 | - | |||||||||||||||||||||||||||||||
2166 | switch (d->state) { | - | ||||||||||||||||||||||||||||||
2167 | case executed 153 times by 2 tests: QStateMachinePrivate::NotRunning:case QStateMachinePrivate::NotRunning: Executed by:
executed 153 times by 2 tests: case QStateMachinePrivate::NotRunning: Executed by:
| 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:
| 153 | ||||||||||||||||||||||||||||||
2171 | case never executed: QStateMachinePrivate::Starting:case QStateMachinePrivate::Starting: never executed: case QStateMachinePrivate::Starting: | 0 | ||||||||||||||||||||||||||||||
2172 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
2173 | case executed 2 times by 1 test: QStateMachinePrivate::Running:case QStateMachinePrivate::Running: Executed by:
executed 2 times by 1 test: case QStateMachinePrivate::Running: Executed by:
| 2 | ||||||||||||||||||||||||||||||
2174 | QMessageLogger(__FILE__, 2630, __PRETTY_FUNCTION__).warning("QStateMachine::start(): already running"); | - | ||||||||||||||||||||||||||||||
2175 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2176 | } | - | ||||||||||||||||||||||||||||||
2177 | } executed 155 times by 2 tests: end of block Executed by:
| 155 | ||||||||||||||||||||||||||||||
2178 | - | |||||||||||||||||||||||||||||||
2179 | - | |||||||||||||||||||||||||||||||
2180 | - | |||||||||||||||||||||||||||||||
2181 | - | |||||||||||||||||||||||||||||||
2182 | - | |||||||||||||||||||||||||||||||
2183 | - | |||||||||||||||||||||||||||||||
2184 | - | |||||||||||||||||||||||||||||||
2185 | void QStateMachine::stop() | - | ||||||||||||||||||||||||||||||
2186 | { | - | ||||||||||||||||||||||||||||||
2187 | QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2188 | switch (d->state) { | - | ||||||||||||||||||||||||||||||
2189 | case executed 7 times by 1 test: QStateMachinePrivate::NotRunning:case QStateMachinePrivate::NotRunning: Executed by:
executed 7 times by 1 test: case QStateMachinePrivate::NotRunning: Executed by:
| 7 | ||||||||||||||||||||||||||||||
2190 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||||||||||||||||||||
2191 | case never executed: QStateMachinePrivate::Starting:case 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: QStateMachinePrivate::Running:case QStateMachinePrivate::Running: Executed by:
executed 22 times by 1 test: case QStateMachinePrivate::Running: Executed by:
| 22 | ||||||||||||||||||||||||||||||
2196 | d->stop = true; | - | ||||||||||||||||||||||||||||||
2197 | d->processEvents(QStateMachinePrivate::QueuedProcessing); | - | ||||||||||||||||||||||||||||||
2198 | break; executed 22 times by 1 test: break; Executed by:
| 22 | ||||||||||||||||||||||||||||||
2199 | } | - | ||||||||||||||||||||||||||||||
2200 | } executed 29 times by 1 test: end of block Executed by:
| 29 | ||||||||||||||||||||||||||||||
2201 | - | |||||||||||||||||||||||||||||||
2202 | void QStateMachine::setRunning(bool running) | - | ||||||||||||||||||||||||||||||
2203 | { | - | ||||||||||||||||||||||||||||||
2204 | if (running
| 4-5 | ||||||||||||||||||||||||||||||
2205 | start(); executed 4 times by 1 test: start(); Executed by:
| 4 | ||||||||||||||||||||||||||||||
2206 | else | - | ||||||||||||||||||||||||||||||
2207 | stop(); executed 5 times by 1 test: stop(); Executed by:
| 5 | ||||||||||||||||||||||||||||||
2208 | } | - | ||||||||||||||||||||||||||||||
2209 | void 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: QStateMachinePrivate::Running:case QStateMachinePrivate::Running: Executed by:
executed 2123 times by 2 tests: case QStateMachinePrivate::Running: Executed by:
| 2123 | ||||||||||||||||||||||||||||||
2214 | case never executed: QStateMachinePrivate::Starting:case QStateMachinePrivate::Starting: never executed: case QStateMachinePrivate::Starting: | 0 | ||||||||||||||||||||||||||||||
2215 | break; executed 2123 times by 2 tests: break; Executed by:
| 2123 | ||||||||||||||||||||||||||||||
2216 | default executed 2 times by 1 test: :default: Executed by:
executed 2 times by 1 test: default: Executed by:
| 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:
| 2 | ||||||||||||||||||||||||||||||
2219 | } | - | ||||||||||||||||||||||||||||||
2220 | if (!event
| 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: NormalPriority:case NormalPriority: Executed by:
executed 2119 times by 2 tests: case NormalPriority: Executed by:
| 2119 | ||||||||||||||||||||||||||||||
2229 | d->postExternalEvent(event); | - | ||||||||||||||||||||||||||||||
2230 | break; executed 2119 times by 2 tests: break; Executed by:
| 2119 | ||||||||||||||||||||||||||||||
2231 | case executed 4 times by 1 test: HighPriority:case HighPriority: Executed by:
executed 4 times by 1 test: case HighPriority: Executed by:
| 4 | ||||||||||||||||||||||||||||||
2232 | d->postInternalEvent(event); | - | ||||||||||||||||||||||||||||||
2233 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2234 | } | - | ||||||||||||||||||||||||||||||
2235 | d->processEvents(QStateMachinePrivate::QueuedProcessing); | - | ||||||||||||||||||||||||||||||
2236 | } executed 2123 times by 2 tests: end of block Executed by:
| 2123 | ||||||||||||||||||||||||||||||
2237 | int QStateMachine::postDelayedEvent(QEvent *event, int delay) | - | ||||||||||||||||||||||||||||||
2238 | { | - | ||||||||||||||||||||||||||||||
2239 | QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2240 | if (d->state != QStateMachinePrivate::Running
| 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: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
2243 | } | - | ||||||||||||||||||||||||||||||
2244 | if (!event
| 0-9 | ||||||||||||||||||||||||||||||
2245 | QMessageLogger(__FILE__, 2733, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: cannot post null event"); | - | ||||||||||||||||||||||||||||||
2246 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
2247 | } | - | ||||||||||||||||||||||||||||||
2248 | if (delay < 0
| 0-9 | ||||||||||||||||||||||||||||||
2249 | QMessageLogger(__FILE__, 2737, __PRETTY_FUNCTION__).warning("QStateMachine::postDelayedEvent: delay cannot be negative"); | - | ||||||||||||||||||||||||||||||
2250 | return never executed: -1;return -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
| 2-7 | ||||||||||||||||||||||||||||||
2259 | if (inMachineThread
| 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: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
2263 | } | - | ||||||||||||||||||||||||||||||
2264 | QStateMachinePrivate::DelayedEvent delayedEvent(event, timerId); | - | ||||||||||||||||||||||||||||||
2265 | d->delayedEvents.insert(id, delayedEvent); | - | ||||||||||||||||||||||||||||||
2266 | if (timerId
| 2-7 | ||||||||||||||||||||||||||||||
2267 | d->timerIdToDelayedEventId.insert(timerId, id); | - | ||||||||||||||||||||||||||||||
2268 | } executed 7 times by 1 test: else {end of block Executed by:
| 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:
| 2 | ||||||||||||||||||||||||||||||
2275 | return executed 9 times by 1 test: id;return id; Executed by:
executed 9 times by 1 test: return id; Executed by:
| 9 | ||||||||||||||||||||||||||||||
2276 | } | - | ||||||||||||||||||||||||||||||
2277 | bool QStateMachine::cancelDelayedEvent(int id) | - | ||||||||||||||||||||||||||||||
2278 | { | - | ||||||||||||||||||||||||||||||
2279 | QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2280 | if (d->state != QStateMachinePrivate::Running
| 1-5 | ||||||||||||||||||||||||||||||
2281 | QMessageLogger(__FILE__, 2779, __PRETTY_FUNCTION__).warning("QStateMachine::cancelDelayedEvent: the machine is not running"); | - | ||||||||||||||||||||||||||||||
2282 | return executed 1 time by 1 test: false;return false; Executed by:
executed 1 time by 1 test: return false; Executed by:
| 1 | ||||||||||||||||||||||||||||||
2283 | } | - | ||||||||||||||||||||||||||||||
2284 | QMutexLocker locker(&d->delayedEventsMutex); | - | ||||||||||||||||||||||||||||||
2285 | QStateMachinePrivate::DelayedEvent e = d->delayedEvents.take(id); | - | ||||||||||||||||||||||||||||||
2286 | if (!e.event
| 2-3 | ||||||||||||||||||||||||||||||
2287 | return executed 2 times by 1 test: false;return false; Executed by:
executed 2 times by 1 test: return false; Executed by:
| 2 | ||||||||||||||||||||||||||||||
2288 | if (e.timerId
| 1-2 | ||||||||||||||||||||||||||||||
2289 | d->timerIdToDelayedEventId.remove(e.timerId); | - | ||||||||||||||||||||||||||||||
2290 | bool inMachineThread = (QThread::currentThread() == thread()); | - | ||||||||||||||||||||||||||||||
2291 | if (inMachineThread
| 0-2 | ||||||||||||||||||||||||||||||
2292 | killTimer(e.timerId); | - | ||||||||||||||||||||||||||||||
2293 | d->delayedEventIdFreeList.release(id); | - | ||||||||||||||||||||||||||||||
2294 | } executed 2 times by 1 test: else {end of block Executed by:
| 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:
| 1 | ||||||||||||||||||||||||||||||
2303 | delete e.event; | - | ||||||||||||||||||||||||||||||
2304 | return executed 3 times by 1 test: true;return true; Executed by:
executed 3 times by 1 test: return true; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2305 | } | - | ||||||||||||||||||||||||||||||
2306 | QSet<QAbstractState*> QStateMachine::configuration() const | - | ||||||||||||||||||||||||||||||
2307 | { | - | ||||||||||||||||||||||||||||||
2308 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2309 | return executed 938 times by 2 tests: d->configuration;return d->configuration; Executed by:
executed 938 times by 2 tests: return d->configuration; Executed by:
| 938 | ||||||||||||||||||||||||||||||
2310 | } | - | ||||||||||||||||||||||||||||||
2311 | bool QStateMachine::event(QEvent *e) | - | ||||||||||||||||||||||||||||||
2312 | { | - | ||||||||||||||||||||||||||||||
2313 | QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2314 | if (e->type() == QEvent::Timer
| 4-685 | ||||||||||||||||||||||||||||||
2315 | QTimerEvent *te = static_cast<QTimerEvent*>(e); | - | ||||||||||||||||||||||||||||||
2316 | int tid = te->timerId(); | - | ||||||||||||||||||||||||||||||
2317 | if (d->state != QStateMachinePrivate::Running
| 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: true;return 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
| 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: true;return true; Executed by:
executed 4 times by 1 test: return true; Executed by:
| 4 | ||||||||||||||||||||||||||||||
2334 | } else { | - | ||||||||||||||||||||||||||||||
2335 | d->delayedEventsMutex.unlock(); | - | ||||||||||||||||||||||||||||||
2336 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
2337 | } | - | ||||||||||||||||||||||||||||||
2338 | return executed 685 times by 2 tests: QState::event(e);return QState::event(e); Executed by:
executed 685 times by 2 tests: return QState::event(e); Executed by:
| 685 | ||||||||||||||||||||||||||||||
2339 | } | - | ||||||||||||||||||||||||||||||
2340 | - | |||||||||||||||||||||||||||||||
2341 | - | |||||||||||||||||||||||||||||||
2342 | - | |||||||||||||||||||||||||||||||
2343 | - | |||||||||||||||||||||||||||||||
2344 | - | |||||||||||||||||||||||||||||||
2345 | bool 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: false;return false; Executed by:
executed 27 times by 1 test: return false; Executed by:
| 27 | ||||||||||||||||||||||||||||||
2350 | } | - | ||||||||||||||||||||||||||||||
2351 | void QStateMachine::beginSelectTransitions(QEvent *event) | - | ||||||||||||||||||||||||||||||
2352 | { | - | ||||||||||||||||||||||||||||||
2353 | (void)event;; | - | ||||||||||||||||||||||||||||||
2354 | } executed 3744 times by 2 tests: end of block Executed by:
| 3744 | ||||||||||||||||||||||||||||||
2355 | void QStateMachine::endSelectTransitions(QEvent *event) | - | ||||||||||||||||||||||||||||||
2356 | { | - | ||||||||||||||||||||||||||||||
2357 | (void)event;; | - | ||||||||||||||||||||||||||||||
2358 | } executed 3750 times by 2 tests: end of block Executed by:
| 3750 | ||||||||||||||||||||||||||||||
2359 | void QStateMachine::beginMicrostep(QEvent *event) | - | ||||||||||||||||||||||||||||||
2360 | { | - | ||||||||||||||||||||||||||||||
2361 | (void)event;; | - | ||||||||||||||||||||||||||||||
2362 | } executed 1235 times by 2 tests: end of block Executed by:
| 1235 | ||||||||||||||||||||||||||||||
2363 | void QStateMachine::endMicrostep(QEvent *event) | - | ||||||||||||||||||||||||||||||
2364 | { | - | ||||||||||||||||||||||||||||||
2365 | (void)event;; | - | ||||||||||||||||||||||||||||||
2366 | } executed 1235 times by 2 tests: end of block Executed by:
| 1235 | ||||||||||||||||||||||||||||||
2367 | - | |||||||||||||||||||||||||||||||
2368 | - | |||||||||||||||||||||||||||||||
2369 | - | |||||||||||||||||||||||||||||||
2370 | - | |||||||||||||||||||||||||||||||
2371 | - | |||||||||||||||||||||||||||||||
2372 | void QStateMachine::onEntry(QEvent *event) | - | ||||||||||||||||||||||||||||||
2373 | { | - | ||||||||||||||||||||||||||||||
2374 | start(); | - | ||||||||||||||||||||||||||||||
2375 | QState::onEntry(event); | - | ||||||||||||||||||||||||||||||
2376 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
2377 | - | |||||||||||||||||||||||||||||||
2378 | - | |||||||||||||||||||||||||||||||
2379 | - | |||||||||||||||||||||||||||||||
2380 | - | |||||||||||||||||||||||||||||||
2381 | - | |||||||||||||||||||||||||||||||
2382 | - | |||||||||||||||||||||||||||||||
2383 | void QStateMachine::onExit(QEvent *event) | - | ||||||||||||||||||||||||||||||
2384 | { | - | ||||||||||||||||||||||||||||||
2385 | stop(); | - | ||||||||||||||||||||||||||||||
2386 | QState::onExit(event); | - | ||||||||||||||||||||||||||||||
2387 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||||||||||||||||||||
2388 | - | |||||||||||||||||||||||||||||||
2389 | - | |||||||||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||||||||
2391 | - | |||||||||||||||||||||||||||||||
2392 | - | |||||||||||||||||||||||||||||||
2393 | - | |||||||||||||||||||||||||||||||
2394 | bool QStateMachine::isAnimated() const | - | ||||||||||||||||||||||||||||||
2395 | { | - | ||||||||||||||||||||||||||||||
2396 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2397 | return executed 3 times by 1 test: d->animated;return d->animated; Executed by:
executed 3 times by 1 test: return d->animated; Executed by:
| 3 | ||||||||||||||||||||||||||||||
2398 | } | - | ||||||||||||||||||||||||||||||
2399 | - | |||||||||||||||||||||||||||||||
2400 | - | |||||||||||||||||||||||||||||||
2401 | - | |||||||||||||||||||||||||||||||
2402 | - | |||||||||||||||||||||||||||||||
2403 | void 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:
| 2 | ||||||||||||||||||||||||||||||
2408 | - | |||||||||||||||||||||||||||||||
2409 | - | |||||||||||||||||||||||||||||||
2410 | - | |||||||||||||||||||||||||||||||
2411 | - | |||||||||||||||||||||||||||||||
2412 | void 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:
| 9 | ||||||||||||||||||||||||||||||
2417 | - | |||||||||||||||||||||||||||||||
2418 | - | |||||||||||||||||||||||||||||||
2419 | - | |||||||||||||||||||||||||||||||
2420 | - | |||||||||||||||||||||||||||||||
2421 | QList<QAbstractAnimation*> QStateMachine::defaultAnimations() const | - | ||||||||||||||||||||||||||||||
2422 | { | - | ||||||||||||||||||||||||||||||
2423 | const QStateMachinePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
2424 | return executed 10 times by 1 test: d->defaultAnimations;return d->defaultAnimations; Executed by:
executed 10 times by 1 test: return d->defaultAnimations; Executed by:
| 10 | ||||||||||||||||||||||||||||||
2425 | } | - | ||||||||||||||||||||||||||||||
2426 | - | |||||||||||||||||||||||||||||||
2427 | - | |||||||||||||||||||||||||||||||
2428 | - | |||||||||||||||||||||||||||||||
2429 | - | |||||||||||||||||||||||||||||||
2430 | void 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:
| 3 | ||||||||||||||||||||||||||||||
2435 | - | |||||||||||||||||||||||||||||||
2436 | - | |||||||||||||||||||||||||||||||
2437 | - | |||||||||||||||||||||||||||||||
2438 | - | |||||||||||||||||||||||||||||||
2439 | - | |||||||||||||||||||||||||||||||
2440 | struct qt_meta_stringdata_QSignalEventGenerator_t { | - | ||||||||||||||||||||||||||||||
2441 | QByteArrayData data[3]; | - | ||||||||||||||||||||||||||||||
2442 | char stringdata[32]; | - | ||||||||||||||||||||||||||||||
2443 | }; | - | ||||||||||||||||||||||||||||||
2444 | - | |||||||||||||||||||||||||||||||
2445 | - | |||||||||||||||||||||||||||||||
2446 | - | |||||||||||||||||||||||||||||||
2447 | - | |||||||||||||||||||||||||||||||
2448 | - | |||||||||||||||||||||||||||||||
2449 | static 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 | - | |||||||||||||||||||||||||||||||
2459 | static 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 | - | |||||||||||||||||||||||||||||||
2481 | void 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 | - | |||||||||||||||||||||||||||||||
2494 | const QMetaObject QSignalEventGenerator::staticMetaObject = { | - | ||||||||||||||||||||||||||||||
2495 | { &QObject::staticMetaObject, qt_meta_stringdata_QSignalEventGenerator.data, | - | ||||||||||||||||||||||||||||||
2496 | qt_meta_data_QSignalEventGenerator, qt_static_metacall, 0, 0 } | - | ||||||||||||||||||||||||||||||
2497 | }; | - | ||||||||||||||||||||||||||||||
2498 | - | |||||||||||||||||||||||||||||||
2499 | const QMetaObject *QSignalEventGenerator::metaObject() const | - | ||||||||||||||||||||||||||||||
2500 | { | - | ||||||||||||||||||||||||||||||
2501 | return &staticMetaObject; | - | ||||||||||||||||||||||||||||||
2502 | } | - | ||||||||||||||||||||||||||||||
2503 | - | |||||||||||||||||||||||||||||||
2504 | void *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 | - | |||||||||||||||||||||||||||||||
2512 | int 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 | - | |||||||||||||||||||||||||||||||
2526 | void 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:
| 70 | ||||||||||||||||||||||||||||||
2533 | - | |||||||||||||||||||||||||||||||
2534 | QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent) | - | ||||||||||||||||||||||||||||||
2535 | : QObject(parent) | - | ||||||||||||||||||||||||||||||
2536 | { | - | ||||||||||||||||||||||||||||||
2537 | } executed 43 times by 2 tests: end of block Executed by:
| 43 | ||||||||||||||||||||||||||||||
2538 | QStateMachine::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:
| 71 | ||||||||||||||||||||||||||||||
2544 | - | |||||||||||||||||||||||||||||||
2545 | - | |||||||||||||||||||||||||||||||
2546 | - | |||||||||||||||||||||||||||||||
2547 | - | |||||||||||||||||||||||||||||||
2548 | QStateMachine::SignalEvent::~SignalEvent() | - | ||||||||||||||||||||||||||||||
2549 | { | - | ||||||||||||||||||||||||||||||
2550 | } | - | ||||||||||||||||||||||||||||||
2551 | QStateMachine::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:
| 26 | ||||||||||||||||||||||||||||||
2555 | - | |||||||||||||||||||||||||||||||
2556 | - | |||||||||||||||||||||||||||||||
2557 | - | |||||||||||||||||||||||||||||||
2558 | - | |||||||||||||||||||||||||||||||
2559 | QStateMachine::WrappedEvent::~WrappedEvent() | - | ||||||||||||||||||||||||||||||
2560 | { | - | ||||||||||||||||||||||||||||||
2561 | delete m_event; | - | ||||||||||||||||||||||||||||||
2562 | } executed 25 times by 1 test: end of block Executed by:
| 25 | ||||||||||||||||||||||||||||||
2563 | - | |||||||||||||||||||||||||||||||
2564 | - | |||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |