From 25ff7e41dde5a1c8583292f5c2a12db933528830 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 18 Nov 2011 17:49:11 +1000 Subject: Remove obsolete code from QStateMachine test. The removed code was already disabled because it tested API that never made it into an official Qt release -- see commit f7d69d75 in the Qt 4.x history. Change-Id: I4f7eb20f937bdabfcac92842c5804233dca26a23 Reviewed-by: Rohan McGovern --- .../qstatemachine/tst_qstatemachine.cpp | 366 --------------------- 1 file changed, 366 deletions(-) (limited to 'tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp') diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index ae51d99607..e0f2797571 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -167,16 +167,6 @@ private slots: void removeDefaultAnimation(); void overrideDefaultAnimationWithSpecific(); -// void addDefaultAnimationForSource(); -// void addDefaultAnimationForTarget(); -// void removeDefaultAnimationForSource(); -// void removeDefaultAnimationForTarget(); -// void overrideDefaultAnimationWithSource(); -// void overrideDefaultAnimationWithTarget(); -// void overrideDefaultSourceAnimationWithSpecific(); -// void overrideDefaultTargetAnimationWithSpecific(); -// void overrideDefaultTargetAnimationWithSource(); - void nestedStateMachines(); void goToState(); void goToStateFromSourceWithTransition(); @@ -3317,362 +3307,6 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() delete moreSpecificAnimation; } -/* -void tst_QStateMachine::addDefaultAnimationForSource() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - QState *s1 = new QState(&machine); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine); - machine.addDefaultAnimationForSourceState(s1, pa); - s2->addTransition(pa, SIGNAL(finished()), s3); - - machine.setInitialState(s1); - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(object->property("foo").toDouble(), 2.0); -} - -void tst_QStateMachine::addDefaultAnimationForTarget() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - QState *s1 = new QState(&machine); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine); - machine.addDefaultAnimationForTargetState(s2, pa); - s2->addTransition(pa, SIGNAL(finished()), s3); - - machine.setInitialState(s1); - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(object->property("foo").toDouble(), 2.0); -} - -void tst_QStateMachine::removeDefaultAnimationForSource() -{ - QStateMachine machine; - - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0); - - QPropertyAnimation *anim = new QPropertyAnimation(this, "foo"); - - machine.addDefaultAnimationForSourceState(&machine, anim); - - QCOMPARE(machine.defaultAnimations().size(), 0); - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0); - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForSourceState(&machine).contains(anim)); - - machine.removeDefaultAnimationForTargetState(&machine, anim); - - QCOMPARE(machine.defaultAnimations().size(), 0); - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0); - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForSourceState(&machine).contains(anim)); - - machine.removeDefaultAnimationForSourceState(&machine, anim); - - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0); - - machine.addDefaultAnimationForSourceState(&machine, anim); - - QPropertyAnimation *anim2 = new QPropertyAnimation(this, "foo"); - machine.addDefaultAnimationForSourceState(&machine, anim2); - - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 2); - QVERIFY(machine.defaultAnimationsForSourceState(&machine).contains(anim)); - QVERIFY(machine.defaultAnimationsForSourceState(&machine).contains(anim2)); - - machine.removeDefaultAnimationForSourceState(&machine, anim); - - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForSourceState(&machine).contains(anim2)); - - machine.removeDefaultAnimationForSourceState(&machine, anim2); - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0); -} - -void tst_QStateMachine::removeDefaultAnimationForTarget() -{ - QStateMachine machine; - - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0); - - QPropertyAnimation *anim = new QPropertyAnimation(this, "foo"); - - machine.addDefaultAnimationForTargetState(&machine, anim); - - QCOMPARE(machine.defaultAnimations().size(), 0); - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0); - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForTargetState(&machine).contains(anim)); - - machine.removeDefaultAnimationForSourceState(&machine, anim); - - QCOMPARE(machine.defaultAnimations().size(), 0); - QCOMPARE(machine.defaultAnimationsForSourceState(&machine).size(), 0); - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForTargetState(&machine).contains(anim)); - - machine.removeDefaultAnimationForTargetState(&machine, anim); - - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0); - - machine.addDefaultAnimationForTargetState(&machine, anim); - - QPropertyAnimation *anim2 = new QPropertyAnimation(this, "foo"); - machine.addDefaultAnimationForTargetState(&machine, anim2); - - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 2); - QVERIFY(machine.defaultAnimationsForTargetState(&machine).contains(anim)); - QVERIFY(machine.defaultAnimationsForTargetState(&machine).contains(anim2)); - - machine.removeDefaultAnimationForTargetState(&machine, anim); - - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 1); - QVERIFY(machine.defaultAnimationsForTargetState(&machine).contains(anim2)); - - machine.removeDefaultAnimationForTargetState(&machine, anim2); - QCOMPARE(machine.defaultAnimationsForTargetState(&machine).size(), 0); -} - -void tst_QStateMachine::overrideDefaultAnimationWithSource() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - SlotCalledCounter counter; - - QState *s1 = new QState(&machine); - machine.setInitialState(s1); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); - s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - machine.addDefaultAnimation(defaultAnimation); - machine.addDefaultAnimationForSourceState(s1, moreSpecificAnimation); - - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(counter.counter, 2); // specific animation started and stopped -} - -void tst_QStateMachine::overrideDefaultAnimationWithTarget() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - SlotCalledCounter counter; - - QState *s1 = new QState(&machine); - machine.setInitialState(s1); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); - s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - machine.addDefaultAnimation(defaultAnimation); - machine.addDefaultAnimationForTargetState(s2, moreSpecificAnimation); - - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(counter.counter, 2); // specific animation started and stopped - -} - -void tst_QStateMachine::overrideDefaultSourceAnimationWithSpecific() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - SlotCalledCounter counter; - - QState *s1 = new QState(&machine); - machine.setInitialState(s1); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); - s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - machine.addDefaultAnimationForSourceState(s1, defaultAnimation); - at->addAnimation(moreSpecificAnimation); - - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(counter.counter, 2); // specific animation started and stopped -} - -void tst_QStateMachine::overrideDefaultTargetAnimationWithSpecific() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - SlotCalledCounter counter; - - QState *s1 = new QState(&machine); - machine.setInitialState(s1); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); - s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - machine.addDefaultAnimationForTargetState(s2, defaultAnimation); - at->addAnimation(moreSpecificAnimation); - - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(counter.counter, 2); // specific animation started and stopped -} - -void tst_QStateMachine::overrideDefaultTargetAnimationWithSource() -{ - QStateMachine machine; - - QObject *object = new QObject(); - object->setProperty("foo", 1.0); - - SlotCalledCounter counter; - - QState *s1 = new QState(&machine); - machine.setInitialState(s1); - - QState *s2 = new QState(&machine); - s2->assignProperty(object, "foo", 2.0); - - QState *s3 = new QState(&machine); - QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit())); - - s1->addTransition(new EventTransition(QEvent::User, s2)); - - QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); - s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); - - machine.addDefaultAnimationForTargetState(s2, defaultAnimation); - machine.addDefaultAnimationForSourceState(s1, moreSpecificAnimation); - - machine.start(); - QCoreApplication::processEvents(); - - machine.postEvent(new QEvent(QEvent::User)); - QCOREAPPLICATION_EXEC(5000); - - QVERIFY(machine.configuration().contains(s3)); - QCOMPARE(counter.counter, 2); // specific animation started and stopped -} - -*/ - void tst_QStateMachine::parallelStateAssignmentsDone() { QStateMachine machine; -- cgit v1.2.3