source: trunk/quest-core-tasktrees-test/src/test/java/de/ugoe/cs/quest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java @ 445

Last change on this file since 445 was 445, checked in by pharms, 12 years ago

Initial import.

File size: 6.7 KB
Line 
1//-------------------------------------------------------------------------------------------------
2// Module    : $RCSfile: DefaultIterationDetectionRuleTest.java,v $
3// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 28.04.2012 $
4// Project   : TaskTreeTemporalRelationship
5// Creation  : 2012 by patrick
6// Copyright : Patrick Harms, 2012
7//-------------------------------------------------------------------------------------------------
8package de.ugoe.cs.quest.tasktrees.temporalrelation;
9
10import org.junit.Test;
11
12import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement;
13import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction;
14import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker;
15import de.ugoe.cs.tasktree.guimodel.GUIElement;
16import de.ugoe.cs.tasktree.guimodel.TrackBar;
17import de.ugoe.cs.tasktree.userinteraction.ValueSelection;
18
19//-------------------------------------------------------------------------------------------------
20/**
21 * TODO comment
22 *
23 * @version $Revision: $ $Date: 28.04.2012$
24 * @author 2012, last modified by $Author: patrick$
25 */
26//-------------------------------------------------------------------------------------------------
27public class TrackBarSelectionDetectionRuleTest extends AbstractTemporalRelationshipTC
28{
29
30  //-----------------------------------------------------------------------------------------------
31  /**
32   *
33   */
34  //-----------------------------------------------------------------------------------------------
35  @Test
36  public void testSimpleDetection() throws Exception
37  {
38    GUIElement element1 = new DummyTrackBar();
39    simulateInteraction(element1, new ValueSelection<Integer>(1));
40    new TaskTreeChecker().assertTaskMap
41      ("Sequence sequence1 {" +
42       "  Iteration interation1 {" +
43       "    Selection selection1 {" +
44       "      Interaction ValueSelection {}" +
45       "    }" +
46       "  }" +
47       "}", getTaskTree().getTaskMap());   
48
49    simulateInteraction(element1, new ValueSelection<Integer>(2));
50    new TaskTreeChecker().assertTaskMap
51      ("Sequence sequence1 {" +
52       "  Iteration interation1 {" +
53       "    Selection selection1 {" +
54       "      Interaction ValueSelection {}" +
55       "      Interaction ValueSelection {}" +
56       "    }" +
57       "  }" +
58       "}", getTaskTree().getTaskMap());   
59
60    simulateInteraction(element1, new ValueSelection<Integer>(3));
61    new TaskTreeChecker().assertTaskMap
62      ("Sequence sequence1 {" +
63       "  Iteration interation1 {" +
64       "    Selection selection1 {" +
65       "      Interaction ValueSelection {}" +
66       "      Interaction ValueSelection {}" +
67       "      Interaction ValueSelection {}" +
68       "    }" +
69       "  }" +
70       "}", getTaskTree().getTaskMap());   
71
72    simulateInteraction(element1, new ValueSelection<Integer>(2));
73    new TaskTreeChecker().assertTaskMap
74      ("Sequence sequence1 {" +
75       "  Iteration interation1 {" +
76       "    Selection selection1 {" +
77       "      Interaction ValueSelection {}" +
78       "      Interaction ValueSelection {}" +
79       "      Interaction ValueSelection {}" +
80       "    }" +
81       "  }" +
82       "}", getTaskTree().getTaskMap());   
83
84    simulateInteraction(element1, new ValueSelection<Integer>(3));
85    new TaskTreeChecker().assertTaskMap
86      ("Sequence sequence1 {" +
87       "  Iteration interation1 {" +
88       "    Selection selection1 {" +
89       "      Interaction ValueSelection {}" +
90       "      Interaction ValueSelection {}" +
91       "      Interaction ValueSelection {}" +
92       "    }" +
93       "  }" +
94       "}", getTaskTree().getTaskMap());
95
96  }
97 
98  //-----------------------------------------------------------------------------------------------
99  /**
100   *
101   */
102  //-----------------------------------------------------------------------------------------------
103  @Test
104  public void testComplexDetection() throws Exception
105  {
106    GUIElement element1 = new DummyTrackBar();
107    simulateInteraction(element1, new ValueSelection<Integer>(1));
108    simulateInteraction(element1, new ValueSelection<Integer>(2));
109    simulateInteraction(element1, new ValueSelection<Integer>(3));
110    simulateInteraction(element1, new ValueSelection<Integer>(1));
111    simulateInteraction(element1, new DummyInteraction("bla", 1));
112    simulateInteraction(element1, new DummyInteraction("bla", 2));
113    simulateInteraction(element1, new ValueSelection<Integer>(2));
114    simulateInteraction(element1, new ValueSelection<Integer>(1));
115    simulateInteraction(element1, new DummyInteraction("bla", 3));
116    simulateInteraction(element1, new ValueSelection<Integer>(3));
117    simulateInteraction(element1, new ValueSelection<Integer>(2));
118    simulateInteraction(element1, new ValueSelection<Integer>(3));
119    simulateInteraction(element1, new DummyInteraction("bla", 1));
120    simulateInteraction(element1, new DummyInteraction("bla", 2));
121    simulateInteraction(element1, new ValueSelection<Integer>(1));
122    simulateInteraction(element1, new ValueSelection<Integer>(1));
123   
124    new TaskTreeChecker().assertTaskMap
125      ("Sequence sequence1 {" +
126       "  Iteration interation1 {" +
127       "    Selection selection1 {" +
128       "      Interaction ValueSelection {}" +
129       "      Interaction ValueSelection {}" +
130       "      Interaction ValueSelection {}" +
131       "    }" +
132       "  }" +
133       "  Interaction bla {}" +
134       "  Interaction bla {}" +
135       "  Iteration interation2 {" +
136       "    Selection selection2 {" +
137       "      Interaction ValueSelection {}" +
138       "      Interaction ValueSelection {}" +
139       "    }" +
140       "  }" +
141       "  Interaction bla {}" +
142       "  Iteration interation3 {" +
143       "    Selection selection3 {" +
144       "      Interaction ValueSelection {}" +
145       "      Interaction ValueSelection {}" +
146       "    }" +
147       "  }" +
148       "  Interaction bla {}" +
149       "  Interaction bla {}" +
150       "  Iteration interation4 {" +
151       "    Selection selection4 {" +
152       "      Interaction ValueSelection {}" +
153       "    }" +
154       "  }" +
155       "}", getTaskTree().getTaskMap());   
156  }
157 
158  //-----------------------------------------------------------------------------------------------
159  /**
160   * TODO comment
161   *
162   * @version $Revision: $ $Date: 28.04.2012$
163   * @author 2012, last modified by $Author: patrick$
164   */
165  //-----------------------------------------------------------------------------------------------
166  public class DummyTrackBar extends DummyGUIElement implements TrackBar
167  {
168
169    //---------------------------------------------------------------------------------------------
170    /**
171     *
172     */
173    //---------------------------------------------------------------------------------------------
174    public DummyTrackBar()
175    {
176      super("DummyTrackBar");
177    }
178  }
179
180}
Note: See TracBrowser for help on using the repository browser.