summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstatemachine
Commit message (Collapse)AuthorAgeFilesLines
* Make QStateMachine inherit QStateKent Hansen2009-07-221-234/+277
| | | | | | | | | | | | | | | | | | This removes the need for a "root state" in the machine; or rather, the machine _is_ the root state. User code can now pass in a QStateMachine directly to the QState constructor, instead of machine->rootState(). This also means we could get rid of the "proxying" from the machine to the root state for things like properties (initialState et al), finished() signal and auto-reparenting of states (the ChildAdded event hack). A fun little side-effect of this change is that it's now possible to embed state machines within state machines. We can't think of a good use case yet where you would rather embed a stand-alone state machine (with its own event processing etc.) rather than having just a regular nested state, but it's neat and it works. Reviewed-by: Eskil Abrahamsen Blomfeldt
* Fix memleaks in the autotestsKent Hansen2009-07-211-1/+14
|
* add autotest for adding transition from state machine's rootKent Hansen2009-07-211-0/+10
| | | | | | It's not supported because the root state has no ancestor, which is a requirement for the state machine's transition selection algorithm.
* Disable private unit tests when Qt is configured withoutRohan McGovern2009-07-091-0/+2
| | | | | | | | | | | | -developer-build, part 2. Some autotests use private (unexported) code, either because they're testing private classes or because that's the easiest way to test the public classes. Configuring Qt with `-developer-build' is needed for these tests. This commit fixes the tests so configuring without `-developer-build' only builds the tests which strictly use public API.
* Remove default error stateEskil Abrahamsen Blomfeldt2009-06-231-38/+48
| | | | | | | | | Having an implicit default error state in the graph which the user has not added is unintuitive and ugly. Rather than have a default error state, we stop execution of the machine and print an error message when the machine has run-time errors. If a user wishes to prevent errors from stopping the machine, you can set one or more error states explicitly.
* Fix tests on WindowsEskil Abrahamsen Blomfeldt2009-06-231-16/+16
| | | | | | Formatting of pointers in sprintf() is platform dependent. Use QString::sprintf() instead to make sure warnings match the actual warnings emitted.
* perform normalization of signatures for signal transitionsKent Hansen2009-06-221-0/+25
| | | | Make state->addTransition(foo, SIGNAL( bar( ) ), ...) work.
* add test for parallel root state (which currently isn't supported)Kent Hansen2009-06-221-0/+24
|
* Autotests: fix compile issue on hpuxThierry Bastian2009-06-181-5/+5
|
* Autotests: fix compile issues on HPUXThierry Bastian2009-06-171-16/+16
|
* perform all property assignments of initial state that's nestedKent Hansen2009-06-171-11/+19
| | | | | | If the machine's initial state is nested, a set of states will be entered, and we need to do the property assignments of all of them.
* bring back QAbstractTransition::triggered() signalKent Hansen2009-06-171-0/+2
| | | | | | It's been requested by several users. Since we have QAbstractState::{entered,exited}() signals, we should have this one as well.
* add tests for QAbstractState::{entered,exited}() signalsKent Hansen2009-06-171-0/+9
|
* Update license headers in files that are new in 4.6.Jason McDonald2009-06-171-2/+2
| | | | Reviewed-by: Trust Me
* don't require use of SIGNAL macro in calls to addTransition()Kent Hansen2009-06-031-0/+28
| | | | | Just as with the QSignalTransition::signal property, this makes it possible to use the function from language bindings (e.g. QtScript).
* add various testsKent Hansen2009-05-221-18/+86
| | | | Trying to get coverage up to 100%
* test what happens when changing to an invalid signal while state is activeKent Hansen2009-05-221-0/+6
|
* add tests for multiple signal/event transitions from same sourceKent Hansen2009-05-221-0/+68
|
* make sure signal transition is correctly unregistered/re-registeredKent Hansen2009-05-221-8/+27
| | | | | | When the signal or senderObject is changed while the state is active, the transition needs to be unregistered _before_ either property is changed, only _then_ can it be re-registered.
* make sure event transition is correctly unregistered/re-registeredKent Hansen2009-05-221-0/+13
| | | | | | When the eventType or eventObject is changed while the state is active, the transition needs to be unregistered _before_ either property is changed, only _then_ can it be re-registered.
* add some edge case tests for QStateMachine::start() & stop()Kent Hansen2009-05-221-0/+8
|
* add more testsKent Hansen2009-05-221-64/+124
|
* add more testsKent Hansen2009-05-221-14/+75
|
* Use QTest::ignoreMessage() instead of custom implementationEskil Abrahamsen Blomfeldt2009-05-221-52/+14
| | | | | Since QTest::ignoreMessage() already exists, we should use this instead of implementing an ad hoc solution that does the same.
* Avoid memory leaks in QStateMachine testsEskil Abrahamsen Blomfeldt2009-05-201-29/+28
| | | | | Give some objects parents and allocate some objects on the stack to avoid leaking them.
* Make QAbstractTransition::eventTest() non-constEskil Abrahamsen Blomfeldt2009-05-141-4/+4
| | | | | We decided to remove the const of the eventTest() since some transitions have dynamic conditions and need to update when eventTest() is called.
* correctly handle multiple event transitions for same (object,event)Kent Hansen2009-05-131-0/+48
| | | | | | The event filter was not removed at the right time. We now store the number of active event transitions for a particular (object,event) and only remove the filtering when the count drops to zero.
* correctly handle multiple signal transitions for same (object,signal)Kent Hansen2009-05-121-0/+45
| | | | | | The signal was not disconnected at the right time. We now store the number of active signal transitions for a particular (object,signal) and only disconnect when the count drops to zero.
* Don't interrupt test before animation finishesEskil Abrahamsen Blomfeldt2009-05-121-2/+4
| | | | | | | We're testing if both animations actually run and finish, so we need to make sure one of the polished signals is emitted last, and then react to this. I've done this by setting the duration of the animation which animated the property set by s2Child, so that it's sufficient to listen to this polished signal.
* Kill warning in removeDefaultAnimation() testEskil Abrahamsen Blomfeldt2009-05-121-2/+5
| | | | Warning about animating non-existent properties.
* Avoid warnings in assignPropertyWithAnimation testEskil Abrahamsen Blomfeldt2009-05-121-0/+8
| | | | | They added a warning when you animate a non-existent property, so we make sure the properties are defined.
* gracefully handle deletion of transition's target stateKent Hansen2009-05-081-0/+13
|
* Test what happens when target state doesn't have a parentKent Hansen2009-05-081-0/+25
|
* make sure connections and event filters are removed when state machine haltsKent Hansen2009-05-081-0/+4
|
* don't create transition to null stateKent Hansen2009-05-081-2/+23
|
* don't add signal transition if target is null or signal doesn't existKent Hansen2009-05-071-2/+21
|
* Make it impossible to have root state as source or target of transition or ↵Eskil Abrahamsen Blomfeldt2009-05-071-2/+5
| | | | | | | | | | | as error state Since the root state has no ancestors, it cannot be source or target in transitions since there will be no LCA for the transition, which is required for the algorithm of enterStates and exitStates. In SCXML the root state cannot be target or source of a transition. By the same logic, it cannot be an error state. The root state will always have a valid machine, since it's added to a machine immediately, which makes this code possible.
* add QStateMachine::isRunning()Kent Hansen2009-05-071-0/+42
|
* Rename NoDefaultStateInHistoryState -> NoDefaultStateInHistoryStateError for ↵Eskil Abrahamsen Blomfeldt2009-05-071-1/+1
| | | | | | consistency The other error values have Error in the name for namespacing purposes.
* Fix infinite loop when source and target of transition are in different treesEskil Abrahamsen Blomfeldt2009-05-071-3/+2
| | | | | | | | | | | The SCXML algorithm depends on the guarantee that there is always an LCA regardless of the state list. The case where the targets are in a different tree than the source (e.g. if you have not given the target state a parent) is a bug. The fix is to set an error when this happens in exitStates() and exit states as if the pending error states were the target states. In enterStates we will detect the error and skip the step of selecting states to enter, and instead just enter the pending error states. This breaks transitions to and from the root state, which is not supported by the SCXML algorithm.
* Fix tests for history state and entering root stateEskil Abrahamsen Blomfeldt2009-05-071-5/+3
| | | | | | Change expectation for entering the root state. We should never have the root state in the configuration. Also fix the expected error message in historyStateHasNowhereToGo since this has changed along with the API.
* add event as argument to onEntry(), onExit() and onTransition()Kent Hansen2009-05-051-8/+8
| | | | | | | | | Accessing the event can be useful. E.g., onEntry() can do some common event processing regardless of which transition caused the state to be entered; onTransition() can be used in combination with eventTest(), where eventTest() would first check that the input matches some criteria, and then the actual processing of that input would be done in onTransition.
* ignore QState::assignProperty() calls where the target object is 0Kent Hansen2009-05-041-0/+4
|
* When restoring properties in descendants of a state which assigns it a value,Eskil Abrahamsen Blomfeldt2009-04-301-0/+64
| | | | | | | | the property should be restored to the value assigned by the ancestor state. When restoreProperties is on, assigning a value in a state means it will have that value as long as the state is active, unless an active state deeper in the hierarchy assigns it a different value. This is basically a stack of "initial" values, but implemented using the parent hierarchy of the state instead.
* The intuitive interpretation of RestoreProperties is that a value isEskil Abrahamsen Blomfeldt2009-04-301-1/+55
| | | | | | | | | potentially restored once the state that set it is exited. So if you have a parent state P which sets 'foo' and then several child states of P, the property should not be restored as long as P is active, regardless of which transitions are taken inside P and what properties are being assigned there. Before, we would restore the property when we entered a state that did not assign it, ignoring what properties where being assigned in the parent.
* kill QStateMachine::animationsFinished(), introduce QState::polished()Kent Hansen2009-04-291-2/+153
|
* SCXML defines an atomic state as a <state> with no children or <final>. However,Eskil Abrahamsen Blomfeldt2009-04-291-0/+25
| | | | | | | | | | in SCXML it makes no sense for a <parallel> tag to be atomic, hence have no children, whereas in a dynamic state machine you might set an atomic state as parallel because this should govern the behavior if the state gets children later. We decided that the most intuitive definition is that a state is atomic if it has no children, regardless of whether it has the parallel child mode. With the old definition, transitions from empty parallel states will never be taken, as illustrated by the test.
* kill QStateMachine::states() and QState::transitions()Kent Hansen2009-04-291-14/+16
| | | | Result of API review. Don't need them (for now).
* kill source/target-specific animationsKent Hansen2009-04-291-80/+85
| | | | | Result of API review. We don't have use cases for them yet. We can add them back if valid use cases do turn up.
* rename QBoundEvent to QWrappedEvent and make it publicKent Hansen2009-04-291-1/+1
| | | | Result of API review.