h1(#Test2). Yakindu SCT Testcase 12 - Refactor

|_. Nr |_. Testname |_. Test Instructions |_. Postconditions |_. Status|
| 12.1 | Group states into composite | Select all states.<p>Right click on a state, then select *Refactor → Group States Into Composite*.</p><p>Rename the new composite state to *LightSwitch*.</p> | 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*.<p>Right click, then select *Refactor → Extract Subdiagram*.</p><p>Hover over the subdiagram decorator in the lower right corner of the *LightSwitch* state.</p><p>Click on the subdiagram decorator.</p> | No errors occur.<p>Subdiagram extraction leads to a normal-looking *LightSwitch* state, but with a subdiagram decorator in the lower left of state's box.</p><p>Hovering over that decorator shows a preview image of the subdiagram.</p><p>Clicking the decorator opens the subdiagram in a new editor tab.</p> | %{color:red}open% |
| 12.3 | Undo & Redo extract subdiagram | Undo extraction by Strg+Z <p> Redo 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). <p>Select the main region and paste the copied state (Ctrl+V or Cmd+V). </p><p>Hover over the subdiagram decorator in the lower right corner of the *Copy_1_LightSwitch* state.</p><p>Click on the subdiagram decorator.</p> | The copy state's name is *Copy_1_LightSwitch*. </p><p>Hovering over that decorator shows a preview image of the subdiagram.</p><p>Clicking the decorator opens the subdiagram in a new editor tab.</p> | %{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.<p>Right click, then select *Refactor → Inline Subdiagram*.</p> | 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 <p>- make a new transition from LightOff to LigtOn <p>- 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  <p> Right click on the state <p> 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  <p> Right click on the state <p> Select Refactoring -> Unfold Entry Actions | the action is shown behind the trigger again | %{color:red}open% |
| 12.7| Fold Outgoing Actions | Select LightOff state  <p> Right click on the state <p> 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  <p> Right click on the state <p> 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 <p> right click on it <p> 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" <p> Select LightOn state  <p> Right click on the state <p> Refactoring  | Fold Incoming Action should be disabled | %{color:red}open% |
| 12.11 | Disabled Menu Item | Select LightOff state  <p> Right click on the state <p> Refactoring  | Fold Outgoing Action should be disabled | %{color:red}open% |
| 12.12 | Toggle alignment | Create a new statechart model.<p>Delete the state that has been created.</p><p>Add an orthogonal state (see the palette on the right).</p><p>Ignore any errors.</p><p>Right-click on the state and select *Toggle Subregion Alignment* in the shown context menu.</p><p>Repeat the last action.</p> | An orthogonal state without a name is added to the statechart.<p>Its subregions *r1* and *r2* are horizontally aligned.</p><p>Toggling the subregion alignment toggles between horizontal and vertical alignment of the subregions.</p> | %{color:red}open% |



