- Timestamp:
- 09/07/12 15:21:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-jfc-test/src/test/java/de/ugoe/cs/quest/plugin/jfc/JFCReplayIDCalculatorTest.java
r675 r796 2 2 3 3 import java.io.File; 4 import java.util.ArrayList; 4 5 import java.util.Collection; 5 6 import java.util.HashSet; … … 13 14 14 15 import de.ugoe.cs.quest.eventcore.Event; 16 import de.ugoe.cs.quest.eventcore.IEventTarget; 15 17 import de.ugoe.cs.quest.plugin.jfc.eventcore.JFCEventId; 18 import de.ugoe.cs.quest.plugin.jfc.guimodel.JFCGUIElement; 19 import de.ugoe.cs.quest.plugin.jfc.guimodel.JFCGUIElementSpec; 16 20 17 21 /** … … 46 50 */ 47 51 @Test 48 public void testCalculateReplayID _1()52 public void testCalculateReplayIDwithEvent() 49 53 throws Exception { 50 54 Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>(); … … 57 61 58 62 String result = new JFCReplayIDCalculator().calculateReplayID(event); 63 assertEquals("e3561778462", result); 64 } 65 66 /** 67 * Run the String calculateReplayID(List<JFCGUIElementSpec>) method test. 68 * 69 * @throws Exception 70 */ 71 @Test 72 public void testCalculateReplayIDwithGuiElementPath() 73 throws Exception { 74 Collection<JFCEventId> ignoredEvents = new HashSet<JFCEventId>(); 75 ignoredEvents.add(JFCEventId.FOCUS_GAINED); 76 JFCLogParser parser = new JFCLogParser(ignoredEvents); 77 parser.parseFile(new File(ClassLoader.getSystemResource("freemind_trace.xml").getFile())); 78 79 Collection<List<Event>> sequences = parser.getSequences(); 80 Event event = sequences.iterator().next().get(0); 81 82 List<JFCGUIElementSpec> guiElementPath = new ArrayList<JFCGUIElementSpec>(); 83 84 IEventTarget target = event.getTarget(); 85 JFCGUIElement jfcTarget = (JFCGUIElement) target; 86 87 // extract element path 88 JFCGUIElement currentTarget = jfcTarget; 89 while (currentTarget != null){ 90 JFCGUIElementSpec currentSpec = (JFCGUIElementSpec) currentTarget.getSpecification(); 91 guiElementPath.add(0, currentSpec); 92 currentTarget = (JFCGUIElement) currentTarget.getParent(); 93 } 94 95 String result = new JFCReplayIDCalculator().calculateReplayID(guiElementPath); 59 96 assertEquals("e3561778462", result); 60 97 }
Note: See TracChangeset
for help on using the changeset viewer.