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