tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    43 #include "../../shared/util.h"
    43 #include "../../shared/util.h"
    44 
    44 
    45 #include <QtCore/qpropertyanimation.h>
    45 #include <QtCore/qpropertyanimation.h>
    46 #include <QtCore/qvariantanimation.h>
    46 #include <QtCore/qvariantanimation.h>
    47 #include <QtGui/qwidget.h>
    47 #include <QtGui/qwidget.h>
       
    48 #include "../../shared/util.h"
    48 
    49 
    49 //TESTED_CLASS=QPropertyAnimation
    50 //TESTED_CLASS=QPropertyAnimation
    50 //TESTED_FILES=
    51 //TESTED_FILES=
    51 
    52 
    52 class UncontrolledAnimation : public QPropertyAnimation
    53 class UncontrolledAnimation : public QPropertyAnimation
   130     void restart();
   131     void restart();
   131     void valueChanged();
   132     void valueChanged();
   132     void twoAnimations();
   133     void twoAnimations();
   133     void deletedInUpdateCurrentTime();
   134     void deletedInUpdateCurrentTime();
   134     void totalDuration();
   135     void totalDuration();
       
   136     void zeroLoopCount();
   135 };
   137 };
   136 
   138 
   137 tst_QPropertyAnimation::tst_QPropertyAnimation()
   139 tst_QPropertyAnimation::tst_QPropertyAnimation()
   138 {
   140 {
   139 }
   141 }
  1211     QCOMPARE(anim.totalDuration(), -1);
  1213     QCOMPARE(anim.totalDuration(), -1);
  1212     anim.setDuration(0);
  1214     anim.setDuration(0);
  1213     QCOMPARE(anim.totalDuration(), 0);
  1215     QCOMPARE(anim.totalDuration(), 0);
  1214 }
  1216 }
  1215 
  1217 
       
  1218 void tst_QPropertyAnimation::zeroLoopCount()
       
  1219 {
       
  1220     DummyPropertyAnimation* anim;
       
  1221     anim = new DummyPropertyAnimation;
       
  1222     anim->setStartValue(0);
       
  1223     anim->setDuration(20);
       
  1224     anim->setLoopCount(0);
       
  1225 
       
  1226     QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
       
  1227     QSignalSpy finishedSpy(anim, SIGNAL(finished()));
       
  1228 
       
  1229     QCOMPARE(anim->state(), QAnimationGroup::Stopped);
       
  1230     QCOMPARE(anim->currentValue().toInt(), 0);
       
  1231     QCOMPARE(runningSpy.count(), 0);
       
  1232     QCOMPARE(finishedSpy.count(), 0);
       
  1233 
       
  1234     anim->start();
       
  1235 
       
  1236     QCOMPARE(anim->state(), QAnimationGroup::Stopped);
       
  1237     QCOMPARE(anim->currentValue().toInt(), 0);
       
  1238     QCOMPARE(runningSpy.count(), 0);
       
  1239     QCOMPARE(finishedSpy.count(), 0);
       
  1240 }
  1216 
  1241 
  1217 QTEST_MAIN(tst_QPropertyAnimation)
  1242 QTEST_MAIN(tst_QPropertyAnimation)
  1218 #include "tst_qpropertyanimation.moc"
  1243 #include "tst_qpropertyanimation.moc"