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