Add missing Q_OBJECT macro to GoToStateTransition
The missing macro caused qFindChild() to return any QAbstractTransition. Task-number: QTBUG-21813 Change-Id: I80507aa86c8c32d7fa59a1b5ae551043f5f90315 Reviewed-on: http://codereview.qt-project.org/6044 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>bb10
parent
57c6f22858
commit
5049cff496
|
|
@ -1396,6 +1396,7 @@ namespace _QStateMachine_Internal{
|
|||
|
||||
class GoToStateTransition : public QAbstractTransition
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GoToStateTransition(QAbstractState *target)
|
||||
: QAbstractTransition()
|
||||
|
|
@ -2396,6 +2397,7 @@ QStateMachine::WrappedEvent::~WrappedEvent()
|
|||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "qstatemachine.moc"
|
||||
#include "moc_qstatemachine.cpp"
|
||||
|
||||
#endif //QT_NO_STATEMACHINE
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ private slots:
|
|||
|
||||
void nestedStateMachines();
|
||||
void goToState();
|
||||
void goToStateFromSourceWithTransition();
|
||||
|
||||
void task260403_clonedSignals();
|
||||
void postEventFromOtherThread();
|
||||
|
|
@ -4256,6 +4257,24 @@ void tst_QStateMachine::goToState()
|
|||
QVERIFY(machine.configuration().contains(s2_1));
|
||||
}
|
||||
|
||||
void tst_QStateMachine::goToStateFromSourceWithTransition()
|
||||
{
|
||||
// QTBUG-21813
|
||||
QStateMachine machine;
|
||||
QState *s1 = new QState(&machine);
|
||||
s1->addTransition(new QSignalTransition);
|
||||
QState *s2 = new QState(&machine);
|
||||
machine.setInitialState(s1);
|
||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
||||
machine.start();
|
||||
QTRY_COMPARE(startedSpy.count(), 1);
|
||||
|
||||
QStateMachinePrivate::get(&machine)->goToState(s2);
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(machine.configuration().size(), 1);
|
||||
QVERIFY(machine.configuration().contains(s2));
|
||||
}
|
||||
|
||||
class CloneSignalTransition : public QSignalTransition
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
Loading…
Reference in New Issue