tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
    73     void stopUncontrolledAnimations();
    73     void stopUncontrolledAnimations();
    74     void loopCount_data();
    74     void loopCount_data();
    75     void loopCount();
    75     void loopCount();
    76     void autoAdd();
    76     void autoAdd();
    77     void pauseResume();
    77     void pauseResume();
       
    78 
       
    79     void QTBUG8910_crashWhenRemovingUncontrolledAnimation();
    78 };
    80 };
    79 
    81 
    80 tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
    82 tst_QParallelAnimationGroup::tst_QParallelAnimationGroup()
    81 {
    83 {
    82 }
    84 }
   997     QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
   999     QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
   998     group.pause();
  1000     group.pause();
   999     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1001     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1000     group.resume();
  1002     group.resume();
  1001     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1003     QCOMPARE(spy.count(), 2); //this shouldn't have changed
  1002 
  1004 }
  1003 
  1005 
  1004 
  1006 
       
  1007 void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation()
       
  1008 {
       
  1009     QParallelAnimationGroup group;
       
  1010     TestAnimation *anim = new TestAnimation;
       
  1011     anim->setLoopCount(-1);
       
  1012     TestAnimation *anim2 = new TestAnimation;
       
  1013     anim2->setLoopCount(-1);
       
  1014     group.addAnimation(anim);
       
  1015     group.addAnimation(anim2);
       
  1016     group.start();
       
  1017     delete anim;
       
  1018     // it would crash here because the internals of the group would still have a reference to anim
       
  1019     delete anim2;
  1005 }
  1020 }
  1006 
  1021 
  1007 
  1022 
  1008 QTEST_MAIN(tst_QParallelAnimationGroup)
  1023 QTEST_MAIN(tst_QParallelAnimationGroup)
  1009 #include "tst_qparallelanimationgroup.moc"
  1024 #include "tst_qparallelanimationgroup.moc"