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