author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 19 | fcece45ef507 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include <QtTest/QtTest> |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
43 |
#include "../../shared/util.h" |
0 | 44 |
|
45 |
#include <QtCore/qpropertyanimation.h> |
|
46 |
#include <QtCore/qvariantanimation.h> |
|
47 |
#include <QtGui/qwidget.h> |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
48 |
#include "../../shared/util.h" |
0 | 49 |
|
50 |
//TESTED_CLASS=QPropertyAnimation |
|
51 |
//TESTED_FILES= |
|
52 |
||
53 |
class UncontrolledAnimation : public QPropertyAnimation |
|
54 |
{ |
|
55 |
Q_OBJECT |
|
56 |
public: |
|
57 |
int duration() const { return -1; /* not time driven */ } |
|
58 |
||
59 |
protected: |
|
60 |
void updateCurrentTime(int currentTime) |
|
61 |
{ |
|
62 |
QPropertyAnimation::updateCurrentTime(currentTime); |
|
63 |
if (currentTime >= QPropertyAnimation::duration() || currentLoop() >= 1) |
|
64 |
stop(); |
|
65 |
} |
|
66 |
}; |
|
67 |
||
68 |
class MyObject : public QObject |
|
69 |
{ |
|
70 |
Q_OBJECT |
|
71 |
Q_PROPERTY(qreal x READ x WRITE setX) |
|
72 |
public: |
|
73 |
MyObject() : m_x(0) { } |
|
74 |
qreal x() const { return m_x; } |
|
75 |
void setX(qreal x) { m_x = x; } |
|
76 |
private: |
|
77 |
qreal m_x; |
|
78 |
}; |
|
79 |
||
80 |
class DummyPropertyAnimation : public QPropertyAnimation |
|
81 |
{ |
|
82 |
public: |
|
83 |
DummyPropertyAnimation(QObject *parent = 0) : QPropertyAnimation(parent) |
|
84 |
{ |
|
85 |
setTargetObject(&o); |
|
86 |
this->setPropertyName("x"); |
|
87 |
setEndValue(100); |
|
88 |
} |
|
89 |
||
90 |
MyObject o; |
|
91 |
}; |
|
92 |
||
93 |
||
94 |
class tst_QPropertyAnimation : public QObject |
|
95 |
{ |
|
96 |
Q_OBJECT |
|
97 |
public: |
|
98 |
tst_QPropertyAnimation(); |
|
99 |
virtual ~tst_QPropertyAnimation(); |
|
100 |
||
101 |
public Q_SLOTS: |
|
102 |
void init(); |
|
103 |
void cleanup(); |
|
104 |
||
105 |
private slots: |
|
106 |
void construction(); |
|
107 |
void setCurrentTime_data(); |
|
108 |
void setCurrentTime(); |
|
109 |
void statesAndSignals_data(); |
|
110 |
void statesAndSignals(); |
|
111 |
void deletion1(); |
|
112 |
void deletion2(); |
|
113 |
void deletion3(); |
|
114 |
void duration0(); |
|
115 |
void noStartValue(); |
|
116 |
void noStartValueWithLoop(); |
|
117 |
void startWhenAnotherIsRunning(); |
|
118 |
void easingcurve_data(); |
|
119 |
void easingcurve(); |
|
120 |
void startWithoutStartValue(); |
|
121 |
void startBackwardWithoutEndValue(); |
|
122 |
void playForwardBackward(); |
|
123 |
void interpolated(); |
|
124 |
void setStartEndValues_data(); |
|
125 |
void setStartEndValues(); |
|
126 |
void zeroDurationStart(); |
|
127 |
void operationsInStates_data(); |
|
128 |
void operationsInStates(); |
|
129 |
void oneKeyValue(); |
|
130 |
void updateOnSetKeyValues(); |
|
131 |
void restart(); |
|
132 |
void valueChanged(); |
|
133 |
void twoAnimations(); |
|
134 |
void deletedInUpdateCurrentTime(); |
|
135 |
void totalDuration(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
136 |
void zeroLoopCount(); |
0 | 137 |
}; |
138 |
||
139 |
tst_QPropertyAnimation::tst_QPropertyAnimation() |
|
140 |
{ |
|
141 |
} |
|
142 |
||
143 |
tst_QPropertyAnimation::~tst_QPropertyAnimation() |
|
144 |
{ |
|
145 |
} |
|
146 |
||
147 |
void tst_QPropertyAnimation::init() |
|
148 |
{ |
|
149 |
qRegisterMetaType<QAbstractAnimation::State>("QAbstractAnimation::State"); |
|
150 |
qRegisterMetaType<QAbstractAnimation::DeletionPolicy>("QAbstractAnimation::DeletionPolicy"); |
|
151 |
} |
|
152 |
||
153 |
void tst_QPropertyAnimation::cleanup() |
|
154 |
{ |
|
155 |
} |
|
156 |
||
157 |
class AnimationObject : public QObject |
|
158 |
{ |
|
159 |
Q_OBJECT |
|
160 |
Q_PROPERTY(int value READ value WRITE setValue) |
|
161 |
Q_PROPERTY(qreal realValue READ realValue WRITE setRealValue) |
|
162 |
public: |
|
163 |
AnimationObject(int startValue = 0) |
|
164 |
: v(startValue), rv(startValue) |
|
165 |
{ } |
|
166 |
||
167 |
int value() const { return v; } |
|
168 |
void setValue(int value) { v = value; } |
|
169 |
||
170 |
qreal realValue() const { return rv; } |
|
171 |
void setRealValue(qreal value) { rv = value; } |
|
172 |
||
173 |
int v; |
|
174 |
qreal rv; |
|
175 |
}; |
|
176 |
||
177 |
||
178 |
void tst_QPropertyAnimation::construction() |
|
179 |
{ |
|
180 |
QPropertyAnimation panimation; |
|
181 |
} |
|
182 |
||
183 |
void tst_QPropertyAnimation::setCurrentTime_data() |
|
184 |
{ |
|
185 |
QTest::addColumn<int>("duration"); |
|
186 |
QTest::addColumn<int>("loopCount"); |
|
187 |
QTest::addColumn<int>("currentTime"); |
|
188 |
QTest::addColumn<int>("testCurrentTime"); |
|
189 |
QTest::addColumn<int>("testCurrentLoop"); |
|
190 |
||
191 |
QTest::newRow("-1") << -1 << 1 << 0 << 0 << 0; |
|
192 |
QTest::newRow("0") << 0 << 1 << 0 << 0 << 0; |
|
193 |
QTest::newRow("1") << 0 << 1 << 1 << 0 << 0; |
|
194 |
QTest::newRow("2") << 0 << 2 << 1 << 0 << 0; |
|
195 |
QTest::newRow("3") << 1 << 1 << 0 << 0 << 0; |
|
196 |
QTest::newRow("4") << 1 << 1 << 1 << 1 << 0; |
|
197 |
QTest::newRow("5") << 1 << 2 << 1 << 0 << 1; |
|
198 |
QTest::newRow("6") << 1 << 2 << 2 << 1 << 1; |
|
199 |
QTest::newRow("7") << 1 << 2 << 3 << 1 << 1; |
|
200 |
QTest::newRow("8") << 1 << 3 << 2 << 0 << 2; |
|
201 |
QTest::newRow("9") << 1 << 3 << 3 << 1 << 2; |
|
202 |
QTest::newRow("a") << 10 << 1 << 0 << 0 << 0; |
|
203 |
QTest::newRow("b") << 10 << 1 << 1 << 1 << 0; |
|
204 |
QTest::newRow("c") << 10 << 1 << 10 << 10 << 0; |
|
205 |
QTest::newRow("d") << 10 << 2 << 10 << 0 << 1; |
|
206 |
QTest::newRow("e") << 10 << 2 << 11 << 1 << 1; |
|
207 |
QTest::newRow("f") << 10 << 2 << 20 << 10 << 1; |
|
208 |
QTest::newRow("g") << 10 << 2 << 21 << 10 << 1; |
|
209 |
QTest::newRow("negloop 0") << 10 << -1 << 0 << 0 << 0; |
|
210 |
QTest::newRow("negloop 1") << 10 << -1 << 10 << 0 << 1; |
|
211 |
QTest::newRow("negloop 2") << 10 << -1 << 15 << 5 << 1; |
|
212 |
QTest::newRow("negloop 3") << 10 << -1 << 20 << 0 << 2; |
|
213 |
QTest::newRow("negloop 4") << 10 << -1 << 30 << 0 << 3; |
|
214 |
} |
|
215 |
||
216 |
void tst_QPropertyAnimation::setCurrentTime() |
|
217 |
{ |
|
218 |
QFETCH(int, duration); |
|
219 |
QFETCH(int, loopCount); |
|
220 |
QFETCH(int, currentTime); |
|
221 |
QFETCH(int, testCurrentTime); |
|
222 |
QFETCH(int, testCurrentLoop); |
|
223 |
||
224 |
QPropertyAnimation animation; |
|
225 |
if (duration < 0) |
|
226 |
QTest::ignoreMessage(QtWarningMsg, "QVariantAnimation::setDuration: cannot set a negative duration"); |
|
227 |
animation.setDuration(duration); |
|
228 |
animation.setLoopCount(loopCount); |
|
229 |
animation.setCurrentTime(currentTime); |
|
230 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
QCOMPARE(animation.currentLoopTime(), testCurrentTime); |
0 | 232 |
QCOMPARE(animation.currentLoop(), testCurrentLoop); |
233 |
} |
|
234 |
||
235 |
void tst_QPropertyAnimation::statesAndSignals_data() |
|
236 |
{ |
|
237 |
QTest::addColumn<bool>("uncontrolled"); |
|
238 |
QTest::newRow("normal animation") << false; |
|
239 |
QTest::newRow("animation with undefined duration") << true; |
|
240 |
} |
|
241 |
||
242 |
void tst_QPropertyAnimation::statesAndSignals() |
|
243 |
{ |
|
244 |
QFETCH(bool, uncontrolled); |
|
245 |
QPropertyAnimation *anim; |
|
246 |
if (uncontrolled) |
|
247 |
anim = new UncontrolledAnimation; |
|
248 |
else |
|
249 |
anim = new DummyPropertyAnimation; |
|
250 |
anim->setDuration(100); |
|
251 |
||
252 |
QSignalSpy finishedSpy(anim, SIGNAL(finished())); |
|
253 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
254 |
QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int))); |
|
255 |
||
256 |
anim->setCurrentTime(1); |
|
257 |
anim->setCurrentTime(100); |
|
258 |
QCOMPARE(finishedSpy.count(), 0); |
|
259 |
QCOMPARE(runningSpy.count(), 0); |
|
260 |
QCOMPARE(currentLoopSpy.count(), 0); |
|
261 |
QCOMPARE(anim->state(), QAnimationGroup::Stopped); |
|
262 |
||
263 |
anim->setLoopCount(3); |
|
264 |
anim->setCurrentTime(101); |
|
265 |
||
266 |
if (uncontrolled) |
|
267 |
QSKIP("Uncontrolled animations don't handle looping", SkipSingle); |
|
268 |
||
269 |
QCOMPARE(currentLoopSpy.count(), 1); |
|
270 |
QCOMPARE(anim->currentLoop(), 1); |
|
271 |
||
272 |
anim->setCurrentTime(0); |
|
273 |
QCOMPARE(currentLoopSpy.count(), 2); |
|
274 |
QCOMPARE(anim->currentLoop(), 0); |
|
275 |
||
276 |
anim->start(); |
|
277 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
278 |
QCOMPARE(runningSpy.count(), 1); //anim must have started |
|
279 |
QCOMPARE(anim->currentLoop(), 0); |
|
280 |
runningSpy.clear(); |
|
281 |
||
282 |
anim->stop(); |
|
283 |
QCOMPARE(anim->state(), QAnimationGroup::Stopped); |
|
284 |
QCOMPARE(runningSpy.count(), 1); //anim must have stopped |
|
285 |
QCOMPARE(finishedSpy.count(), 0); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
286 |
QCOMPARE(anim->currentLoopTime(), 0); |
0 | 287 |
QCOMPARE(anim->currentLoop(), 0); |
288 |
QCOMPARE(currentLoopSpy.count(), 2); |
|
289 |
runningSpy.clear(); |
|
290 |
||
291 |
anim->start(); |
|
292 |
QTest::qWait(1000); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
293 |
QTRY_COMPARE(anim->state(), QAnimationGroup::Stopped); |
0 | 294 |
QCOMPARE(runningSpy.count(), 2); //started and stopped again |
295 |
runningSpy.clear(); |
|
296 |
QCOMPARE(finishedSpy.count(), 1); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
QCOMPARE(anim->currentLoopTime(), 100); |
0 | 298 |
QCOMPARE(anim->currentLoop(), 2); |
299 |
QCOMPARE(currentLoopSpy.count(), 4); |
|
300 |
||
301 |
anim->start(); // auto-rewinds |
|
302 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
303 |
QCOMPARE(anim->currentTime(), 0); |
|
304 |
QCOMPARE(anim->currentLoop(), 0); |
|
305 |
QCOMPARE(currentLoopSpy.count(), 5); |
|
306 |
QCOMPARE(runningSpy.count(), 1); // anim has started |
|
307 |
QCOMPARE(finishedSpy.count(), 1); |
|
308 |
QCOMPARE(anim->currentLoop(), 0); |
|
309 |
runningSpy.clear(); |
|
310 |
||
311 |
QTest::qWait(1000); |
|
312 |
||
313 |
QCOMPARE(currentLoopSpy.count(), 7); |
|
314 |
QCOMPARE(anim->state(), QAnimationGroup::Stopped); |
|
315 |
QCOMPARE(anim->currentLoop(), 2); |
|
316 |
QCOMPARE(runningSpy.count(), 1); // anim has stopped |
|
317 |
QCOMPARE(finishedSpy.count(), 2); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
318 |
QCOMPARE(anim->currentLoopTime(), 100); |
0 | 319 |
|
320 |
delete anim; |
|
321 |
} |
|
322 |
||
323 |
void tst_QPropertyAnimation::deletion1() |
|
324 |
{ |
|
325 |
QObject *object = new QWidget; |
|
326 |
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth"); |
|
327 |
||
328 |
//test that the animation is deleted correctly depending of the deletion flag passed in start() |
|
329 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
330 |
QSignalSpy finishedSpy(anim, SIGNAL(finished())); |
|
331 |
anim->setStartValue(10); |
|
332 |
anim->setEndValue(20); |
|
333 |
anim->setDuration(200); |
|
334 |
anim->start(); |
|
335 |
QCOMPARE(runningSpy.count(), 1); |
|
336 |
QCOMPARE(finishedSpy.count(), 0); |
|
337 |
||
338 |
QVERIFY(anim); |
|
339 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
340 |
QTest::qWait(100); |
|
341 |
QVERIFY(anim); |
|
342 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
343 |
QTest::qWait(150); |
|
344 |
QVERIFY(anim); //The animation should not have been deleted |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
345 |
QTRY_COMPARE(anim->state(), QAnimationGroup::Stopped); |
0 | 346 |
QCOMPARE(runningSpy.count(), 2); |
347 |
QCOMPARE(finishedSpy.count(), 1); |
|
348 |
||
349 |
anim->start(QVariantAnimation::DeleteWhenStopped); |
|
350 |
QVERIFY(anim); |
|
351 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
352 |
QTest::qWait(100); |
|
353 |
QVERIFY(anim); |
|
354 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
355 |
QTest::qWait(150); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
356 |
QTRY_COMPARE(runningSpy.count(), 4); |
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
357 |
QCOMPARE(finishedSpy.count(), 2); |
0 | 358 |
QVERIFY(!anim); //The animation must have been deleted |
359 |
delete object; |
|
360 |
} |
|
361 |
||
362 |
void tst_QPropertyAnimation::deletion2() |
|
363 |
{ |
|
364 |
//test that the animation get deleted if the object is deleted |
|
365 |
QObject *object = new QWidget; |
|
366 |
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object,"minimumWidth"); |
|
367 |
anim->setStartValue(10); |
|
368 |
anim->setEndValue(20); |
|
369 |
anim->setDuration(200); |
|
370 |
||
371 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
372 |
QSignalSpy finishedSpy(anim, SIGNAL(finished())); |
|
373 |
||
374 |
anim->setStartValue(10); |
|
375 |
anim->setEndValue(20); |
|
376 |
anim->setDuration(200); |
|
377 |
anim->start(); |
|
378 |
||
379 |
QTest::qWait(50); |
|
380 |
QVERIFY(anim); |
|
381 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
382 |
||
383 |
QCOMPARE(runningSpy.count(), 1); |
|
384 |
QCOMPARE(finishedSpy.count(), 0); |
|
385 |
||
386 |
//we can't call deletaLater directly because the delete would only happen in the next loop of _this_ event loop |
|
387 |
QTimer::singleShot(0, object, SLOT(deleteLater())); |
|
388 |
QTest::qWait(50); |
|
389 |
||
390 |
QVERIFY(anim->targetObject() == 0); |
|
391 |
} |
|
392 |
||
393 |
void tst_QPropertyAnimation::deletion3() |
|
394 |
{ |
|
395 |
//test that the stopped signal is emit when the animation is destroyed |
|
396 |
QObject *object = new QWidget; |
|
397 |
QPropertyAnimation *anim = new QPropertyAnimation(object,"minimumWidth"); |
|
398 |
anim->setStartValue(10); |
|
399 |
anim->setEndValue(20); |
|
400 |
anim->setDuration(200); |
|
401 |
||
402 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
403 |
QSignalSpy finishedSpy(anim, SIGNAL(finished())); |
|
404 |
anim->start(); |
|
405 |
||
406 |
QTest::qWait(50); |
|
407 |
QCOMPARE(anim->state(), QAnimationGroup::Running); |
|
408 |
QCOMPARE(runningSpy.count(), 1); |
|
409 |
QCOMPARE(finishedSpy.count(), 0); |
|
410 |
delete anim; |
|
411 |
QCOMPARE(runningSpy.count(), 2); |
|
412 |
QCOMPARE(finishedSpy.count(), 0); |
|
413 |
} |
|
414 |
||
415 |
void tst_QPropertyAnimation::duration0() |
|
416 |
{ |
|
417 |
QObject o; |
|
418 |
o.setProperty("ole", 42); |
|
419 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
420 |
||
421 |
QPropertyAnimation animation(&o, "ole"); |
|
422 |
animation.setEndValue(43); |
|
423 |
QVERIFY(!animation.currentValue().isValid()); |
|
424 |
QCOMPARE(animation.currentValue().toInt(), 0); |
|
425 |
animation.setStartValue(42); |
|
426 |
QVERIFY(animation.currentValue().isValid()); |
|
427 |
QCOMPARE(animation.currentValue().toInt(), 42); |
|
428 |
||
429 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
430 |
animation.setDuration(0); |
|
431 |
QCOMPARE(animation.currentValue().toInt(), 43); //it is at the end |
|
432 |
animation.start(); |
|
433 |
QCOMPARE(animation.state(), QAnimationGroup::Stopped); |
|
434 |
QCOMPARE(animation.currentTime(), 0); |
|
435 |
QCOMPARE(o.property("ole").toInt(), 43); |
|
436 |
} |
|
437 |
||
438 |
class StartValueTester : public QObject |
|
439 |
{ |
|
440 |
Q_OBJECT |
|
441 |
Q_PROPERTY(int ole READ ole WRITE setOle) |
|
442 |
public: |
|
443 |
StartValueTester() : o(0) { } |
|
444 |
int ole() const { return o; } |
|
445 |
void setOle(int v) { o = v; values << v; } |
|
446 |
||
447 |
int o; |
|
448 |
QList<int> values; |
|
449 |
}; |
|
450 |
||
451 |
void tst_QPropertyAnimation::noStartValue() |
|
452 |
{ |
|
453 |
StartValueTester o; |
|
454 |
o.setProperty("ole", 42); |
|
455 |
o.values.clear(); |
|
456 |
||
457 |
QPropertyAnimation a(&o, "ole"); |
|
458 |
a.setEndValue(420); |
|
459 |
a.setDuration(250); |
|
460 |
a.start(); |
|
461 |
||
462 |
QTest::qWait(300); |
|
463 |
||
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
464 |
QTRY_COMPARE(o.values.first(), 42); |
0 | 465 |
QCOMPARE(o.values.last(), 420); |
466 |
} |
|
467 |
||
468 |
void tst_QPropertyAnimation::noStartValueWithLoop() |
|
469 |
{ |
|
470 |
StartValueTester o; |
|
471 |
o.setProperty("ole", 42); |
|
472 |
o.values.clear(); |
|
473 |
||
474 |
QPropertyAnimation a(&o, "ole"); |
|
475 |
a.setEndValue(420); |
|
476 |
a.setDuration(250); |
|
477 |
a.setLoopCount(2); |
|
478 |
a.start(); |
|
479 |
||
480 |
a.setCurrentTime(250); |
|
481 |
QCOMPARE(o.values.first(), 42); |
|
482 |
QCOMPARE(a.currentValue().toInt(), 42); |
|
483 |
QCOMPARE(o.values.last(), 42); |
|
484 |
||
485 |
a.setCurrentTime(500); |
|
486 |
QCOMPARE(a.currentValue().toInt(), 420); |
|
487 |
} |
|
488 |
||
489 |
void tst_QPropertyAnimation::startWhenAnotherIsRunning() |
|
490 |
{ |
|
491 |
StartValueTester o; |
|
492 |
o.setProperty("ole", 42); |
|
493 |
o.values.clear(); |
|
494 |
||
495 |
{ |
|
496 |
//normal case: the animation finishes and is deleted |
|
497 |
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole"); |
|
498 |
anim->setEndValue(100); |
|
499 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
500 |
anim->start(QVariantAnimation::DeleteWhenStopped); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
QTest::qWait(anim->duration() + 100); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
502 |
QTRY_COMPARE(runningSpy.count(), 2); //started and then stopped |
0 | 503 |
QVERIFY(!anim); |
504 |
} |
|
505 |
||
506 |
{ |
|
507 |
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole"); |
|
508 |
anim->setEndValue(100); |
|
509 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
510 |
anim->start(QVariantAnimation::DeleteWhenStopped); |
|
511 |
QTest::qWait(anim->duration()/2); |
|
512 |
QPointer<QVariantAnimation> anim2 = new QPropertyAnimation(&o, "ole"); |
|
513 |
anim2->setEndValue(100); |
|
514 |
QCOMPARE(runningSpy.count(), 1); |
|
515 |
QCOMPARE(anim->state(), QVariantAnimation::Running); |
|
516 |
||
517 |
//anim2 will interrupt anim1 |
|
518 |
QMetaObject::invokeMethod(anim2, "start", Qt::QueuedConnection, Q_ARG(QAbstractAnimation::DeletionPolicy, QVariantAnimation::DeleteWhenStopped)); |
|
519 |
QTest::qWait(50); |
|
520 |
QVERIFY(!anim); //anim should have been deleted |
|
521 |
QVERIFY(anim2); |
|
522 |
QTest::qWait(anim2->duration()); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
523 |
QTRY_VERIFY(!anim2); //anim2 is finished: it should have been deleted by now |
0 | 524 |
QVERIFY(!anim); |
525 |
} |
|
526 |
||
527 |
} |
|
528 |
||
529 |
// copy from easing.cpp in case that function changes definition |
|
530 |
static qreal easeInOutBack(qreal t) |
|
531 |
{ |
|
532 |
qreal s = 1.70158; |
|
533 |
qreal t_adj = 2.0f * (qreal)t; |
|
534 |
if (t_adj < 1) { |
|
535 |
s *= 1.525f; |
|
536 |
return 1.0/2*(t_adj*t_adj*((s+1)*t_adj - s)); |
|
537 |
} else { |
|
538 |
t_adj -= 2; |
|
539 |
s *= 1.525f; |
|
540 |
return 1.0/2*(t_adj*t_adj*((s+1)*t_adj + s) + 2); |
|
541 |
} |
|
542 |
} |
|
543 |
||
544 |
void tst_QPropertyAnimation::easingcurve_data() |
|
545 |
{ |
|
546 |
QTest::addColumn<int>("currentTime"); |
|
547 |
QTest::addColumn<int>("expectedvalue"); |
|
548 |
||
549 |
QTest::newRow("interpolation1") << 0 << 0; |
|
550 |
QTest::newRow("interpolation2") << 1000 << 1000; |
|
551 |
QTest::newRow("extrapolationbelow") << 250 << -99; |
|
552 |
QTest::newRow("extrapolationabove") << 750 << 1099; |
|
553 |
} |
|
554 |
||
555 |
void tst_QPropertyAnimation::easingcurve() |
|
556 |
{ |
|
557 |
QFETCH(int, currentTime); |
|
558 |
QFETCH(int, expectedvalue); |
|
559 |
QObject o; |
|
560 |
o.setProperty("ole", 42); |
|
561 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
562 |
||
563 |
QPropertyAnimation pAnimation(&o, "ole"); |
|
564 |
pAnimation.setStartValue(0); |
|
565 |
pAnimation.setEndValue(1000); |
|
566 |
pAnimation.setDuration(1000); |
|
567 |
||
568 |
// this easingcurve assumes that we extrapolate before startValue and after endValue |
|
569 |
QEasingCurve easingCurve; |
|
570 |
easingCurve.setCustomType(easeInOutBack); |
|
571 |
pAnimation.setEasingCurve(easingCurve); |
|
572 |
pAnimation.start(); |
|
573 |
pAnimation.pause(); |
|
574 |
pAnimation.setCurrentTime(currentTime); |
|
575 |
QCOMPARE(o.property("ole").toInt(), expectedvalue); |
|
576 |
} |
|
577 |
||
578 |
void tst_QPropertyAnimation::startWithoutStartValue() |
|
579 |
{ |
|
580 |
QObject o; |
|
581 |
o.setProperty("ole", 42); |
|
582 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
583 |
||
584 |
QPropertyAnimation anim(&o, "ole"); |
|
585 |
anim.setEndValue(100); |
|
586 |
||
587 |
anim.start(); |
|
588 |
||
589 |
QTest::qWait(100); |
|
590 |
int current = anim.currentValue().toInt(); |
|
591 |
//it is somewhere in the animation |
|
592 |
QVERIFY(current > 42); |
|
593 |
QVERIFY(current < 100); |
|
594 |
||
595 |
QTest::qWait(200); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
596 |
QTRY_COMPARE(anim.state(), QVariantAnimation::Stopped); |
0 | 597 |
current = anim.currentValue().toInt(); |
598 |
QCOMPARE(current, 100); |
|
599 |
QCOMPARE(o.property("ole").toInt(), current); |
|
600 |
||
601 |
anim.setEndValue(110); |
|
602 |
anim.start(); |
|
603 |
current = anim.currentValue().toInt(); |
|
604 |
// the default start value will reevaluate the current property |
|
605 |
// and set it to the end value of the last iteration |
|
606 |
QCOMPARE(current, 100); |
|
607 |
QTest::qWait(100); |
|
608 |
current = anim.currentValue().toInt(); |
|
609 |
//it is somewhere in the animation |
|
610 |
QVERIFY(current >= 100); |
|
611 |
QVERIFY(current <= 110); |
|
612 |
} |
|
613 |
||
614 |
void tst_QPropertyAnimation::startBackwardWithoutEndValue() |
|
615 |
{ |
|
616 |
QObject o; |
|
617 |
o.setProperty("ole", 42); |
|
618 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
619 |
||
620 |
QPropertyAnimation anim(&o, "ole"); |
|
621 |
anim.setStartValue(100); |
|
622 |
anim.setDirection(QAbstractAnimation::Backward); |
|
623 |
||
624 |
//we start without an end value |
|
625 |
anim.start(); |
|
626 |
QCOMPARE(anim.state(), QAbstractAnimation::Running); |
|
627 |
QCOMPARE(o.property("ole").toInt(), 42); //the initial value |
|
628 |
||
629 |
QTest::qWait(100); |
|
630 |
int current = anim.currentValue().toInt(); |
|
631 |
//it is somewhere in the animation |
|
632 |
QVERIFY(current > 42); |
|
633 |
QVERIFY(current < 100); |
|
634 |
||
635 |
QTest::qWait(200); |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
636 |
QTRY_COMPARE(anim.state(), QVariantAnimation::Stopped); |
0 | 637 |
current = anim.currentValue().toInt(); |
638 |
QCOMPARE(current, 100); |
|
639 |
QCOMPARE(o.property("ole").toInt(), current); |
|
640 |
||
641 |
anim.setStartValue(110); |
|
642 |
anim.start(); |
|
643 |
current = anim.currentValue().toInt(); |
|
644 |
// the default start value will reevaluate the current property |
|
645 |
// and set it to the end value of the last iteration |
|
646 |
QCOMPARE(current, 100); |
|
647 |
QTest::qWait(100); |
|
648 |
current = anim.currentValue().toInt(); |
|
649 |
//it is somewhere in the animation |
|
650 |
QVERIFY(current >= 100); |
|
651 |
QVERIFY(current <= 110); |
|
652 |
} |
|
653 |
||
654 |
||
655 |
void tst_QPropertyAnimation::playForwardBackward() |
|
656 |
{ |
|
657 |
QObject o; |
|
658 |
o.setProperty("ole", 0); |
|
659 |
QCOMPARE(o.property("ole").toInt(), 0); |
|
660 |
||
661 |
QPropertyAnimation anim(&o, "ole"); |
|
662 |
anim.setStartValue(0); |
|
663 |
anim.setEndValue(100); |
|
664 |
anim.start(); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
665 |
QTest::qWait(anim.duration() + 100); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
666 |
QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); |
0 | 667 |
QCOMPARE(anim.currentTime(), anim.duration()); |
668 |
||
669 |
//the animation is at the end |
|
670 |
anim.setDirection(QVariantAnimation::Backward); |
|
671 |
anim.start(); |
|
672 |
QCOMPARE(anim.state(), QAbstractAnimation::Running); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
QTest::qWait(anim.duration() + 100); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
674 |
QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); |
0 | 675 |
QCOMPARE(anim.currentTime(), 0); |
676 |
||
677 |
//the direction is backward |
|
678 |
//restarting should jump to the end |
|
679 |
anim.start(); |
|
680 |
QCOMPARE(anim.state(), QAbstractAnimation::Running); |
|
681 |
QCOMPARE(anim.currentTime(), anim.duration()); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
QTest::qWait(anim.duration() + 100); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
683 |
QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); |
0 | 684 |
QCOMPARE(anim.currentTime(), 0); |
685 |
} |
|
686 |
||
687 |
struct Number |
|
688 |
{ |
|
689 |
Number() {} |
|
690 |
Number(int n) |
|
691 |
: n(n) {} |
|
692 |
||
693 |
Number(const Number &other) |
|
694 |
: n(other.n){} |
|
695 |
||
696 |
Number &operator=(const Number &other) { |
|
697 |
n = other.n; |
|
698 |
return *this; |
|
699 |
} |
|
700 |
bool operator==(const Number &other) const { |
|
701 |
return n == other.n; |
|
702 |
} |
|
703 |
||
704 |
int n; |
|
705 |
}; |
|
706 |
||
707 |
Q_DECLARE_METATYPE(Number) |
|
708 |
Q_DECLARE_METATYPE(QAbstractAnimation::State) |
|
709 |
||
710 |
QVariant numberInterpolator(const Number &f, const Number &t, qreal progress) |
|
711 |
{ |
|
712 |
return qVariantFromValue<Number>(Number(f.n + (t.n - f.n)*progress)); |
|
713 |
} |
|
714 |
||
715 |
QVariant xaxisQPointInterpolator(const QPointF &f, const QPointF &t, qreal progress) |
|
716 |
{ |
|
717 |
return QPointF(f.x() + (t.x() - f.x())*progress, f.y()); |
|
718 |
} |
|
719 |
||
720 |
void tst_QPropertyAnimation::interpolated() |
|
721 |
{ |
|
722 |
QObject o; |
|
723 |
o.setProperty("point", QPointF()); //this will avoid warnings |
|
724 |
o.setProperty("number", qVariantFromValue<Number>(Number(42))); |
|
725 |
QCOMPARE(qVariantValue<Number>(o.property("number")), Number(42)); |
|
726 |
{ |
|
727 |
qRegisterAnimationInterpolator<Number>(numberInterpolator); |
|
728 |
QPropertyAnimation anim(&o, "number"); |
|
729 |
anim.setStartValue(qVariantFromValue<Number>(Number(0))); |
|
730 |
anim.setEndValue(qVariantFromValue<Number>(Number(100))); |
|
731 |
anim.setDuration(1000); |
|
732 |
anim.start(); |
|
733 |
anim.pause(); |
|
734 |
anim.setCurrentTime(100); |
|
735 |
Number t(qVariantValue<Number>(o.property("number"))); |
|
736 |
QCOMPARE(t, Number(10)); |
|
737 |
anim.setCurrentTime(500); |
|
738 |
QCOMPARE(qVariantValue<Number>(o.property("number")), Number(50)); |
|
739 |
} |
|
740 |
{ |
|
741 |
qRegisterAnimationInterpolator<QPointF>(xaxisQPointInterpolator); |
|
742 |
QPropertyAnimation anim(&o, "point"); |
|
743 |
anim.setStartValue(QPointF(0,0)); |
|
744 |
anim.setEndValue(QPointF(100, 100)); |
|
745 |
anim.setDuration(1000); |
|
746 |
anim.start(); |
|
747 |
anim.pause(); |
|
748 |
anim.setCurrentTime(100); |
|
749 |
QCOMPARE(o.property("point"), QVariant(QPointF(10, 0))); |
|
750 |
anim.setCurrentTime(500); |
|
751 |
QCOMPARE(o.property("point"), QVariant(QPointF(50, 0))); |
|
752 |
} |
|
753 |
{ |
|
754 |
// unregister it and see if we get back the default behaviour |
|
755 |
qRegisterAnimationInterpolator<QPointF>(0); |
|
756 |
QPropertyAnimation anim(&o, "point"); |
|
757 |
anim.setStartValue(QPointF(0,0)); |
|
758 |
anim.setEndValue(QPointF(100, 100)); |
|
759 |
anim.setDuration(1000); |
|
760 |
anim.start(); |
|
761 |
anim.pause(); |
|
762 |
anim.setCurrentTime(100); |
|
763 |
QCOMPARE(o.property("point").toPointF(), QPointF(10, 10)); |
|
764 |
anim.setCurrentTime(500); |
|
765 |
QCOMPARE(o.property("point").toPointF(), QPointF(50, 50)); |
|
766 |
} |
|
767 |
||
768 |
{ |
|
769 |
// Interpolate a qreal property with a int interpolator |
|
770 |
AnimationObject o1; |
|
771 |
o1.setRealValue(42.42); |
|
772 |
QPropertyAnimation anim(&o1, "realValue"); |
|
773 |
anim.setStartValue(0); |
|
774 |
anim.setEndValue(100); |
|
775 |
anim.start(); |
|
776 |
QCOMPARE(o1.realValue(), qreal(0)); |
|
777 |
anim.setCurrentTime(250); |
|
778 |
QCOMPARE(o1.realValue(), qreal(100)); |
|
779 |
} |
|
780 |
} |
|
781 |
||
782 |
Q_DECLARE_METATYPE(QVariant) |
|
783 |
||
784 |
void tst_QPropertyAnimation::setStartEndValues_data() |
|
785 |
{ |
|
786 |
QTest::addColumn<QByteArray>("propertyName"); |
|
787 |
QTest::addColumn<QVariant>("initialValue"); |
|
788 |
QTest::addColumn<QVariant>("startValue"); |
|
789 |
QTest::addColumn<QVariant>("endValue"); |
|
790 |
||
791 |
QTest::newRow("dynamic property") << QByteArray("ole") << QVariant(42) << QVariant(0) << QVariant(10); |
|
792 |
QTest::newRow("real property, with unmatching types") << QByteArray("x") << QVariant(42.) << QVariant(0) << QVariant(10.); |
|
793 |
} |
|
794 |
||
795 |
void tst_QPropertyAnimation::setStartEndValues() |
|
796 |
{ |
|
797 |
MyObject object; |
|
798 |
QFETCH(QByteArray, propertyName); |
|
799 |
QFETCH(QVariant, initialValue); |
|
800 |
QFETCH(QVariant, startValue); |
|
801 |
QFETCH(QVariant, endValue); |
|
802 |
||
803 |
//this tests the start value, end value and default start value |
|
804 |
object.setProperty(propertyName, initialValue); |
|
805 |
QPropertyAnimation anim(&object, propertyName); |
|
806 |
QVariantAnimation::KeyValues values; |
|
807 |
QCOMPARE(anim.keyValues(), values); |
|
808 |
||
809 |
//let's add a start value |
|
810 |
anim.setStartValue(startValue); |
|
811 |
values << QVariantAnimation::KeyValue(0, startValue); |
|
812 |
QCOMPARE(anim.keyValues(), values); |
|
813 |
||
814 |
anim.setEndValue(endValue); |
|
815 |
values << QVariantAnimation::KeyValue(1, endValue); |
|
816 |
QCOMPARE(anim.keyValues(), values); |
|
817 |
||
818 |
//now we can play with objects |
|
819 |
QCOMPARE(object.property(propertyName).toDouble(), initialValue.toDouble()); |
|
820 |
anim.start(); |
|
821 |
QVERIFY(anim.startValue().isValid()); |
|
822 |
QCOMPARE(object.property(propertyName), anim.startValue()); |
|
823 |
anim.setCurrentTime(anim.duration()/2); |
|
824 |
QCOMPARE(object.property(propertyName).toDouble(), (startValue.toDouble() + endValue.toDouble())/2 ); //just in the middle of the animation |
|
825 |
anim.setCurrentTime(anim.duration()); //we go to the end of the animation |
|
826 |
QCOMPARE(anim.state(), QAnimationGroup::Stopped); //it should have stopped |
|
827 |
QVERIFY(anim.endValue().isValid()); |
|
828 |
QCOMPARE(object.property(propertyName), anim.endValue()); //end of the animations |
|
829 |
||
830 |
//now we remove the explicit start value and test the implicit one |
|
831 |
anim.stop(); |
|
832 |
object.setProperty(propertyName, initialValue); |
|
833 |
||
834 |
//let's reset the start value |
|
835 |
values.remove(0); |
|
836 |
anim.setStartValue(QVariant()); |
|
837 |
QCOMPARE(anim.keyValues(), values); |
|
838 |
QVERIFY(!anim.startValue().isValid()); |
|
839 |
||
840 |
anim.start(); |
|
841 |
QCOMPARE(object.property(propertyName), initialValue); |
|
842 |
anim.setCurrentTime(anim.duration()/2); |
|
843 |
QCOMPARE(object.property(propertyName).toDouble(), (initialValue.toDouble() + endValue.toDouble())/2 ); //just in the middle of the animation |
|
844 |
anim.setCurrentTime(anim.duration()); //we go to the end of the animation |
|
845 |
QCOMPARE(anim.state(), QAnimationGroup::Stopped); //it should have stopped |
|
846 |
QVERIFY(anim.endValue().isValid()); |
|
847 |
QCOMPARE(object.property(propertyName), anim.endValue()); //end of the animations |
|
848 |
||
849 |
//now we set back the startValue |
|
850 |
anim.setStartValue(startValue); |
|
851 |
QVERIFY(anim.startValue().isValid()); |
|
852 |
anim.start(); |
|
853 |
QCOMPARE(object.property(propertyName), startValue); |
|
854 |
} |
|
855 |
||
856 |
void tst_QPropertyAnimation::zeroDurationStart() |
|
857 |
{ |
|
858 |
DummyPropertyAnimation anim; |
|
859 |
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
860 |
anim.setDuration(0); |
|
861 |
QCOMPARE(anim.state(), QAbstractAnimation::Stopped); |
|
862 |
anim.start(); |
|
863 |
//the animation stops immediately |
|
864 |
QCOMPARE(anim.state(), QAbstractAnimation::Stopped); |
|
865 |
QCOMPARE(spy.count(), 2); |
|
866 |
||
867 |
//let's check the first state change |
|
868 |
const QVariantList firstChange = spy.first(); |
|
869 |
//old state |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
870 |
QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Stopped); |
0 | 871 |
//new state |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
872 |
QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Running); |
0 | 873 |
|
874 |
//let's check the first state change |
|
875 |
const QVariantList secondChange = spy.last(); |
|
876 |
//old state |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
877 |
QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Running); |
0 | 878 |
//new state |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Stopped); |
0 | 880 |
} |
881 |
||
882 |
#define Pause 1 |
|
883 |
#define Start 2 |
|
884 |
#define Resume 3 |
|
885 |
#define Stop 4 |
|
886 |
||
887 |
void tst_QPropertyAnimation::operationsInStates_data() |
|
888 |
{ |
|
889 |
QTest::addColumn<QAbstractAnimation::State>("originState"); |
|
890 |
QTest::addColumn<int>("operation"); |
|
891 |
QTest::addColumn<QString>("expectedWarning"); |
|
892 |
QTest::addColumn<QAbstractAnimation::State>("expectedState"); |
|
893 |
||
894 |
QString pauseWarn(QLatin1String("QAbstractAnimation::pause: Cannot pause a stopped animation")); |
|
895 |
QString resumeWarn(QLatin1String("QAbstractAnimation::resume: Cannot resume an animation that is not paused")); |
|
896 |
||
897 |
QTest::newRow("S-pause") << QAbstractAnimation::Stopped << Pause << pauseWarn << QAbstractAnimation::Stopped; |
|
898 |
QTest::newRow("S-start") << QAbstractAnimation::Stopped << Start << QString() << QAbstractAnimation::Running; |
|
899 |
QTest::newRow("S-resume") << QAbstractAnimation::Stopped << Resume << resumeWarn << QAbstractAnimation::Stopped; |
|
900 |
QTest::newRow("S-stop") << QAbstractAnimation::Stopped << Stop << QString() << QAbstractAnimation::Stopped; |
|
901 |
||
902 |
QTest::newRow("P-pause") << QAbstractAnimation::Paused << Pause << QString() << QAbstractAnimation::Paused; |
|
903 |
QTest::newRow("P-start") << QAbstractAnimation::Paused << Start << QString() << QAbstractAnimation::Running; |
|
904 |
QTest::newRow("P-resume") << QAbstractAnimation::Paused << Resume << QString() << QAbstractAnimation::Running; |
|
905 |
QTest::newRow("P-stop") << QAbstractAnimation::Paused << Stop << QString() << QAbstractAnimation::Stopped; |
|
906 |
||
907 |
QTest::newRow("R-pause") << QAbstractAnimation::Running << Pause << QString() << QAbstractAnimation::Paused; |
|
908 |
QTest::newRow("R-start") << QAbstractAnimation::Running << Start << QString() << QAbstractAnimation::Running; |
|
909 |
QTest::newRow("R-resume") << QAbstractAnimation::Running << Resume << resumeWarn << QAbstractAnimation::Running; |
|
910 |
QTest::newRow("R-stop") << QAbstractAnimation::Running << Stop << QString() << QAbstractAnimation::Stopped; |
|
911 |
} |
|
912 |
||
913 |
void tst_QPropertyAnimation::operationsInStates() |
|
914 |
{ |
|
915 |
/** |
|
916 |
* | pause() |start() |resume() |stop() |
|
917 |
* ----------+------------+-----------+-----------+-------------------+ |
|
918 |
* Stopped | Stopped |Running |Stopped |Stopped | |
|
919 |
* _| qWarning |restart |qWarning | | |
|
920 |
* Paused | Paused |Running |Running |Stopped | |
|
921 |
* _| | | | | |
|
922 |
* Running | Paused |Running |Running |Stopped | |
|
923 |
* | |restart |qWarning | | |
|
924 |
* ----------+------------+-----------+-----------+-------------------+ |
|
925 |
**/ |
|
926 |
||
927 |
QFETCH(QAbstractAnimation::State, originState); |
|
928 |
QFETCH(int, operation); |
|
929 |
QFETCH(QString, expectedWarning); |
|
930 |
QFETCH(QAbstractAnimation::State, expectedState); |
|
931 |
||
932 |
QObject o; |
|
933 |
o.setProperty("ole", 42); |
|
934 |
QPropertyAnimation anim(&o, "ole"); |
|
935 |
anim.setEndValue(100); |
|
936 |
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
|
937 |
||
938 |
anim.stop(); |
|
939 |
switch (originState) { |
|
940 |
case QAbstractAnimation::Stopped: |
|
941 |
break; |
|
942 |
case QAbstractAnimation::Paused: |
|
943 |
anim.start(); |
|
944 |
anim.pause(); |
|
945 |
break; |
|
946 |
case QAbstractAnimation::Running: |
|
947 |
anim.start(); |
|
948 |
break; |
|
949 |
} |
|
950 |
if (!expectedWarning.isEmpty()) { |
|
951 |
QTest::ignoreMessage(QtWarningMsg, qPrintable(expectedWarning)); |
|
952 |
} |
|
953 |
QCOMPARE(anim.state(), originState); |
|
954 |
switch (operation) { |
|
955 |
case Pause: |
|
956 |
anim.pause(); |
|
957 |
break; |
|
958 |
case Start: |
|
959 |
anim.start(); |
|
960 |
break; |
|
961 |
case Resume: |
|
962 |
anim.resume(); |
|
963 |
break; |
|
964 |
case Stop: |
|
965 |
anim.stop(); |
|
966 |
break; |
|
967 |
} |
|
968 |
||
969 |
QCOMPARE(anim.state(), expectedState); |
|
970 |
} |
|
971 |
#undef Pause |
|
972 |
#undef Start |
|
973 |
#undef Resume |
|
974 |
#undef Stop |
|
975 |
||
976 |
void tst_QPropertyAnimation::oneKeyValue() |
|
977 |
{ |
|
978 |
QObject o; |
|
979 |
o.setProperty("ole", 42); |
|
980 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
981 |
||
982 |
QPropertyAnimation animation(&o, "ole"); |
|
983 |
animation.setStartValue(43); |
|
984 |
animation.setEndValue(44); |
|
985 |
animation.setDuration(100); |
|
986 |
||
987 |
animation.setCurrentTime(0); |
|
988 |
||
989 |
QVERIFY(animation.currentValue().isValid()); |
|
990 |
QCOMPARE(animation.currentValue().toInt(), 43); |
|
991 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
992 |
||
993 |
// remove the last key value |
|
994 |
animation.setKeyValueAt(1.0, QVariant()); |
|
995 |
||
996 |
// we will neither interpolate, nor update the current value |
|
997 |
// since there is only one 1 key value defined |
|
998 |
animation.setCurrentTime(100); |
|
999 |
||
1000 |
// the animation should not have been modified |
|
1001 |
QVERIFY(animation.currentValue().isValid()); |
|
1002 |
QCOMPARE(animation.currentValue().toInt(), 43); |
|
1003 |
QCOMPARE(o.property("ole").toInt(), 42); |
|
1004 |
} |
|
1005 |
||
1006 |
void tst_QPropertyAnimation::updateOnSetKeyValues() |
|
1007 |
{ |
|
1008 |
QObject o; |
|
1009 |
o.setProperty("ole", 100); |
|
1010 |
QCOMPARE(o.property("ole").toInt(), 100); |
|
1011 |
||
1012 |
QPropertyAnimation animation(&o, "ole"); |
|
1013 |
animation.setStartValue(100); |
|
1014 |
animation.setEndValue(200); |
|
1015 |
animation.setDuration(100); |
|
1016 |
||
1017 |
animation.setCurrentTime(50); |
|
1018 |
QCOMPARE(animation.currentValue().toInt(), 150); |
|
1019 |
animation.setKeyValueAt(0.0, 300); |
|
1020 |
QCOMPARE(animation.currentValue().toInt(), 250); |
|
1021 |
||
1022 |
o.setProperty("ole", 100); |
|
1023 |
QPropertyAnimation animation2(&o, "ole"); |
|
1024 |
QVariantAnimation::KeyValues kValues; |
|
1025 |
kValues << QVariantAnimation::KeyValue(0.0, 100) << QVariantAnimation::KeyValue(1.0, 200); |
|
1026 |
animation2.setKeyValues(kValues); |
|
1027 |
animation2.setDuration(100); |
|
1028 |
animation2.setCurrentTime(50); |
|
1029 |
QCOMPARE(animation2.currentValue().toInt(), 150); |
|
1030 |
||
1031 |
kValues.clear(); |
|
1032 |
kValues << QVariantAnimation::KeyValue(0.0, 300) << QVariantAnimation::KeyValue(1.0, 200); |
|
1033 |
animation2.setKeyValues(kValues); |
|
1034 |
||
1035 |
QCOMPARE(animation2.currentValue().toInt(), animation.currentValue().toInt()); |
|
1036 |
} |
|
1037 |
||
1038 |
||
1039 |
//this class will 'throw' an error in the test lib |
|
1040 |
// if the property ole is set to ErrorValue |
|
1041 |
class MyErrorObject : public QObject |
|
1042 |
{ |
|
1043 |
Q_OBJECT |
|
1044 |
Q_PROPERTY(int ole READ ole WRITE setOle) |
|
1045 |
public: |
|
1046 |
||
1047 |
static const int ErrorValue = 10000; |
|
1048 |
||
1049 |
MyErrorObject() : m_ole(0) { } |
|
1050 |
int ole() const { return m_ole; } |
|
1051 |
void setOle(int o) |
|
1052 |
{ |
|
1053 |
QVERIFY(o != ErrorValue); |
|
1054 |
m_ole = o; |
|
1055 |
} |
|
1056 |
||
1057 |
private: |
|
1058 |
int m_ole; |
|
1059 |
||
1060 |
||
1061 |
}; |
|
1062 |
||
1063 |
void tst_QPropertyAnimation::restart() |
|
1064 |
{ |
|
1065 |
//here we check that be restarting an animation |
|
1066 |
//it doesn't get an bogus intermediate value (end value) |
|
1067 |
//because the time is not yet reset to 0 |
|
1068 |
MyErrorObject o; |
|
1069 |
o.setOle(100); |
|
1070 |
QCOMPARE(o.property("ole").toInt(), 100); |
|
1071 |
||
1072 |
QPropertyAnimation anim(&o, "ole"); |
|
1073 |
anim.setEndValue(200); |
|
1074 |
anim.start(); |
|
1075 |
anim.setCurrentTime(anim.duration()); |
|
1076 |
QCOMPARE(anim.state(), QAbstractAnimation::Stopped); |
|
1077 |
QCOMPARE(o.property("ole").toInt(), 200); |
|
1078 |
||
1079 |
//we'll check that the animation never gets a wrong value when starting it |
|
1080 |
//after having changed the end value |
|
1081 |
anim.setEndValue(MyErrorObject::ErrorValue); |
|
1082 |
anim.start(); |
|
1083 |
} |
|
1084 |
||
1085 |
void tst_QPropertyAnimation::valueChanged() |
|
1086 |
{ |
|
1087 |
qRegisterMetaType<QVariant>("QVariant"); |
|
1088 |
||
1089 |
//we check that we receive the valueChanged signal |
|
1090 |
MyErrorObject o; |
|
1091 |
o.setOle(0); |
|
1092 |
QCOMPARE(o.property("ole").toInt(), 0); |
|
1093 |
QPropertyAnimation anim(&o, "ole"); |
|
1094 |
anim.setEndValue(5); |
|
1095 |
anim.setDuration(1000); |
|
1096 |
QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant))); |
|
1097 |
anim.start(); |
|
1098 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1099 |
QTest::qWait(anim.duration() + 100); |
0 | 1100 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1101 |
QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); |
0 | 1102 |
QCOMPARE(anim.currentTime(), anim.duration()); |
1103 |
||
1104 |
//let's check that the values go forward |
|
1105 |
QCOMPARE(spy.count(), 6); //we should have got everything from 0 to 5 |
|
1106 |
for (int i = 0; i < spy.count(); ++i) { |
|
1107 |
QCOMPARE(qvariant_cast<QVariant>(spy.at(i).first()).toInt(), i); |
|
1108 |
} |
|
1109 |
} |
|
1110 |
||
1111 |
//this class will help us make sure that 2 animations started |
|
1112 |
//at the same time also end at the same time |
|
1113 |
class MySyncObject : public MyErrorObject |
|
1114 |
{ |
|
1115 |
Q_OBJECT |
|
1116 |
public: |
|
1117 |
MySyncObject() : anim(this, "ole") |
|
1118 |
{ |
|
1119 |
anim.setEndValue(1000); |
|
1120 |
} |
|
1121 |
public slots: |
|
1122 |
void checkAnimationFinished() |
|
1123 |
{ |
|
1124 |
QCOMPARE(anim.state(), QAbstractAnimation::Stopped); |
|
1125 |
QCOMPARE(ole(), 1000); |
|
1126 |
} |
|
1127 |
||
1128 |
public: |
|
1129 |
QPropertyAnimation anim; |
|
1130 |
}; |
|
1131 |
||
1132 |
void tst_QPropertyAnimation::twoAnimations() |
|
1133 |
{ |
|
1134 |
MySyncObject o1, o2; |
|
1135 |
o1.setOle(0); |
|
1136 |
o2.setOle(0); |
|
1137 |
||
1138 |
//when the animation in o1 is finished |
|
1139 |
//the animation in o2 should stop around the same time |
|
1140 |
//We use a queued connection to check just after the tick from the common timer |
|
1141 |
//the other way is true too |
|
1142 |
QObject::connect(&o1.anim, SIGNAL(finished()), |
|
1143 |
&o2, SLOT(checkAnimationFinished()), Qt::QueuedConnection); |
|
1144 |
QObject::connect(&o2.anim, SIGNAL(finished()), |
|
1145 |
&o1, SLOT(checkAnimationFinished()), Qt::QueuedConnection); |
|
1146 |
||
1147 |
o1.anim.start(); |
|
1148 |
o2.anim.start(); |
|
1149 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1150 |
QTest::qWait(o1.anim.duration() + 100); |
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1151 |
QTRY_COMPARE(o1.anim.state(), QAbstractAnimation::Stopped); |
0 | 1152 |
QCOMPARE(o2.anim.state(), QAbstractAnimation::Stopped); |
1153 |
||
1154 |
QCOMPARE(o1.ole(), 1000); |
|
1155 |
QCOMPARE(o2.ole(), 1000); |
|
1156 |
} |
|
1157 |
||
1158 |
class MyComposedAnimation : public QPropertyAnimation |
|
1159 |
{ |
|
1160 |
Q_OBJECT |
|
1161 |
public: |
|
1162 |
MyComposedAnimation(QObject *target, const QByteArray &propertyName, const QByteArray &innerPropertyName) |
|
1163 |
: QPropertyAnimation(target, propertyName) |
|
1164 |
{ |
|
1165 |
innerAnim = new QPropertyAnimation(target, innerPropertyName); |
|
1166 |
this->setEndValue(1000); |
|
1167 |
innerAnim->setEndValue(1000); |
|
1168 |
innerAnim->setDuration(duration() + 100); |
|
1169 |
} |
|
1170 |
||
1171 |
void start() |
|
1172 |
{ |
|
1173 |
QPropertyAnimation::start(); |
|
1174 |
innerAnim->start(); |
|
1175 |
} |
|
1176 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1177 |
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) |
0 | 1178 |
{ |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1179 |
QPropertyAnimation::updateState(newState, oldState); |
0 | 1180 |
if (newState == QAbstractAnimation::Stopped) |
1181 |
delete innerAnim; |
|
1182 |
} |
|
1183 |
||
1184 |
public: |
|
1185 |
QPropertyAnimation *innerAnim; |
|
1186 |
}; |
|
1187 |
||
1188 |
void tst_QPropertyAnimation::deletedInUpdateCurrentTime() |
|
1189 |
{ |
|
1190 |
// this test case reproduces an animation being deleted in the updateCurrentTime of |
|
1191 |
// another animation(was causing segfault). |
|
1192 |
// the deleted animation must have been started after the animation that is deleting. |
|
1193 |
AnimationObject o; |
|
1194 |
o.setValue(0); |
|
1195 |
o.setRealValue(0.0); |
|
1196 |
||
1197 |
MyComposedAnimation composedAnimation(&o, "value", "realValue"); |
|
1198 |
composedAnimation.start(); |
|
1199 |
QCOMPARE(composedAnimation.state(), QAbstractAnimation::Running); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1200 |
QTest::qWait(composedAnimation.duration() + 100); |
0 | 1201 |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
1202 |
QTRY_COMPARE(composedAnimation.state(), QAbstractAnimation::Stopped); |
0 | 1203 |
QCOMPARE(o.value(), 1000); |
1204 |
} |
|
1205 |
||
1206 |
void tst_QPropertyAnimation::totalDuration() |
|
1207 |
{ |
|
1208 |
QPropertyAnimation anim; |
|
1209 |
QCOMPARE(anim.totalDuration(), 250); |
|
1210 |
anim.setLoopCount(2); |
|
1211 |
QCOMPARE(anim.totalDuration(), 2*250); |
|
1212 |
anim.setLoopCount(-1); |
|
1213 |
QCOMPARE(anim.totalDuration(), -1); |
|
1214 |
anim.setDuration(0); |
|
1215 |
QCOMPARE(anim.totalDuration(), 0); |
|
1216 |
} |
|
1217 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1218 |
void tst_QPropertyAnimation::zeroLoopCount() |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1219 |
{ |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1220 |
DummyPropertyAnimation* anim; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1221 |
anim = new DummyPropertyAnimation; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1222 |
anim->setStartValue(0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1223 |
anim->setDuration(20); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1224 |
anim->setLoopCount(0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1225 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1226 |
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1227 |
QSignalSpy finishedSpy(anim, SIGNAL(finished())); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1228 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1229 |
QCOMPARE(anim->state(), QAnimationGroup::Stopped); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1230 |
QCOMPARE(anim->currentValue().toInt(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1231 |
QCOMPARE(runningSpy.count(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1232 |
QCOMPARE(finishedSpy.count(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1233 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1234 |
anim->start(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1235 |
|
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1236 |
QCOMPARE(anim->state(), QAnimationGroup::Stopped); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1237 |
QCOMPARE(anim->currentValue().toInt(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1238 |
QCOMPARE(runningSpy.count(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1239 |
QCOMPARE(finishedSpy.count(), 0); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
1240 |
} |
0 | 1241 |
|
1242 |
QTEST_MAIN(tst_QPropertyAnimation) |
|
1243 |
#include "tst_qpropertyanimation.moc" |