h1(#Test2). Yakindu SCT Testcase 12 - Refactor |_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status| | 12.1 | Group states into composite | Select all states.
Right click on a state, then select *Refactor → Group States Into Composite*.
Rename the new composite state to *LightSwitch*.
| No errors occur. The states are wrapped in a compostite state named *LightSwitch*. | %{color:red}open% | | 12.1.1 | Simulate | Run simulation. | The behavior of the refactored model is equivalent to its behavior before refactoring. The composite state *LightSwitch* is highlighted in red (active). | %{color:red}open% | | 12.2 | Extract subdiagram | Select composite state *LightSwitch*.Right click, then select *Refactor → Extract Subdiagram*.
Hover over the subdiagram decorator in the lower right corner of the *LightSwitch* state.
Click on the subdiagram decorator.
| No errors occur.Subdiagram extraction leads to a normal-looking *LightSwitch* state, but with a subdiagram decorator in the lower left of state's box.
Hovering over that decorator shows a preview image of the subdiagram.
Clicking the decorator opens the subdiagram in a new editor tab.
| %{color:red}open% | | 12.3 | Undo & Redo extract subdiagram | Undo extraction by Strg+ZRedo extraction by Strg+Y| The sub diagram extraction should be reverted after Strg+Z and applied properly again after Strg+Y| %{color:red}open% | | 12.2.1 | Copy with subdiagram | Select composite state *LightSwitch* and copy it (Ctrl+C or Cmd+C).
Select the main region and paste the copied state (Ctrl+V or Cmd+V).
Hover over the subdiagram decorator in the lower right corner of the *Copy_1_LightSwitch* state.
Click on the subdiagram decorator.
| The copy state's name is *Copy_1_LightSwitch*.Hovering over that decorator shows a preview image of the subdiagram.
Clicking the decorator opens the subdiagram in a new editor tab.
| %{color:red}open% | | 12.2.2 | Delete copy | Delete previously created copy *Copy_1_LightSwitch* and save the model | No errors occur. | %{color:red}open% | | 12.2.3 | Simulate | Run simulation. | The behavior of the refactored model is equivalent to its behavior before refactoring. The state *LightSwitch* state is highlighted in red. Transitions between *LightOff* and *LightOn* can be observed in the new editor tab mentioned in T12.2. | %{color:red}open% | | 12.3 | Inline subdiagram | Select the *LightSwitch* state.Right click, then select *Refactor → Inline Subdiagram*.
| See T12.1. | %{color:red}open% | | 12.3.1 | Simulate | Run simulation | Behavior should be the same as before re-factoring | %{color:red}open% | | 12.4 | Prepare statechart | - Delete the transition from LightOn to LightOff and the state behavior of both states- make a new transition from LightOff to LigtOn
- Enter event A.keypress/light = true as trigger and action for both transitions | A new transition with trigger and action keypress/light = true is created. The other transition has keypress/light = true as trigger and action | %{color:red}open% | | 12.5| Fold Incoming Actions | Select LightOn state
Right click on the state
Select Refactoring -> Fold Incoming Actions | the action is shown in in the state LightOn and only the trigger is shown in the transitions | %{color:red}open% | | 12.6| Unfold Entry Actions | Select LightOn state
Right click on the state
Select Refactoring -> Unfold Entry Actions | the action is shown behind the trigger again | %{color:red}open% | | 12.7| Fold Outgoing Actions | Select LightOff state
Right click on the state
Select Refactoring -> Fold Outgoing Actions | the action is shown in in the state LightOff and only the trigger is shown in the transitions | %{color:red}open% | | 12.8| Unfold Exit Actions | Select LightOFF state
Right click on the state
Select Refactoring -> Unfold Exit Actions | the action is shown behind the trigger again | %{color:red}open% | | 12.9 | Rename | Selcet light in the Statechart Specification Element
right click on it
Refactoring -> Rename to "lamp" | all variables of "light" should changed to "lamp" | %{color:red}open% | | 12.10 | Disabled Menu Item | change the action of a Transition to " /lamp = true " and the other one to " /lamp = false"
Select LightOn state
Right click on the state
Refactoring | Fold Incoming Action should be disabled | %{color:red}open% | | 12.11 | Disabled Menu Item | Select LightOff state
Right click on the state
Refactoring | Fold Outgoing Action should be disabled | %{color:red}open% | | 12.12 | Toggle alignment | Create a new statechart model.
Delete the state that has been created.
Add an orthogonal state (see the palette on the right).
Ignore any errors.
Right-click on the state and select *Toggle Subregion Alignment* in the shown context menu.
Repeat the last action.
| An orthogonal state without a name is added to the statechart.Its subregions *r1* and *r2* are horizontally aligned.
Toggling the subregion alignment toggles between horizontal and vertical alignment of the subregions.
| %{color:red}open% |