qstate.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qstate.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6QStatePrivate::QStatePrivate()-
7 : QAbstractStatePrivate(StandardState),-
8 errorState(0), initialState(0), childMode(QState::ExclusiveStates),-
9 childStatesListNeedsRefresh(true), transitionsListNeedsRefresh(true)-
10{-
11}
executed 539 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
539
12-
13QStatePrivate::~QStatePrivate()-
14{-
15}-
16-
17void QStatePrivate::emitFinished()-
18{-
19 QState * const q = q_func();-
20 q->finished(QState::QPrivateSignal());-
21}
executed 74 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
74
22-
23void QStatePrivate::emitPropertiesAssigned()-
24{-
25 QState * const q = q_func();-
26 q->propertiesAssigned(QState::QPrivateSignal());-
27}
executed 1415 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1415
28-
29-
30-
31-
32QState::QState(QState *parent)-
33 : QAbstractState(*new QStatePrivate, parent)-
34{-
35}
executed 378 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
378
36-
37-
38-
39-
40-
41QState::QState(ChildMode childMode, QState *parent)-
42 : QAbstractState(*new QStatePrivate, parent)-
43{-
44 QStatePrivate * const d = d_func();-
45 d->childMode = childMode;-
46}
executed 16 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
16
47-
48-
49-
50-
51QState::QState(QStatePrivate &dd, QState *parent)-
52 : QAbstractState(dd, parent)-
53{-
54}
executed 145 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
145
55-
56-
57-
58-
59QState::~QState()-
60{-
61}-
62-
63QList<QAbstractState*> QStatePrivate::childStates() const-
64{-
65 if (childStatesListNeedsRefresh
childStatesListNeedsRefreshDescription
TRUEevaluated 548 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 7102 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
548-7102
66 childStatesList.clear();-
67 QList<QObject*>::const_iterator it;-
68 for (it = children.constBegin(); it != children.constEnd()
it != children.constEnd()Description
TRUEevaluated 891 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 548 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
548-891
69 QAbstractState *s = qobject_cast<QAbstractState*>(*it);-
70 if (!s
!sDescription
TRUEevaluated 328 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 563 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| qobject_cast<QHistoryState*>(s)
qobject_cast<Q...toryState*>(s)Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 555 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
8-563
71 continue;
executed 336 times by 2 tests: continue;
Executed by:
  • tst_QState
  • tst_QStateMachine
336
72 childStatesList.append(s);-
73 }
executed 555 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
555
74 childStatesListNeedsRefresh = false;-
75 }
executed 548 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
548
76 return
executed 7650 times by 2 tests: return childStatesList;
Executed by:
  • tst_QState
  • tst_QStateMachine
childStatesList;
executed 7650 times by 2 tests: return childStatesList;
Executed by:
  • tst_QState
  • tst_QStateMachine
7650
77}-
78-
79QList<QHistoryState*> QStatePrivate::historyStates() const-
80{-
81 QList<QHistoryState*> result;-
82 QList<QObject*>::const_iterator it;-
83 for (it = children.constBegin(); it != children.constEnd()
it != children.constEnd()Description
TRUEevaluated 2438 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1291 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
1291-2438
84 QHistoryState *h = qobject_cast<QHistoryState*>(*it);-
85 if (h
hDescription
TRUEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2429 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
9-2429
86 result.append(h);
executed 9 times by 2 tests: result.append(h);
Executed by:
  • tst_QState
  • tst_QStateMachine
9
87 }
executed 2438 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
2438
88 return
executed 1291 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
result;
executed 1291 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
1291
89}-
90-
91QList<QAbstractTransition*> QStatePrivate::transitions() const-
92{-
93 if (transitionsListNeedsRefresh
transitionsListNeedsRefreshDescription
TRUEevaluated 505 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 7842 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
505-7842
94 transitionsList.clear();-
95 QList<QObject*>::const_iterator it;-
96 for (it = children.constBegin(); it != children.constEnd()
it != children.constEnd()Description
TRUEevaluated 808 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 505 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++it) {
505-808
97 QAbstractTransition *t = qobject_cast<QAbstractTransition*>(*it);-
98 if (t
tDescription
TRUEevaluated 240 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 568 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
240-568
99 transitionsList.append(t);
executed 240 times by 2 tests: transitionsList.append(t);
Executed by:
  • tst_QState
  • tst_QStateMachine
240
100 }
executed 808 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
808
101 transitionsListNeedsRefresh = false;-
102 }
executed 505 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
505
103 return
executed 8347 times by 2 tests: return transitionsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
transitionsList;
executed 8347 times by 2 tests: return transitionsList;
Executed by:
  • tst_QState
  • tst_QStateMachine
8347
104}-
105void QState::assignProperty(QObject *object, const char *name,-
106 const QVariant &value)-
107{-
108 QStatePrivate * const d = d_func();-
109 if (!object
!objectDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 103 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-103
110 QMessageLogger(__FILE__, 263, __PRETTY_FUNCTION__).warning("QState::assignProperty: cannot assign property '%s' of null object", name);-
111 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
112 }-
113 for (int i = 0; i < d->propertyAssignments.size()
i < d->propert...gnments.size()Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 101 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
15-101
114 QPropertyAssignment &assn = d->propertyAssignments[i];-
115 if (assn.hasTarget(object, name)
assn.hasTarget(object, name)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
2-13
116 assn.value = value;-
117 return;
executed 2 times by 2 tests: return;
Executed by:
  • tst_QState
  • tst_QStateMachine
2
118 }-
119 }
executed 13 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
13
120 d->propertyAssignments.append(QPropertyAssignment(object, name, value));-
121}
executed 101 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
101
122QAbstractState *QState::errorState() const-
123{-
124 const QStatePrivate * const d = d_func();-
125 return
executed 44 times by 1 test: return d->errorState;
Executed by:
  • tst_QStateMachine
d->errorState;
executed 44 times by 1 test: return d->errorState;
Executed by:
  • tst_QStateMachine
44
126}-
127void QState::setErrorState(QAbstractState *state)-
128{-
129 QStatePrivate * const d = d_func();-
130 if (state != 0
state != 0Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& qobject_cast<QStateMachine*>(state)
qobject_cast<Q...chine*>(state)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 13 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-14
131 QMessageLogger(__FILE__, 300, __PRETTY_FUNCTION__).warning("QStateMachine::setErrorState: root state cannot be error state");-
132 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
133 }-
134 if (state != 0
state != 0Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& (!state->machine()
!state->machine()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QStateMachine
|| ((
(state->machin... != machine())Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
state->machine() != machine())
(state->machin... != machine())Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& !qobject_cast<QStateMachine*>(this)
!qobject_cast<...achine*>(this)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QStateMachine
))) {
1-13
135 QMessageLogger(__FILE__, 304, __PRETTY_FUNCTION__).warning("QState::setErrorState: error state cannot belong "-
136 "to a different state machine");-
137 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_QStateMachine
2
138 }-
139-
140 if (d->errorState != state
d->errorState != stateDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-11
141 d->errorState = state;-
142 errorStateChanged(QState::QPrivateSignal());-
143 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
11
144}
executed 12 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
12
145-
146-
147-
148-
149-
150void QState::addTransition(QAbstractTransition *transition)-
151{-
152 QStatePrivate * const d = d_func();-
153 if (!transition
!transitionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 233 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-233
154 QMessageLogger(__FILE__, 323, __PRETTY_FUNCTION__).warning("QState::addTransition: cannot add null transition");-
155 return
executed 1 time by 1 test: return ;
Executed by:
  • tst_QStateMachine
;
executed 1 time by 1 test: return ;
Executed by:
  • tst_QStateMachine
1
156 }-
157-
158 transition->setParent(this);-
159 const QVector<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;-
160 for (int i = 0; i < targets.size()
i < targets.size()Description
TRUEevaluated 224 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 233 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
224-233
161 QAbstractState *t = targets.at(i).data();-
162 if (!t
!tDescription
TRUEnever evaluated
FALSEevaluated 224 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
0-224
163 QMessageLogger(__FILE__, 332, __PRETTY_FUNCTION__).warning("QState::addTransition: cannot add transition to null state");-
164 return
never executed: return ;
;
never executed: return ;
0
165 }-
166 if ((
(QAbstractStat... d->machine())Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 220 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
QAbstractStatePrivate::get(t)->machine() != d->machine())
(QAbstractStat... d->machine())Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 220 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
4-220
167 && QAbstractStatePrivate::get(t)->machine()
QAbstractState...(t)->machine()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QStateMachine
&& d->machine()
d->machine()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-3
168 QMessageLogger(__FILE__, 337, __PRETTY_FUNCTION__).warning("QState::addTransition: cannot add transition "-
169 "to a state in a different state machine");-
170 return
never executed: return ;
;
never executed: return ;
0
171 }-
172 }
executed 224 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
224
173 if (QStateMachine *mach = machine()
QStateMachine ...ch = machine()Description
TRUEevaluated 224 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
9-224
174 QStateMachinePrivate::get(mach)->maybeRegisterTransition(transition);
executed 224 times by 2 tests: QStateMachinePrivate::get(mach)->maybeRegisterTransition(transition);
Executed by:
  • tst_QState
  • tst_QStateMachine
224
175}
executed 233 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
233
176QSignalTransition *QState::addTransition(const QObject *sender, const char *signal,-
177 QAbstractState *target)-
178{-
179 if (!sender
!senderDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 64 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-64
180 QMessageLogger(__FILE__, 366, __PRETTY_FUNCTION__).warning("QState::addTransition: sender cannot be null");-
181 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
1
182 }-
183 if (!signal
!signalDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 63 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-63
184 QMessageLogger(__FILE__, 370, __PRETTY_FUNCTION__).warning("QState::addTransition: signal cannot be null");-
185 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
1
186 }-
187 if (!target
!targetDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-62
188 QMessageLogger(__FILE__, 374, __PRETTY_FUNCTION__).warning("QState::addTransition: cannot add transition to null state");-
189 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
1
190 }-
191 int offset = (*
(*signal == '0'+2)Description
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
signal == '0'+2)
(*signal == '0'+2)Description
TRUEevaluated 60 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
? 1 : 0;
2-60
192 const QMetaObject *meta = sender->metaObject();-
193 if (meta->indexOfSignal(signal+offset) == -1
meta->indexOfS...+offset) == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 61 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-61
194 if (meta->indexOfSignal(QMetaObject::normalizedSignature(signal+offset)) == -1
meta->indexOfS...offset)) == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEnever evaluated
) {
0-1
195 QMessageLogger(__FILE__, 381, __PRETTY_FUNCTION__).warning("QState::addTransition: no such signal %s::%s",-
196 meta->className(), signal+offset);-
197 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
1
198 }-
199 }
never executed: end of block
0
200 QSignalTransition *trans = new QSignalTransition(sender, signal);-
201 trans->setTargetState(target);-
202 addTransition(trans);-
203 return
executed 61 times by 2 tests: return trans;
Executed by:
  • tst_QState
  • tst_QStateMachine
trans;
executed 61 times by 2 tests: return trans;
Executed by:
  • tst_QState
  • tst_QStateMachine
61
204}-
205-
206namespace {-
207-
208-
209class UnconditionalTransition : public QAbstractTransition-
210{-
211public:-
212 UnconditionalTransition(QAbstractState *target)-
213 : QAbstractTransition()-
214 { setTargetState(target); }
executed 16 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
16
215protected:-
216 void onTransition(QEvent *) override {}-
217 bool eventTest(QEvent *) override { return
executed 19 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
true;
executed 19 times by 1 test: return true;
Executed by:
  • tst_QStateMachine
}
19
218};-
219-
220}-
221-
222-
223-
224-
225-
226QAbstractTransition *QState::addTransition(QAbstractState *target)-
227{-
228 if (!target
!targetDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-16
229 QMessageLogger(__FILE__, 415, __PRETTY_FUNCTION__).warning("QState::addTransition: cannot add transition to null state");-
230 return
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 1 time by 1 test: return 0;
Executed by:
  • tst_QStateMachine
1
231 }-
232 UnconditionalTransition *trans = new UnconditionalTransition(target);-
233 addTransition(trans);-
234 return
executed 16 times by 1 test: return trans;
Executed by:
  • tst_QStateMachine
trans;
executed 16 times by 1 test: return trans;
Executed by:
  • tst_QStateMachine
16
235}-
236-
237-
238-
239-
240-
241-
242-
243void QState::removeTransition(QAbstractTransition *transition)-
244{-
245 QStatePrivate * const d = d_func();-
246 if (!transition
!transitionDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-8
247 QMessageLogger(__FILE__, 433, __PRETTY_FUNCTION__).warning("QState::removeTransition: cannot remove null transition");-
248 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
249 }-
250 if (transition->sourceState() != this
transition->so...tate() != thisDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 7 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-7
251 QMessageLogger(__FILE__, 437, __PRETTY_FUNCTION__).warning("QState::removeTransition: transition %p's source state (%p)"-
252 " is different from this state (%p)",-
253 transition, transition->sourceState(), this);-
254 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
255 }-
256 QStateMachinePrivate *mach = QStateMachinePrivate::get(d->machine());-
257 if (mach
machDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QState
)
2-5
258 mach->unregisterTransition(transition);
executed 5 times by 1 test: mach->unregisterTransition(transition);
Executed by:
  • tst_QStateMachine
5
259 transition->setParent(0);-
260}
executed 7 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
7
261QList<QAbstractTransition*> QState::transitions() const-
262{-
263 const QStatePrivate * const d = d_func();-
264 return
executed 14 times by 1 test: return d->transitions();
Executed by:
  • tst_QState
d->transitions();
executed 14 times by 1 test: return d->transitions();
Executed by:
  • tst_QState
14
265}-
266-
267-
268-
269-
270void QState::onEntry(QEvent *event)-
271{-
272 (void)event;;-
273}
executed 412 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
412
274-
275-
276-
277-
278void QState::onExit(QEvent *event)-
279{-
280 (void)event;;-
281}
executed 277 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
277
282-
283-
284-
285-
286QAbstractState *QState::initialState() const-
287{-
288 const QStatePrivate * const d = d_func();-
289 return
executed 382 times by 2 tests: return d->initialState;
Executed by:
  • tst_QState
  • tst_QStateMachine
d->initialState;
executed 382 times by 2 tests: return d->initialState;
Executed by:
  • tst_QState
  • tst_QStateMachine
382
290}-
291-
292-
293-
294-
295-
296void QState::setInitialState(QAbstractState *state)-
297{-
298 QStatePrivate * const d = d_func();-
299 if (d->childMode == QState::ParallelStates
d->childMode =...ParallelStatesDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 181 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
2-181
300 QMessageLogger(__FILE__, 496, __PRETTY_FUNCTION__).warning("QState::setInitialState: ignoring attempt to set initial state "-
301 "of parallel state group %p", this);-
302 return;
executed 2 times by 2 tests: return;
Executed by:
  • tst_QState
  • tst_QStateMachine
2
303 }-
304 if (state
stateDescription
TRUEevaluated 181 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
&& (
(state->parentState() != this)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 180 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
state->parentState() != this)
(state->parentState() != this)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 180 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
0-181
305 QMessageLogger(__FILE__, 501, __PRETTY_FUNCTION__).warning("QState::setInitialState: state %p is not a child of this state (%p)",-
306 state, this);-
307 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
308 }-
309 if (d->initialState != state
d->initialState != stateDescription
TRUEevaluated 180 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
) {
0-180
310 d->initialState = state;-
311 initialStateChanged(QState::QPrivateSignal());-
312 }
executed 180 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
180
313}
executed 180 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
180
314-
315-
316-
317-
318QState::ChildMode QState::childMode() const-
319{-
320 const QStatePrivate * const d = d_func();-
321 return
executed 390 times by 2 tests: return d->childMode;
Executed by:
  • tst_QState
  • tst_QStateMachine
d->childMode;
executed 390 times by 2 tests: return d->childMode;
Executed by:
  • tst_QState
  • tst_QStateMachine
390
322}-
323-
324-
325-
326-
327void QState::setChildMode(ChildMode mode)-
328{-
329 QStatePrivate * const d = d_func();-
330-
331 if (mode == QState::ParallelStates
mode == QState::ParallelStatesDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& d->initialState
d->initialStateDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QState
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-5
332 QMessageLogger(__FILE__, 528, __PRETTY_FUNCTION__).warning("QState::setChildMode: setting the child-mode of state %p to "-
333 "parallel removes the initial state", this);-
334 d->initialState = nullptr;-
335 initialStateChanged(QState::QPrivateSignal());-
336 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QState
1
337-
338 if (d->childMode != mode
d->childMode != modeDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEnever evaluated
) {
0-6
339 d->childMode = mode;-
340 childModeChanged(QState::QPrivateSignal());-
341 }
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6
342}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
6
343-
344-
345-
346-
347bool QState::event(QEvent *e)-
348{-
349 QStatePrivate * const d = d_func();-
350 if ((
(e->type() == ...t::ChildAdded)Description
TRUEevaluated 787 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 369 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
e->type() == QEvent::ChildAdded)
(e->type() == ...t::ChildAdded)Description
TRUEevaluated 787 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 369 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
|| (
(e->type() == ...:ChildRemoved)Description
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
e->type() == QEvent::ChildRemoved)
(e->type() == ...:ChildRemoved)Description
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 294 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
75-787
351 d->childStatesListNeedsRefresh = true;-
352 d->transitionsListNeedsRefresh = true;-
353 if ((
(e->type() == ...:ChildRemoved)Description
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 787 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
e->type() == QEvent::ChildRemoved)
(e->type() == ...:ChildRemoved)Description
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 787 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& (static_cast<
(static_cast<Q...>initialState)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
QChildEvent *>(e)->child() == d->initialState)
(static_cast<Q...>initialState)Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
18-787
354 d->initialState = 0;
executed 18 times by 1 test: d->initialState = 0;
Executed by:
  • tst_QStateMachine
18
355 }
executed 862 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
862
356 return
executed 1156 times by 2 tests: return QAbstractState::event(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
QAbstractState::event(e);
executed 1156 times by 2 tests: return QAbstractState::event(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
1156
357}-
358-
Switch to Source codePreprocessed file

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