Changeset 1333 for trunk/autoquest-test-utils/src/test/java/de
- Timestamp:
- 01/24/14 13:48:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-test-utils/src/test/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoderTest.java
r1327 r1333 20 20 21 21 import de.ugoe.cs.autoquest.eventcore.Event; 22 import de.ugoe.cs.autoquest.eventcore.gui.Scroll; 22 23 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 23 24 import de.ugoe.cs.autoquest.eventcore.guimodel.ITextArea; … … 249 250 */ 250 251 @Test 252 public void test_Scroll_01() { 253 String blub = 254 "UserSession {" + 255 " Scroll body1 { }" + 256 "}"; 257 258 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 259 260 ITaskInstanceList list = decoder.decode(blub); 261 262 assertTrue(list.get(0) instanceof IEventTaskInstance); 263 assertTrue(list.get(0).getTask() instanceof IEventTask); 264 265 assertTrue(((IEventTaskInstance) list.get(0)).getEvent().getType() instanceof Scroll); 266 267 new TaskTreeValidator().validate(list); 268 } 269 270 /** 271 * 272 */ 273 @Test 274 public void test_Scroll_02() { 275 String blub = 276 "UserSession {" + 277 " Scroll body1 { }" + 278 " Scroll body2 { }" + 279 "}"; 280 281 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 282 283 ITaskInstanceList list = decoder.decode(blub); 284 285 assertTrue(list.get(0) instanceof IEventTaskInstance); 286 assertTrue(list.get(0).getTask() instanceof IEventTask); 287 assertTrue(((IEventTaskInstance) list.get(0)).getEvent().getType() instanceof Scroll); 288 289 assertTrue(list.get(1) instanceof IEventTaskInstance); 290 assertTrue(list.get(1).getTask() instanceof IEventTask); 291 assertTrue(((IEventTaskInstance) list.get(1)).getEvent().getType() instanceof Scroll); 292 293 assertFalse(list.get(0).equals(list.get(1))); 294 assertFalse(list.get(0).getTask().equals(list.get(1).getTask())); 295 296 new TaskTreeValidator().validate(list); 297 } 298 299 /** 300 * 301 */ 302 @Test 303 public void test_Scroll_03() { 304 String blub = 305 "UserSession {" + 306 " Scroll body1 { }" + 307 " Scroll body1 { }" + 308 "}"; 309 310 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 311 312 ITaskInstanceList list = decoder.decode(blub); 313 314 assertTrue(list.get(0) instanceof IEventTaskInstance); 315 assertTrue(list.get(0).getTask() instanceof IEventTask); 316 assertTrue(((IEventTaskInstance) list.get(0)).getEvent().getType() instanceof Scroll); 317 318 assertTrue(list.get(1) instanceof IEventTaskInstance); 319 assertTrue(list.get(1).getTask() instanceof IEventTask); 320 assertTrue(((IEventTaskInstance) list.get(1)).getEvent().getType() instanceof Scroll); 321 322 assertFalse(list.get(0).equals(list.get(1))); 323 assertTrue(list.get(0).getTask().equals(list.get(1).getTask())); 324 325 new TaskTreeValidator().validate(list); 326 } 327 328 /** 329 * 330 */ 331 @Test 332 public void test_Scroll_04() { 333 String blub = 334 "UserSession {" + 335 " Scroll body1 (1 2) { }" + 336 "}"; 337 338 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 339 340 ITaskInstanceList list = decoder.decode(blub); 341 342 assertTrue(list.get(0) instanceof IEventTaskInstance); 343 assertTrue(list.get(0).getTask() instanceof IEventTask); 344 345 assertTrue(((IEventTaskInstance) list.get(0)).getEvent().getType() instanceof Scroll); 346 347 Scroll scroll = (Scroll) ((IEventTaskInstance) list.get(0)).getEvent().getType(); 348 349 assertEquals(1, scroll.getXPosition()); 350 assertEquals(2, scroll.getYPosition()); 351 352 new TaskTreeValidator().validate(list); 353 } 354 355 /** 356 * 357 */ 358 @Test 251 359 public void test_GuiElements_01() { 252 360 String blub = … … 1054 1162 decoder.decode(blub); 1055 1163 } 1164 1165 /** 1166 * 1167 */ 1168 @Test 1169 public void test_Optional_07() { 1170 String blub = 1171 "UserSession {" + 1172 " Optional op1 {" + 1173 " MouseClick c1 { }" + 1174 " }" + 1175 " Optional op1 { }" + 1176 "}"; 1177 1178 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 1179 1180 ITaskInstanceList list = decoder.decode(blub); 1181 1182 assertTrue(list.get(0) instanceof IOptionalInstance); 1183 assertNotNull(((IOptionalInstance) list.get(0)).getChild()); 1184 assertTrue(((IOptionalInstance) list.get(0)).getChild() instanceof IEventTaskInstance); 1185 1186 assertTrue(list.get(0).getTask() instanceof IOptional); 1187 assertNotNull(((IOptional) list.get(0).getTask()).getMarkedTask()); 1188 assertTrue(((IOptional) list.get(0).getTask()).getMarkedTask() instanceof IEventTask); 1189 1190 assertTrue(list.get(1) instanceof IOptionalInstance); 1191 assertNull(((IOptionalInstance) list.get(1)).getChild()); 1192 1193 assertTrue(list.get(1).getTask() instanceof IOptional); 1194 assertNotNull(((IOptional) list.get(1).getTask()).getMarkedTask()); 1195 assertTrue(((IOptional) list.get(1).getTask()).getMarkedTask() instanceof IEventTask); 1196 1197 assertFalse(list.get(0).equals(list.get(1))); 1198 assertTrue(list.get(0).getTask().equals(list.get(1).getTask())); 1199 1200 new TaskTreeValidator().validate(list); 1201 } 1202 1203 /** 1204 * 1205 */ 1206 @Test 1207 public void test_Optional_08() { 1208 String blub = 1209 "UserSession {" + 1210 " Optional op1 { }" + 1211 " Optional op1 {" + 1212 " MouseClick c1 { }" + 1213 " }" + 1214 "}"; 1215 1216 TaskTreeDecoder decoder = new TaskTreeDecoder(new TaskFactory(), new TaskBuilder()); 1217 1218 ITaskInstanceList list = decoder.decode(blub); 1219 1220 assertTrue(list.get(0) instanceof IOptionalInstance); 1221 assertNull(((IOptionalInstance) list.get(0)).getChild()); 1222 1223 assertTrue(list.get(0).getTask() instanceof IOptional); 1224 assertNotNull(((IOptional) list.get(0).getTask()).getMarkedTask()); 1225 assertTrue(((IOptional) list.get(0).getTask()).getMarkedTask() instanceof IEventTask); 1226 1227 assertTrue(list.get(1) instanceof IOptionalInstance); 1228 assertNotNull(((IOptionalInstance) list.get(1)).getChild()); 1229 assertTrue(((IOptionalInstance) list.get(1)).getChild() instanceof IEventTaskInstance); 1230 1231 assertTrue(list.get(1).getTask() instanceof IOptional); 1232 assertNotNull(((IOptional) list.get(1).getTask()).getMarkedTask()); 1233 assertTrue(((IOptional) list.get(1).getTask()).getMarkedTask() instanceof IEventTask); 1234 1235 assertFalse(list.get(0).equals(list.get(1))); 1236 assertTrue(list.get(0).getTask().equals(list.get(1).getTask())); 1237 1238 new TaskTreeValidator().validate(list); 1239 } 1056 1240 }
Note: See TracChangeset
for help on using the changeset viewer.