From ade888860334d207f5f070b0bc9c4c98deaf3862 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Sun, 29 Apr 2012 00:11:28 -0700 Subject: Don't use obsolete qVariantValue, qVariantCanConvert, etc. qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint --- .../tst_qparallelanimationgroup.cpp | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'tests/auto/corelib/animation/qparallelanimationgroup') diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 2fdf1de9c8..b7464c8467 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -270,18 +270,18 @@ void tst_QParallelAnimationGroup::stateChanged() group.start(); //all the animations should be started QCOMPARE(spy1.count(), 1); - QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Running); QCOMPARE(spy2.count(), 1); - QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Running); QCOMPARE(spy3.count(), 1); - QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Running); QCOMPARE(spy4.count(), 1); - QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim1 should be finished QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 2); - QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Stopped); QCOMPARE(spy2.count(), 1); //no change QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -290,7 +290,7 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 2); //no change QCOMPARE(spy2.count(), 2); - QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Stopped); QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -299,9 +299,9 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(spy1.count(), 2); //no change QCOMPARE(spy2.count(), 2); //no change QCOMPARE(spy3.count(), 2); - QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Stopped); QCOMPARE(spy4.count(), 2); - QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Stopped); //cleanup spy1.clear(); @@ -318,22 +318,22 @@ void tst_QParallelAnimationGroup::stateChanged() QCOMPARE(spy1.count(), 0); QCOMPARE(spy2.count(), 0); QCOMPARE(spy3.count(), 1); - QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Running); QCOMPARE(spy4.count(), 1); - QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Running); group.setCurrentTime(1500); //anim2 should be started QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 0); //no change QCOMPARE(spy2.count(), 1); - QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Running); QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change group.setCurrentTime(500); //anim1 is finally also started QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(spy1.count(), 1); - QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Running); QCOMPARE(spy2.count(), 1); //no change QCOMPARE(spy3.count(), 1); //no change QCOMPARE(spy4.count(), 1); //no change @@ -341,13 +341,13 @@ void tst_QParallelAnimationGroup::stateChanged() group.setCurrentTime(0); //everything should be stopped QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(spy1.count(), 2); - QCOMPARE(qVariantValue(spy1.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy1.last().first()), TestAnimation::Stopped); QCOMPARE(spy2.count(), 2); - QCOMPARE(qVariantValue(spy2.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy2.last().first()), TestAnimation::Stopped); QCOMPARE(spy3.count(), 2); - QCOMPARE(qVariantValue(spy3.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy3.last().first()), TestAnimation::Stopped); QCOMPARE(spy4.count(), 2); - QCOMPARE(qVariantValue(spy4.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy4.last().first()), TestAnimation::Stopped); } void tst_QParallelAnimationGroup::clearGroup() @@ -455,9 +455,9 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() QCOMPARE(groupStateChangedSpy.count(), 1); QCOMPARE(childStateChangedSpy.count(), 1); - QCOMPARE(qVariantValue(groupStateChangedSpy.at(0).first()), + QCOMPARE(qvariant_cast(groupStateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(childStateChangedSpy.at(0).first()), + QCOMPARE(qvariant_cast(childStateChangedSpy.at(0).first()), QAnimationGroup::Running); // starting directly a running child will not have any effect @@ -620,11 +620,11 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() anim2.start(); anim2.pause(); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy2.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy2.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy2.at(1).first()), + QCOMPARE(qvariant_cast(stateChangedSpy2.at(1).first()), QAnimationGroup::Paused); QCOMPARE(group.state(), QAnimationGroup::Stopped); @@ -634,15 +634,15 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() group.start(); QCOMPARE(stateChangedSpy1.count(), 3); - QCOMPARE(qVariantValue(stateChangedSpy1.at(1).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(stateChangedSpy1.at(2).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(2).first()), QAnimationGroup::Running); QCOMPARE(stateChangedSpy2.count(), 4); - QCOMPARE(qVariantValue(stateChangedSpy2.at(2).first()), + QCOMPARE(qvariant_cast(stateChangedSpy2.at(2).first()), QAnimationGroup::Stopped); - QCOMPARE(qVariantValue(stateChangedSpy2.at(3).first()), + QCOMPARE(qvariant_cast(stateChangedSpy2.at(3).first()), QAnimationGroup::Running); QCOMPARE(group.state(), QAnimationGroup::Running); @@ -694,19 +694,19 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() group.start(); QCOMPARE(stateChangedSpy1.count(), 2); QCOMPARE(finishedSpy1.count(), 1); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy1.at(1).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(stateChangedSpy2.count(), 1); QCOMPARE(finishedSpy2.count(), 0); - QCOMPARE(qVariantValue(stateChangedSpy1.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy1.at(0).first()), QAnimationGroup::Running); QCOMPARE(stateChangedSpy3.count(), 1); QCOMPARE(finishedSpy3.count(), 0); - QCOMPARE(qVariantValue(stateChangedSpy3.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy3.at(0).first()), QAnimationGroup::Running); @@ -770,9 +770,9 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations() group.start(); QCOMPARE(stateChangedSpy.count(), 2); - QCOMPARE(qVariantValue(stateChangedSpy.at(0).first()), + QCOMPARE(qvariant_cast(stateChangedSpy.at(0).first()), QAnimationGroup::Running); - QCOMPARE(qVariantValue(stateChangedSpy.at(1).first()), + QCOMPARE(qvariant_cast(stateChangedSpy.at(1).first()), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Running); @@ -1000,10 +1000,10 @@ void tst_QParallelAnimationGroup::pauseResume() new TestAnimation2(500, &group); group.start(); QCOMPARE(spy.count(), 1); //the animation should have been started - QCOMPARE(qVariantValue(spy.last().first()), TestAnimation::Running); + QCOMPARE(qvariant_cast(spy.last().first()), TestAnimation::Running); group.setCurrentTime(250); //end of first animation QCOMPARE(spy.count(), 2); //the animation should have been stopped - QCOMPARE(qVariantValue(spy.last().first()), TestAnimation::Stopped); + QCOMPARE(qvariant_cast(spy.last().first()), TestAnimation::Stopped); group.pause(); QCOMPARE(spy.count(), 2); //this shouldn't have changed group.resume(); -- cgit v1.2.3