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

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
File size: 6.2 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
16
17import org.junit.Test;
18
19import de.ugoe.cs.autoquest.eventcore.gui.ValueSelection;
20import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
21import de.ugoe.cs.autoquest.eventcore.guimodel.ITrackBar;
22import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker;
23import de.ugoe.cs.autoquest.test.DummyGUIElement;
24import de.ugoe.cs.autoquest.test.DummyInteraction;
25
26/**
27 * TODO comment
28 *
29 * @version $Revision: $ $Date: 28.04.2012$
30 * @author 2012, last modified by $Author: patrick$
31 */
32public class TrackBarSelectionDetectionRuleTest extends AbstractTemporalRelationshipTC {
33
34    /**
35     *
36     */
37    @Test
38    public void testSimpleDetection() throws Exception {
39        IGUIElement element1 = new DummyTrackBar();
40        simulateEvent(new ValueSelection<Integer>(1), element1);
41        new TaskTreeChecker().assertTaskTree
42            ("Sequence sequence1 {" +
43             "  Iteration interation1 {" +
44             "    Selection selection1 {" +
45             "      Event ValueSelection {}" +
46             "    }" +
47             "  }" +
48             "}", getTaskTree());
49
50        simulateEvent(new ValueSelection<Integer>(2), element1);
51        new TaskTreeChecker().assertTaskTree
52            ("Sequence sequence1 {" +
53             "  Iteration interation1 {" +
54             "    Selection selection1 {" +
55             "      Event ValueSelection {}" +
56             "      Event ValueSelection {}" +
57             "    }" +
58             "  }" +
59             "}", getTaskTree());
60
61        simulateEvent(new ValueSelection<Integer>(3), element1);
62        new TaskTreeChecker().assertTaskTree
63            ("Sequence sequence1 {" +
64             "  Iteration interation1 {" +
65             "    Selection selection1 {" +
66             "      Event ValueSelection {}" +
67             "      Event ValueSelection {}" +
68             "      Event ValueSelection {}" +
69             "    }" +
70             "  }" +
71             "}", getTaskTree());
72
73        simulateEvent(new ValueSelection<Integer>(2), element1);
74        new TaskTreeChecker().assertTaskTree
75            ("Sequence sequence1 {" +
76             "  Iteration interation1 {" +
77             "    Selection selection1 {" +
78             "      Event ValueSelection {}" +
79             "      Event ValueSelection {}" +
80             "      Event ValueSelection {}" +
81             "    }" +
82             "  }" +
83             "}", getTaskTree());
84
85        simulateEvent(new ValueSelection<Integer>(3), element1);
86        new TaskTreeChecker().assertTaskTree
87            ("Sequence sequence1 {" +
88             "  Iteration interation1 {" +
89             "    Selection selection1 {" +
90             "      Event ValueSelection {}" +
91             "      Event ValueSelection {}" +
92             "      Event ValueSelection {}" +
93             "    }" +
94             "  }" +
95             "}", getTaskTree());
96
97    }
98
99    /**
100     *
101     */
102    @Test
103    public void testComplexDetection() throws Exception {
104        IGUIElement element1 = new DummyTrackBar();
105        simulateEvent(new ValueSelection<Integer>(1), element1);
106        simulateEvent(new ValueSelection<Integer>(2), element1);
107        simulateEvent(new ValueSelection<Integer>(3), element1);
108        simulateEvent(new ValueSelection<Integer>(1), element1);
109        simulateEvent(new DummyInteraction("bla", 1), element1);
110        simulateEvent(new DummyInteraction("bla", 2), element1);
111        simulateEvent(new ValueSelection<Integer>(2), element1);
112        simulateEvent(new ValueSelection<Integer>(1), element1);
113        simulateEvent(new DummyInteraction("bla", 3), element1);
114        simulateEvent(new ValueSelection<Integer>(3), element1);
115        simulateEvent(new ValueSelection<Integer>(2), element1);
116        simulateEvent(new ValueSelection<Integer>(3), element1);
117        simulateEvent(new DummyInteraction("bla", 1), element1);
118        simulateEvent(new DummyInteraction("bla", 2), element1);
119        simulateEvent(new ValueSelection<Integer>(1), element1);
120        simulateEvent(new ValueSelection<Integer>(1), element1);
121
122        new TaskTreeChecker().assertTaskTree
123            ("Sequence sequence1 {" +
124             "  Iteration interation1 {" +
125             "    Selection selection1 {" +
126             "      Event ValueSelection {}" +
127             "      Event ValueSelection {}" +
128             "      Event ValueSelection {}" +
129             "    }" +
130             "  }" +
131             "  Event bla {}" +
132             "  Event bla {}" +
133             "  Iteration interation2 {" +
134             "    Selection selection2 {" +
135             "      Event ValueSelection {}" +
136             "      Event ValueSelection {}" +
137             "    }" +
138             "  }" +
139             "  Event bla {}" +
140             "  Iteration interation3 {" +
141             "    Selection selection3 {" +
142             "      Event ValueSelection {}" +
143             "      Event ValueSelection {}" +
144             "    }" +
145             "  }" +
146             "  Event bla {}" +
147             "  Event bla {}" +
148             "  Iteration interation4 {" +
149             "    Selection selection4 {" +
150             "      Event ValueSelection {}" +
151             "    }" +
152             "  }" +
153             "}", getTaskTree());
154    }
155
156    /**
157     * TODO comment
158     *
159     * @version $Revision: $ $Date: 28.04.2012$
160     * @author 2012, last modified by $Author: patrick$
161     */
162    public class DummyTrackBar extends DummyGUIElement implements ITrackBar {
163
164        /**  */
165        private static final long serialVersionUID = 1L;
166
167         /**
168          *
169          */
170         public DummyTrackBar() {
171            super("DummyTrackBar");
172        }
173    }
174
175}
Note: See TracBrowser for help on using the repository browser.