Remove obsolete code from qstate autotest.
This was originaly the only test function in this test, and should have been deleted when it was replaced by the other test functions. Change-Id: Idc71a5462fd4d19955f9b14389b877be16c62ab5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
a13b24eac0
commit
e92f9fc49e
@ -71,9 +71,6 @@ public:
|
||||
virtual ~tst_QState();
|
||||
|
||||
private slots:
|
||||
#if 0
|
||||
void test();
|
||||
#endif
|
||||
void assignProperty();
|
||||
void assignPropertyTwice();
|
||||
void historyInitialState();
|
||||
@ -91,148 +88,6 @@ tst_QState::~tst_QState()
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
void tst_QState::test()
|
||||
{
|
||||
QStateMachine machine;
|
||||
QState *s1 = new QState(&machine);
|
||||
|
||||
QCOMPARE(s1->machine(), &machine);
|
||||
QCOMPARE(s1->parentState(), &machine);
|
||||
QCOMPARE(s1->initialState(), (QState*)0);
|
||||
QVERIFY(s1->childStates().isEmpty());
|
||||
QVERIFY(s1->transitions().isEmpty());
|
||||
|
||||
QCOMPARE(s1->isFinal(), false);
|
||||
s1->setFinal(true);
|
||||
QCOMPARE(s1->isFinal(), true);
|
||||
s1->setFinal(false);
|
||||
QCOMPARE(s1->isFinal(), false);
|
||||
|
||||
QCOMPARE(s1->isParallel(), false);
|
||||
s1->setParallel(true);
|
||||
QCOMPARE(s1->isParallel(), true);
|
||||
s1->setParallel(false);
|
||||
QCOMPARE(s1->isParallel(), false);
|
||||
|
||||
QCOMPARE(s1->isAtomic(), true);
|
||||
QCOMPARE(s1->isCompound(), false);
|
||||
QCOMPARE(s1->isComplex(), false);
|
||||
|
||||
QState *s11 = new QState(s1);
|
||||
QCOMPARE(s11->parentState(), s1);
|
||||
QCOMPARE(s11->isAtomic(), true);
|
||||
QCOMPARE(s11->isCompound(), false);
|
||||
QCOMPARE(s11->isComplex(), false);
|
||||
QCOMPARE(s11->machine(), s1->machine());
|
||||
QVERIFY(s11->isDescendantOf(s1));
|
||||
|
||||
QCOMPARE(s1->initialState(), (QState*)0);
|
||||
QCOMPARE(s1->childStates().size(), 1);
|
||||
QCOMPARE(s1->childStates().at(0), s11);
|
||||
|
||||
QCOMPARE(s1->isAtomic(), false);
|
||||
QCOMPARE(s1->isCompound(), true);
|
||||
QCOMPARE(s1->isComplex(), true);
|
||||
|
||||
s1->setParallel(true);
|
||||
QCOMPARE(s1->isAtomic(), false);
|
||||
QCOMPARE(s1->isCompound(), false);
|
||||
QCOMPARE(s1->isComplex(), true);
|
||||
|
||||
QState *s12 = new QState(s1);
|
||||
QCOMPARE(s12->parentState(), s1);
|
||||
QCOMPARE(s12->isAtomic(), true);
|
||||
QCOMPARE(s12->isCompound(), false);
|
||||
QCOMPARE(s12->isComplex(), false);
|
||||
QCOMPARE(s12->machine(), s1->machine());
|
||||
QVERIFY(s12->isDescendantOf(s1));
|
||||
QVERIFY(!s12->isDescendantOf(s11));
|
||||
|
||||
QCOMPARE(s1->initialState(), (QState*)0);
|
||||
QCOMPARE(s1->childStates().size(), 2);
|
||||
QCOMPARE(s1->childStates().at(0), s11);
|
||||
QCOMPARE(s1->childStates().at(1), s12);
|
||||
|
||||
QCOMPARE(s1->isAtomic(), false);
|
||||
QCOMPARE(s1->isCompound(), false);
|
||||
QCOMPARE(s1->isComplex(), true);
|
||||
|
||||
s1->setParallel(false);
|
||||
QCOMPARE(s1->isAtomic(), false);
|
||||
QCOMPARE(s1->isCompound(), true);
|
||||
QCOMPARE(s1->isComplex(), true);
|
||||
|
||||
s1->setInitialState(s11);
|
||||
QCOMPARE(s1->initialState(), s11);
|
||||
|
||||
s1->setInitialState(0);
|
||||
QCOMPARE(s1->initialState(), (QState*)0);
|
||||
|
||||
s1->setInitialState(s12);
|
||||
QCOMPARE(s1->initialState(), s12);
|
||||
|
||||
QState *s13 = new QState();
|
||||
s1->setInitialState(s13);
|
||||
QCOMPARE(s13->parentState(), s1);
|
||||
QCOMPARE(s1->childStates().size(), 3);
|
||||
QCOMPARE(s1->childStates().at(0), s11);
|
||||
QCOMPARE(s1->childStates().at(1), s12);
|
||||
QCOMPARE(s1->childStates().at(2), s13);
|
||||
QVERIFY(s13->isDescendantOf(s1));
|
||||
|
||||
QVERIFY(s12->childStates().isEmpty());
|
||||
|
||||
QState *s121 = new QState(s12);
|
||||
QCOMPARE(s121->parentState(), s12);
|
||||
QCOMPARE(s121->isAtomic(), true);
|
||||
QCOMPARE(s121->isCompound(), false);
|
||||
QCOMPARE(s121->isComplex(), false);
|
||||
QCOMPARE(s121->machine(), s12->machine());
|
||||
QVERIFY(s121->isDescendantOf(s12));
|
||||
QVERIFY(s121->isDescendantOf(s1));
|
||||
QVERIFY(!s121->isDescendantOf(s11));
|
||||
|
||||
QCOMPARE(s12->childStates().size(), 1);
|
||||
QCOMPARE(s12->childStates().at(0), (QState*)s121);
|
||||
|
||||
QCOMPARE(s1->childStates().size(), 3);
|
||||
QCOMPARE(s1->childStates().at(0), s11);
|
||||
QCOMPARE(s1->childStates().at(1), s12);
|
||||
QCOMPARE(s1->childStates().at(2), s13);
|
||||
|
||||
s11->addTransition(s12);
|
||||
QCOMPARE(s11->transitions().size(), 1);
|
||||
QCOMPARE(s11->transitions().at(0)->sourceState(), s11);
|
||||
QCOMPARE(s11->transitions().at(0)->targetStates().size(), 1);
|
||||
QCOMPARE(s11->transitions().at(0)->targetStates().at(0), s12);
|
||||
QCOMPARE(s11->transitions().at(0)->eventType(), QEvent::None);
|
||||
|
||||
QState *s14 = new QState();
|
||||
s12->addTransition(QList<QState*>() << s13 << s14);
|
||||
QCOMPARE(s12->transitions().size(), 1);
|
||||
QCOMPARE(s12->transitions().at(0)->sourceState(), s12);
|
||||
QCOMPARE(s12->transitions().at(0)->targetStates().size(), 2);
|
||||
QCOMPARE(s12->transitions().at(0)->targetStates().at(0), s13);
|
||||
QCOMPARE(s12->transitions().at(0)->targetStates().at(1), s14);
|
||||
QCOMPARE(s12->transitions().at(0)->eventType(), QEvent::None);
|
||||
|
||||
s13->addTransition(this, SIGNAL(destroyed()), s14);
|
||||
QCOMPARE(s13->transitions().size(), 1);
|
||||
QCOMPARE(s13->transitions().at(0)->sourceState(), s13);
|
||||
QCOMPARE(s13->transitions().at(0)->targetStates().size(), 1);
|
||||
QCOMPARE(s13->transitions().at(0)->targetStates().at(0), s14);
|
||||
QCOMPARE(s13->transitions().at(0)->eventType(), QEvent::Signal);
|
||||
QVERIFY(qobject_cast<QSignalTransition*>(s13->transitions().at(0)) != 0);
|
||||
|
||||
delete s13->transitions().at(0);
|
||||
QCOMPARE(s13->transitions().size(), 0);
|
||||
|
||||
s12->addTransition(this, SIGNAL(destroyed()), s11);
|
||||
QCOMPARE(s12->transitions().size(), 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
class TestClass: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Loading…
Reference in New Issue
Block a user