[927] | 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 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
|
---|
[800] | 16 |
|
---|
| 17 | import org.junit.Test;
|
---|
| 18 |
|
---|
[922] | 19 | import de.ugoe.cs.autoquest.eventcore.IEventTarget;
|
---|
| 20 | import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker;
|
---|
| 21 | import de.ugoe.cs.autoquest.test.DummyGUIElement;
|
---|
| 22 | import de.ugoe.cs.autoquest.test.DummyInteraction;
|
---|
[800] | 23 |
|
---|
| 24 | /**
|
---|
| 25 | * TODO comment
|
---|
| 26 | *
|
---|
| 27 | * @version $Revision: $ $Date: $
|
---|
| 28 | * @author 2011, last modified by $Author: $
|
---|
| 29 | */
|
---|
| 30 | public class DefaultGuiElementSequenceDetectionRuleTest extends AbstractTemporalRelationshipTC {
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | *
|
---|
| 34 | */
|
---|
| 35 | @Test
|
---|
| 36 | public void testOneInteractionOnOneElement() {
|
---|
| 37 | simulateEvent(new DummyInteraction("bla", 1), new DummyGUIElement("elem1"));
|
---|
| 38 |
|
---|
| 39 | new TaskTreeChecker().assertTaskTree
|
---|
| 40 | ("Sequence sequence {" +
|
---|
| 41 | " Event bla {}" +
|
---|
| 42 | "}", getTaskTree());
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | *
|
---|
| 47 | */
|
---|
| 48 | @Test
|
---|
| 49 | public void testManyInteractionsOnOneElement() {
|
---|
| 50 | IEventTarget eventTarget = new DummyGUIElement("elem1");
|
---|
| 51 | simulateEvent(new DummyInteraction("bla", 1), eventTarget);
|
---|
| 52 | simulateEvent(new DummyInteraction("bli", 1), eventTarget);
|
---|
| 53 | simulateEvent(new DummyInteraction("blo", 1), eventTarget);
|
---|
| 54 | simulateEvent(new DummyInteraction("blu", 1), eventTarget);
|
---|
| 55 | simulateEvent(new DummyInteraction("bla", 1), eventTarget);
|
---|
| 56 |
|
---|
| 57 | new TaskTreeChecker().assertTaskTree
|
---|
| 58 | ("Sequence sequence {" +
|
---|
| 59 | " Event bla {}" +
|
---|
| 60 | " Event bli {}" +
|
---|
| 61 | " Event blo {}" +
|
---|
| 62 | " Event blu {}" +
|
---|
| 63 | " Event bla {}" +
|
---|
[1106] | 64 | "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null));
|
---|
[800] | 65 | }
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | *
|
---|
| 69 | */
|
---|
| 70 | @Test
|
---|
| 71 | public void testOneInteractionOnManyElements() {
|
---|
| 72 | IEventTarget eventTarget1 = new DummyGUIElement("elem1");
|
---|
| 73 | IEventTarget eventTarget2 = new DummyGUIElement("elem2");
|
---|
| 74 | IEventTarget eventTarget3 = new DummyGUIElement("elem3");
|
---|
| 75 | IEventTarget eventTarget4 = new DummyGUIElement("elem4");
|
---|
| 76 | IEventTarget eventTarget5 = new DummyGUIElement("elem5");
|
---|
| 77 | IEventTarget eventTarget6 = new DummyGUIElement("elem6");
|
---|
| 78 | simulateEvent(new DummyInteraction("bla", 1), eventTarget1);
|
---|
| 79 | simulateEvent(new DummyInteraction("bli", 1), eventTarget2);
|
---|
| 80 | simulateEvent(new DummyInteraction("bla", 1), eventTarget3);
|
---|
| 81 | simulateEvent(new DummyInteraction("bli", 1), eventTarget4);
|
---|
| 82 | simulateEvent(new DummyInteraction("blo", 1), eventTarget5);
|
---|
| 83 | simulateEvent(new DummyInteraction("bla", 1), eventTarget6);
|
---|
| 84 |
|
---|
| 85 | new TaskTreeChecker().assertTaskTree
|
---|
| 86 | ("Sequence sequence0 {" +
|
---|
| 87 | " Sequence sequence1 {" +
|
---|
| 88 | " Event bla {}" +
|
---|
| 89 | " }" +
|
---|
| 90 | " Sequence sequence2 {" +
|
---|
| 91 | " Event bli {}" +
|
---|
| 92 | " }" +
|
---|
| 93 | " Sequence sequence3 {" +
|
---|
| 94 | " Event bla {}" +
|
---|
| 95 | " }" +
|
---|
| 96 | " Sequence sequence4 {" +
|
---|
| 97 | " Event bli {}" +
|
---|
| 98 | " }" +
|
---|
| 99 | " Sequence sequence5 {" +
|
---|
| 100 | " Event blo {}" +
|
---|
| 101 | " }" +
|
---|
| 102 | " Sequence sequence6 {" +
|
---|
| 103 | " Event bla {}" +
|
---|
| 104 | " }" +
|
---|
[1106] | 105 | "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null));
|
---|
[800] | 106 | }
|
---|
| 107 |
|
---|
| 108 | /**
|
---|
| 109 | *
|
---|
| 110 | */
|
---|
| 111 | @Test
|
---|
| 112 | public void testManyInteractionsOnManyElementsWithoutHierarchy() {
|
---|
| 113 | IEventTarget eventTarget1 = new DummyGUIElement("elem1");
|
---|
| 114 | IEventTarget eventTarget2 = new DummyGUIElement("elem2");
|
---|
| 115 | IEventTarget eventTarget3 = new DummyGUIElement("elem3");
|
---|
| 116 | IEventTarget eventTarget4 = new DummyGUIElement("elem4");
|
---|
| 117 | IEventTarget eventTarget5 = new DummyGUIElement("elem5");
|
---|
| 118 | IEventTarget eventTarget6 = new DummyGUIElement("elem6");
|
---|
| 119 | simulateEvent(new DummyInteraction("bla", 1), eventTarget1);
|
---|
| 120 | simulateEvent(new DummyInteraction("bli", 1), eventTarget1);
|
---|
| 121 | simulateEvent(new DummyInteraction("bla", 1), eventTarget1);
|
---|
| 122 | simulateEvent(new DummyInteraction("bli", 1), eventTarget2);
|
---|
| 123 | simulateEvent(new DummyInteraction("blo", 1), eventTarget2);
|
---|
| 124 | simulateEvent(new DummyInteraction("bla", 1), eventTarget3);
|
---|
| 125 | simulateEvent(new DummyInteraction("bli", 1), eventTarget4);
|
---|
| 126 | simulateEvent(new DummyInteraction("bla", 1), eventTarget4);
|
---|
| 127 | simulateEvent(new DummyInteraction("bli", 1), eventTarget4);
|
---|
| 128 | simulateEvent(new DummyInteraction("blo", 1), eventTarget4);
|
---|
| 129 | simulateEvent(new DummyInteraction("bla", 1), eventTarget5);
|
---|
| 130 | simulateEvent(new DummyInteraction("bli", 1), eventTarget6);
|
---|
| 131 | simulateEvent(new DummyInteraction("bla", 1), eventTarget6);
|
---|
| 132 | simulateEvent(new DummyInteraction("bli", 1), eventTarget6);
|
---|
| 133 | simulateEvent(new DummyInteraction("blo", 1), eventTarget6);
|
---|
| 134 |
|
---|
| 135 | new TaskTreeChecker().assertTaskTree
|
---|
| 136 | ("Sequence sequence0 {" +
|
---|
| 137 | " Sequence sequence1 {" +
|
---|
| 138 | " Event bla {}" +
|
---|
| 139 | " Event bli {}" +
|
---|
| 140 | " Event bla {}" +
|
---|
| 141 | " }" +
|
---|
| 142 | " Sequence sequence2 {" +
|
---|
| 143 | " Event bli {}" +
|
---|
| 144 | " Event blo {}" +
|
---|
| 145 | " }" +
|
---|
| 146 | " Sequence sequence3 {" +
|
---|
| 147 | " Event bla {}" +
|
---|
| 148 | " }" +
|
---|
| 149 | " Sequence sequence4 {" +
|
---|
| 150 | " Event bli {}" +
|
---|
| 151 | " Event bla {}" +
|
---|
| 152 | " Event bli {}" +
|
---|
| 153 | " Event blo {}" +
|
---|
| 154 | " }" +
|
---|
| 155 | " Sequence sequence5 {" +
|
---|
| 156 | " Event bla {}" +
|
---|
| 157 | " }" +
|
---|
| 158 | " Sequence sequence6 {" +
|
---|
| 159 | " Event bli {}" +
|
---|
| 160 | " Event bla {}" +
|
---|
| 161 | " Event bli {}" +
|
---|
| 162 | " Event blo {}" +
|
---|
| 163 | " }" +
|
---|
[1106] | 164 | "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null));
|
---|
[800] | 165 | }
|
---|
| 166 |
|
---|
| 167 | /**
|
---|
| 168 | *
|
---|
| 169 | */
|
---|
| 170 | @Test
|
---|
| 171 | public void testManyInteractionsOnManyElementsWithHierarchy() {
|
---|
| 172 | DummyGUIElement parentA = new DummyGUIElement("A");
|
---|
| 173 | DummyGUIElement parentB = new DummyGUIElement("B", parentA);
|
---|
| 174 | DummyGUIElement parentC = new DummyGUIElement("C", parentB);
|
---|
| 175 | DummyGUIElement parentF = new DummyGUIElement("F", parentB);
|
---|
| 176 | DummyGUIElement parentH = new DummyGUIElement("H", parentA);
|
---|
| 177 | DummyGUIElement parentI = new DummyGUIElement("I", parentH);
|
---|
| 178 |
|
---|
| 179 | DummyGUIElement eventTargetD = new DummyGUIElement("D", parentC);
|
---|
| 180 | DummyGUIElement eventTargetE = new DummyGUIElement("E", parentC);
|
---|
| 181 | DummyGUIElement eventTargetG = new DummyGUIElement("G", parentF);
|
---|
| 182 | DummyGUIElement eventTargetJ = new DummyGUIElement("J", parentI);
|
---|
| 183 |
|
---|
| 184 | simulateEvent(new DummyInteraction("1", 1), eventTargetD);
|
---|
| 185 | simulateEvent(new DummyInteraction("2", 1), eventTargetD);
|
---|
| 186 | simulateEvent(new DummyInteraction("3", 1), eventTargetE);
|
---|
| 187 | simulateEvent(new DummyInteraction("4", 1), eventTargetD);
|
---|
| 188 | simulateEvent(new DummyInteraction("5", 1), eventTargetG);
|
---|
| 189 | simulateEvent(new DummyInteraction("6", 1), eventTargetG);
|
---|
| 190 | simulateEvent(new DummyInteraction("7", 1), eventTargetD);
|
---|
| 191 | simulateEvent(new DummyInteraction("8", 1), eventTargetJ);
|
---|
| 192 | simulateEvent(new DummyInteraction("9", 1), eventTargetG);
|
---|
| 193 |
|
---|
[1106] | 194 | new TaskTreeChecker().assertTaskTree
|
---|
[800] | 195 | ("Sequence sequence0 {" +
|
---|
| 196 | " Sequence sequence1 {" +
|
---|
| 197 | " Sequence sequence2 {" +
|
---|
| 198 | " Sequence sequence3 {" +
|
---|
| 199 | " Event 1 {}" +
|
---|
| 200 | " Event 2 {}" +
|
---|
| 201 | " }" +
|
---|
| 202 | " Sequence sequence4 {" +
|
---|
| 203 | " Event 3 {}" +
|
---|
| 204 | " }" +
|
---|
| 205 | " Sequence sequence5 {" +
|
---|
| 206 | " Event 4 {}" +
|
---|
| 207 | " }" +
|
---|
| 208 | " }" +
|
---|
| 209 | " Sequence sequence6 {" +
|
---|
[987] | 210 | " Sequence sequence7 {" +
|
---|
| 211 | " Event 5 {}" +
|
---|
| 212 | " Event 6 {}" +
|
---|
| 213 | " }" +
|
---|
[800] | 214 | " }" +
|
---|
[987] | 215 | " Sequence sequence8 {" +
|
---|
| 216 | " Sequence sequence9 {" +
|
---|
| 217 | " Event 7 {}" +
|
---|
| 218 | " }" +
|
---|
[800] | 219 | " }" +
|
---|
| 220 | " }" +
|
---|
[987] | 221 | " Sequence sequence10 {" +
|
---|
| 222 | " Sequence sequence11 {" +
|
---|
| 223 | " Sequence sequence12 {" +
|
---|
| 224 | " Event 8 {}" +
|
---|
| 225 | " }" +
|
---|
| 226 | " }" +
|
---|
[800] | 227 | " }" +
|
---|
[987] | 228 | " Sequence sequence13 {" +
|
---|
| 229 | " Sequence sequence14 {" +
|
---|
| 230 | " Sequence sequence15 {" +
|
---|
| 231 | " Event 9 {}" +
|
---|
| 232 | " }" +
|
---|
| 233 | " }" +
|
---|
[800] | 234 | " }" +
|
---|
[1106] | 235 | "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null));
|
---|
[800] | 236 | }
|
---|
| 237 |
|
---|
| 238 | }
|
---|