Changeset 1815
- Timestamp:
- 11/07/14 12:55:16 (10 years ago)
- Location:
- trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/AndroidLogParser.java
r1803 r1815 39 39 40 40 import de.ugoe.cs.autoquest.eventcore.Event; 41 import de.ugoe.cs.autoquest.eventcore.gui.CharacterTyped; 41 42 import de.ugoe.cs.autoquest.eventcore.gui.IInteraction; 42 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonInteraction; 43 import de.ugoe.cs.autoquest.eventcore.gui.MouseClick; 43 import de.ugoe.cs.autoquest.eventcore.gui.TouchSingle; 44 44 import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree; 45 45 import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel; … … 53 53 * <p> 54 54 * This class provides functionality to parse XML log files generated by the 55 * AndroidMonitor of autoquest. The result of parsing a file is a collection of55 * AndroidMonitor of AutoQUEST. The result of parsing a file is a collection of 56 56 * event sequences. 57 57 * </p> … … 136 136 */ 137 137 private List<Event> currentSequence; 138 139 138 139 /** 140 * <p> 141 * internal handle to the class ancestors 142 * </p> 143 */ 144 private List<String> currentTypeHierarchy; 140 145 141 146 /** … … 332 337 } 333 338 } 334 335 // TODO add hierarchy information if available -> Up to know gathering 336 // this information leads to an out of memory exception in the 337 // androidmonitor @see: AndroidmonitorLogFile#addComponent 339 else if (qName.equals("ancestor")) { 340 currentTypeHierarchy.add(atts.getValue("name")); 341 } 342 else if (qName.equals("ancestors")) { 343 currentTypeHierarchy = new LinkedList<String>(); 344 } 338 345 } 339 346 … … 355 362 } 356 363 } 357 if (qName.equals("component") && currentGUIElementHash != null) { 364 else if (qName.equals("ancestors")) { 365 currentGUIElementSpec.setTypeHierarchy(currentTypeHierarchy); 366 } 367 else if (qName.equals("component") && currentGUIElementHash != null) { 358 368 try { 359 369 currentGUIElementTree.add(currentGUIElementHash, … … 367 377 currentGUIElementHash = null; 368 378 currentParentHash = null; 369 } else if (currentEventId != null && qName.equals("event")) { 379 currentTypeHierarchy = null; 380 } 381 else if (currentEventId != null && qName.equals("event")) { 370 382 371 383 IGUIElement currentGUIElement; … … 415 427 switch (event) { 416 428 case "onClick": 417 /* 418 * due to the reason that android uses float instead of integer it 419 * is necessary to parse the float values to integer values 420 * this is simply done by removing the dot 421 */ 422 423 int x = Integer.parseInt(currentEventParameters.get("X").replace(".", "")); 424 int y = Integer.parseInt(currentEventParameters.get("Y").replace(".", "")); 425 MouseButtonInteraction.Button button = null; 426 button = MouseButtonInteraction.Button.LEFT; 427 428 return new MouseClick(button, x, y); 429 429 430 float x = Float.parseFloat(currentEventParameters.get("X")); 431 float y = Float.parseFloat(currentEventParameters.get("Y")); 432 433 return new TouchSingle(x,y); 434 435 case "text": 436 return new CharacterTyped(currentEventParameters.get("message")); 437 430 438 default: 431 439 throw new SAXException("unhandled event id " + event); -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElementSpec.java
r1813 r1815 14 14 package de.ugoe.cs.autoquest.plugin.android.guimodel; 15 15 16 import java.util.List; 17 16 18 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec; 17 19 … … 36 38 /* 37 39 * (non-Javadoc) see 38 * de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorLogFile 40 * de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorLogFile#logComponent() 39 41 */ 40 42 /** … … 70 72 */ 71 73 private String type; 74 75 /** 76 * <p> 77 * Type hierarchy of the class itself 78 * </p> 79 */ 80 private List<String> typeHierarchy = null; 72 81 73 82 /* … … 90 99 @Override 91 100 public String[] getTypeHierarchy() { 92 return new String[] { (getType()) }; 93 // TODO change this part after adding ancestors in 94 // de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorLogFile#addComponent 101 if (typeHierarchy == null) { 102 return new String[] 103 { (getType()) }; 104 } 105 else 106 return typeHierarchy.toArray(new String[typeHierarchy.size()]); 95 107 } 96 108 … … 173 185 this.type = type; 174 186 } 187 188 /** 189 * <p> 190 * Sets the type hierarchy of the specified GUI element. 191 * 192 * @param typeHierarchy 193 * </p> 194 */ 195 public void setTypeHierarchy(List<String> typeHierarchy) { 196 this.typeHierarchy = typeHierarchy; 197 } 198 175 199 176 200 }
Note: See TracChangeset
for help on using the changeset viewer.