qabstracttransition.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qabstracttransition.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6QAbstractTransitionPrivate::QAbstractTransitionPrivate()-
7 : transitionType(QAbstractTransition::ExternalTransition)-
8{-
9}
executed 400 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
400
10-
11QStateMachine *QAbstractTransitionPrivate::machine() const-
12{-
13 if (QState *source = sourceState()
QState *source = sourceState()Description
TRUEevaluated 400175 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 90 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
90-400175
14 return
executed 400175 times by 2 tests: return source->machine();
Executed by:
  • tst_QState
  • tst_QStateMachine
source->machine();
executed 400175 times by 2 tests: return source->machine();
Executed by:
  • tst_QState
  • tst_QStateMachine
400175
15 const QAbstractTransition * const q = q_func();-
16 if (QHistoryState *parent = qobject_cast<QHistoryState *>(q->parent())
QHistoryState ...>(q->parent())Description
TRUEnever evaluated
FALSEevaluated 90 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
0-90
17 return
never executed: return parent->machine();
parent->machine();
never executed: return parent->machine();
0
18 return
executed 90 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
0;
executed 90 times by 2 tests: return 0;
Executed by:
  • tst_QState
  • tst_QStateMachine
90
19}-
20-
21bool QAbstractTransitionPrivate::callEventTest(QEvent *e)-
22{-
23 QAbstractTransition * const q = q_func();-
24 return
executed 5952 times by 2 tests: return q->eventTest(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
q->eventTest(e);
executed 5952 times by 2 tests: return q->eventTest(e);
Executed by:
  • tst_QState
  • tst_QStateMachine
5952
25}-
26-
27void QAbstractTransitionPrivate::callOnTransition(QEvent *e)-
28{-
29 QAbstractTransition * const q = q_func();-
30 q->onTransition(e);-
31}
executed 1320 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1320
32-
33QState *QAbstractTransitionPrivate::sourceState() const-
34{-
35 return
executed 603140 times by 2 tests: return qobject_cast<QState*>(parent);
Executed by:
  • tst_QState
  • tst_QStateMachine
qobject_cast<QState*>(parent);
executed 603140 times by 2 tests: return qobject_cast<QState*>(parent);
Executed by:
  • tst_QState
  • tst_QStateMachine
603140
36}-
37-
38void QAbstractTransitionPrivate::emitTriggered()-
39{-
40 QAbstractTransition * const q = q_func();-
41 q->triggered(QAbstractTransition::QPrivateSignal());-
42}
executed 1391 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
1391
43-
44-
45-
46-
47QAbstractTransition::QAbstractTransition(QState *sourceState)-
48 : QObject(*new QAbstractTransitionPrivate, sourceState)-
49{-
50}
executed 304 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
304
51-
52-
53-
54-
55QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd,-
56 QState *parent)-
57 : QObject(dd, parent)-
58{-
59}
executed 96 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
96
60-
61-
62-
63-
64QAbstractTransition::~QAbstractTransition()-
65{-
66}-
67-
68-
69-
70-
71-
72QState *QAbstractTransition::sourceState() const-
73{-
74 const QAbstractTransitionPrivate * const d = d_func();-
75 return
executed 202875 times by 2 tests: return d->sourceState();
Executed by:
  • tst_QState
  • tst_QStateMachine
d->sourceState();
executed 202875 times by 2 tests: return d->sourceState();
Executed by:
  • tst_QState
  • tst_QStateMachine
202875
76}-
77-
78-
79-
80-
81-
82QAbstractState *QAbstractTransition::targetState() const-
83{-
84 const QAbstractTransitionPrivate * const d = d_func();-
85 if (d->targetStates.isEmpty()
d->targetStates.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QStateMachine
)
2-17
86 return
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
0;
executed 2 times by 1 test: return 0;
Executed by:
  • tst_QStateMachine
2
87 return
executed 17 times by 1 test: return d->targetStates.first().data();
Executed by:
  • tst_QStateMachine
d->targetStates.first().data();
executed 17 times by 1 test: return d->targetStates.first().data();
Executed by:
  • tst_QStateMachine
17
88}-
89-
90-
91-
92-
93void QAbstractTransition::setTargetState(QAbstractState* target)-
94{-
95 QAbstractTransitionPrivate * const d = d_func();-
96 if ((d->targetStates.size() == 1
d->targetStates.size() == 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 236 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& target == d->targetStates.at(0).data()
target == d->t...s.at(0).data()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) ||
1-236
97 (d->targetStates.isEmpty()
d->targetStates.isEmpty()Description
TRUEevaluated 236 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
&& target == 0
target == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 234 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)) {
1-236
98 return;
executed 3 times by 1 test: return;
Executed by:
  • tst_QStateMachine
3
99 }-
100 if (!target
!targetDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 234 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1-234
101 d->targetStates.clear();
executed 1 time by 1 test: d->targetStates.clear();
Executed by:
  • tst_QStateMachine
1
102 else-
103 setTargetStates(QList<QAbstractState*>() << target);
executed 234 times by 2 tests: setTargetStates(QList<QAbstractState*>() << target);
Executed by:
  • tst_QState
  • tst_QStateMachine
234
104 targetStateChanged(QPrivateSignal());-
105}
executed 235 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
235
106-
107-
108-
109-
110-
111QList<QAbstractState*> QAbstractTransition::targetStates() const-
112{-
113 const QAbstractTransitionPrivate * const d = d_func();-
114 QList<QAbstractState*> result;-
115 for (int i = 0; i < d->targetStates.size()
i < d->targetStates.size()Description
TRUEevaluated 4184 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 4201 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
4184-4201
116 QAbstractState *target = d->targetStates.at(i).data();-
117 if (target
targetDescription
TRUEevaluated 4183 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
1-4183
118 result.append(target);
executed 4183 times by 2 tests: result.append(target);
Executed by:
  • tst_QState
  • tst_QStateMachine
4183
119 }
executed 4184 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
4184
120 return
executed 4201 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
result;
executed 4201 times by 2 tests: return result;
Executed by:
  • tst_QState
  • tst_QStateMachine
4201
121}-
122-
123-
124-
125-
126void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)-
127{-
128 QAbstractTransitionPrivate * const d = d_func();-
129-
130-
131 for (int i = 0; i < targets.size()
i < targets.size()Description
TRUEevaluated 392 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 389 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
389-392
132 if (targets.at(i) == nullptr
targets.at(i) == nullptrDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 391 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
) {
1-391
133 QMessageLogger(__FILE__, 265, __PRETTY_FUNCTION__).warning("QAbstractTransition::setTargetStates: target state(s) cannot be null");-
134 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
135 }-
136 }
executed 391 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
391
137-
138-
139-
140 for (int i = 0; i < d->targetStates.size()
i < d->targetStates.size()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 389 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ) {
1-389
141 if (d->targetStates.at(i).isNull()
d->targetStates.at(i).isNull()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
0-1
142 d->targetStates.remove(i);-
143 }
never executed: end of block
else {
0
144 ++i;-
145 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
146 }-
147-
148-
149 if (targets.isEmpty()
targets.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 389 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
&& d->targetStates.isEmpty()
d->targetStates.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0-389
150 return;
never executed: return;
0
151-
152 bool sameList = true;-
153-
154 if (targets.size() != d->targetStates.size()
targets.size()...tStates.size()Description
TRUEevaluated 388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-388
155-
156-
157 sameList = false;-
158 }
executed 388 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
else {
388
159 QVector<QPointer<QAbstractState> > copy(d->targetStates);-
160 for (int i = 0; i < targets.size()
i < targets.size()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
; ++i) {
1
161 sameList &= copy.removeOne(targets.at(i));-
162 if (!sameList
!sameListDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
)
0-1
163 break;
never executed: break;
0
164 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
165-
166 sameList &= copy.isEmpty();-
167 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
168-
169 if (sameList
sameListDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
)
1-388
170 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
171-
172 d->targetStates.resize(targets.size());-
173 for (int i = 0; i < targets.size()
i < targets.size()Description
TRUEevaluated 390 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
FALSEevaluated 388 times by 2 tests
Evaluated by:
  • tst_QState
  • tst_QStateMachine
; ++i) {
388-390
174 d->targetStates[i] = targets.at(i);-
175 }
executed 390 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
390
176-
177 targetStatesChanged(QPrivateSignal());-
178}
executed 388 times by 2 tests: end of block
Executed by:
  • tst_QState
  • tst_QStateMachine
388
179-
180-
181-
182-
183QAbstractTransition::TransitionType QAbstractTransition::transitionType() const-
184{-
185 const QAbstractTransitionPrivate * const d = d_func();-
186 return
executed 1389 times by 2 tests: return d->transitionType;
Executed by:
  • tst_QState
  • tst_QStateMachine
d->transitionType;
executed 1389 times by 2 tests: return d->transitionType;
Executed by:
  • tst_QState
  • tst_QStateMachine
1389
187}-
188-
189-
190-
191-
192void QAbstractTransition::setTransitionType(TransitionType type)-
193{-
194 QAbstractTransitionPrivate * const d = d_func();-
195 d->transitionType = type;-
196}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
197-
198-
199-
200-
201-
202QStateMachine *QAbstractTransition::machine() const-
203{-
204 const QAbstractTransitionPrivate * const d = d_func();-
205 return
executed 147 times by 2 tests: return d->machine();
Executed by:
  • tst_QState
  • tst_QStateMachine
d->machine();
executed 147 times by 2 tests: return d->machine();
Executed by:
  • tst_QState
  • tst_QStateMachine
147
206}-
207void QAbstractTransition::addAnimation(QAbstractAnimation *animation)-
208{-
209 QAbstractTransitionPrivate * const d = d_func();-
210 if (!animation
!animationDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1-26
211 QMessageLogger(__FILE__, 352, __PRETTY_FUNCTION__).warning("QAbstractTransition::addAnimation: cannot add null animation");-
212 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
213 }-
214 d->animations.append(animation);-
215}
executed 26 times by 1 test: end of block
Executed by:
  • tst_QStateMachine
26
216-
217-
218-
219-
220-
221-
222void QAbstractTransition::removeAnimation(QAbstractAnimation *animation)-
223{-
224 QAbstractTransitionPrivate * const d = d_func();-
225 if (!animation
!animationDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStateMachine
) {
1
226 QMessageLogger(__FILE__, 367, __PRETTY_FUNCTION__).warning("QAbstractTransition::removeAnimation: cannot remove null animation");-
227 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QStateMachine
1
228 }-
229 d->animations.removeOne(animation);-
230}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QStateMachine
1
231-
232-
233-
234-
235-
236-
237-
238QList<QAbstractAnimation*> QAbstractTransition::animations() const-
239{-
240 const QAbstractTransitionPrivate * const d = d_func();-
241 return
executed 1397 times by 2 tests: return d->animations;
Executed by:
  • tst_QState
  • tst_QStateMachine
d->animations;
executed 1397 times by 2 tests: return d->animations;
Executed by:
  • tst_QState
  • tst_QStateMachine
1397
242}-
243bool QAbstractTransition::event(QEvent *e)-
244{-
245 return
executed 4 times by 1 test: return QObject::event(e);
Executed by:
  • tst_QStateMachine
QObject::event(e);
executed 4 times by 1 test: return QObject::event(e);
Executed by:
  • tst_QStateMachine
4
246}-
247-
248-
Switch to Source codePreprocessed file

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