Changeset 1125 for trunk/autoquest-core-tasktrees-test
- Timestamp:
- 03/18/13 11:46:47 (12 years ago)
- Location:
- trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/EventTaskComparisonRuleTest.java
r927 r1125 24 24 import de.ugoe.cs.autoquest.tasktrees.nodeequality.EventTaskComparisonRule; 25 25 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;27 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 28 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; … … 39 38 */ 40 39 @Test 41 public void test() { 42 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 43 44 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 45 46 // test the identity check 47 IEventType eventType1 = new StringEventType("eventType1"); 48 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 49 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 50 51 assertEquals(NodeEquality.IDENTICAL, rule.compare(task1, task1)); 52 40 public void test_isApplicable_01() { 41 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 42 43 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 44 45 IEventType eventType1 = new StringEventType("eventType1"); 46 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 47 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 48 49 assertTrue(rule.isApplicable(task1, task1)); 50 } 51 52 /** 53 * 54 */ 55 @Test 56 public void test_isApplicable_02() { 57 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 58 59 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 60 61 IEventType eventType1 = new StringEventType("eventType1"); 62 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 63 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 64 65 IEventType eventType2 = new StringEventType("eventType2"); 66 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 67 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 68 69 assertTrue(rule.isApplicable(task1, task2)); 70 assertTrue(rule.isApplicable(task2, task1)); 71 } 72 73 /** 74 * 75 */ 76 @Test 77 public void test_isApplicable_03() { 78 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 79 80 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 81 82 IEventType eventType1 = new StringEventType("eventType1"); 83 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 84 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 85 86 ITaskTreeNode selection = treeNodeFactory.createNewSelection(); 87 88 assertFalse(rule.isApplicable(task1, selection)); 89 assertFalse(rule.isApplicable(selection, task1)); 90 } 91 92 /** 93 * 94 */ 95 @Test 96 public void test_isApplicable_04() { 97 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 98 99 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 100 101 IEventType eventType1 = new StringEventType("eventType1"); 102 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 103 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 104 105 ITaskTreeNode sequence = treeNodeFactory.createNewSequence(); 106 107 assertFalse(rule.isApplicable(task1, sequence)); 108 assertFalse(rule.isApplicable(sequence, task1)); 109 } 110 111 /** 112 * 113 */ 114 @Test 115 public void test_isApplicable_05() { 116 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 117 118 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 119 120 IEventType eventType1 = new StringEventType("eventType1"); 121 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 122 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 123 124 ITaskTreeNode iteration = treeNodeFactory.createNewIteration(); 125 126 assertFalse(rule.isApplicable(task1, iteration)); 127 assertFalse(rule.isApplicable(iteration, task1)); 128 } 129 130 /** 131 * 132 */ 133 @Test 134 public void test_isApplicable_06() { 135 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 136 137 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 138 139 IEventType eventType1 = new StringEventType("eventType1"); 140 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 141 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 142 143 ITaskTreeNode optional = treeNodeFactory.createNewOptional(); 144 145 assertFalse(rule.isApplicable(task1, optional)); 146 assertFalse(rule.isApplicable(optional, task1)); 147 } 148 149 /** 150 * 151 */ 152 @Test 153 public void test_compare_01() { 154 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 155 156 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 157 158 IEventType eventType1 = new StringEventType("eventType1"); 159 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 160 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 161 162 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task1)); 163 assertTrue(rule.areLexicallyEqual(task1, task1)); 164 assertTrue(rule.areSyntacticallyEqual(task1, task1)); 165 assertTrue(rule.areSemanticallyEqual(task1, task1)); 166 } 167 168 /** 169 * 170 */ 171 @Test 172 public void test_compare_02() { 173 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 174 175 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 176 177 IEventType eventType1 = new StringEventType("eventType1"); 178 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 179 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 180 53 181 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 54 182 55 183 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 184 assertTrue(rule.areLexicallyEqual(task1, task2)); 185 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 186 assertTrue(rule.areSemanticallyEqual(task1, task2)); 187 56 188 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 189 assertTrue(rule.areLexicallyEqual(task2, task1)); 190 assertTrue(rule.areSyntacticallyEqual(task2, task1)); 191 assertTrue(rule.areSemanticallyEqual(task2, task1)); 192 } 193 194 /** 195 * 196 */ 197 @Test 198 public void test_compare_03() { 199 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 200 201 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 202 203 IEventType eventType1 = new StringEventType("eventType1"); 204 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 205 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 57 206 58 207 IEventType eventType2 = new StringEventType("eventType2"); 59 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);208 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 60 209 61 210 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 211 assertFalse(rule.areLexicallyEqual(task1, task2)); 212 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 213 assertFalse(rule.areSemanticallyEqual(task1, task2)); 214 62 215 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 216 assertFalse(rule.areLexicallyEqual(task2, task1)); 217 assertFalse(rule.areSyntacticallyEqual(task2, task1)); 218 assertFalse(rule.areSemanticallyEqual(task2, task1)); 219 } 220 221 /** 222 * 223 */ 224 @Test 225 public void test_compare_04() { 226 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 227 228 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 229 230 IEventType eventType1 = new StringEventType("eventType1"); 231 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 232 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 63 233 64 234 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 65 task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2);235 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2); 66 236 67 237 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 238 assertFalse(rule.areLexicallyEqual(task1, task2)); 239 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 240 assertFalse(rule.areSemanticallyEqual(task1, task2)); 241 68 242 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 69 70 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 243 assertFalse(rule.areLexicallyEqual(task2, task1)); 244 assertFalse(rule.areSyntacticallyEqual(task2, task1)); 245 assertFalse(rule.areSemanticallyEqual(task2, task1)); 246 } 247 248 249 /** 250 * 251 */ 252 @Test 253 public void test_compare_05() { 254 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 255 256 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 257 258 IEventType eventType1 = new StringEventType("eventType1"); 259 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 260 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 261 262 IEventType eventType2 = new StringEventType("eventType2"); 263 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 264 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 71 265 72 266 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 267 assertFalse(rule.areLexicallyEqual(task1, task2)); 268 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 269 assertFalse(rule.areSemanticallyEqual(task1, task2)); 270 73 271 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 74 75 ISelection selection = treeNodeFactory.createNewSelection(); 76 assertNull(rule.compare(task1, selection)); 77 assertNull(rule.compare(selection, task1)); 78 assertNull(rule.compare(task2, selection)); 79 assertNull(rule.compare(selection, task2)); 272 assertFalse(rule.areLexicallyEqual(task2, task1)); 273 assertFalse(rule.areSyntacticallyEqual(task2, task1)); 274 assertFalse(rule.areSemanticallyEqual(task2, task1)); 80 275 } 81 276 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/GUIEventTaskComparisonRuleTest.java
r973 r1125 26 26 import de.ugoe.cs.autoquest.eventcore.IEventType; 27 27 import de.ugoe.cs.autoquest.eventcore.StringEventType; 28 import de.ugoe.cs.autoquest.eventcore.gui.KeyPressed; 29 import de.ugoe.cs.autoquest.eventcore.gui.KeyReleased; 30 import de.ugoe.cs.autoquest.eventcore.gui.KeyTyped; 28 31 import de.ugoe.cs.autoquest.eventcore.gui.KeyboardFocusChange; 32 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonDown; 33 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonInteraction; 34 import de.ugoe.cs.autoquest.eventcore.gui.MouseButtonUp; 35 import de.ugoe.cs.autoquest.eventcore.gui.MouseClick; 36 import de.ugoe.cs.autoquest.eventcore.gui.MouseDoubleClick; 37 import de.ugoe.cs.autoquest.eventcore.gui.MouseDragAndDrop; 38 import de.ugoe.cs.autoquest.eventcore.gui.Scroll; 29 39 import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 40 import de.ugoe.cs.autoquest.eventcore.gui.TextSelection; 30 41 import de.ugoe.cs.autoquest.eventcore.gui.ValueSelection; 42 import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; 31 43 import de.ugoe.cs.autoquest.tasktrees.nodeequality.GUIEventTaskComparisonRule; 32 44 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;34 45 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 35 46 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; … … 46 57 */ 47 58 @Test 48 public void test() { 49 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 50 51 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 52 53 // test the identity check 54 IEventType eventType1 = new StringEventType("blub"); 55 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 56 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 57 58 assertNull(rule.compare(task1, task1)); 59 60 eventType1 = new KeyboardFocusChange(); 61 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 62 63 assertEquals(NodeEquality.IDENTICAL, rule.compare(task1, task1)); 64 65 // test lexical equality for interaction events which are no value selections or text inputs 59 public void test_isApplicable_01() { 60 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 61 62 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 63 64 IEventType eventType1 = new StringEventType("eventType1"); 65 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 66 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 67 68 assertTrue(rule.isApplicable(task1, task1)); 69 } 70 71 /** 72 * 73 */ 74 @Test 75 public void test_isApplicable_02() { 76 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 77 78 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 79 80 IEventType eventType1 = new StringEventType("eventType1"); 81 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 82 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 83 84 IEventType eventType2 = new StringEventType("eventType2"); 85 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 86 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 87 88 assertTrue(rule.isApplicable(task1, task2)); 89 assertTrue(rule.isApplicable(task2, task1)); 90 } 91 92 /** 93 * 94 */ 95 @Test 96 public void test_isApplicable_03() { 97 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 98 99 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 100 101 IEventType eventType1 = new KeyboardFocusChange(); 102 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 103 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 104 66 105 IEventType eventType2 = new KeyboardFocusChange(); 67 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 68 69 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 70 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 71 72 // test equality of value selections 73 eventType1 = new ValueSelection<String>("value1"); 74 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 75 76 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 77 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 78 79 eventType2 = new ValueSelection<String>("value1"); 80 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 81 82 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 83 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 84 85 eventType2 = new ValueSelection<String>("value2"); 86 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 87 88 assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 89 assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 90 91 // test equality of text inputs 106 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 107 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 108 109 assertTrue(rule.isApplicable(task1, task2)); 110 assertTrue(rule.isApplicable(task2, task1)); 111 } 112 113 /** 114 * 115 */ 116 @Test 117 public void test_isApplicable_04() { 118 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 119 120 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 121 122 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 123 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 124 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 125 126 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 127 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 128 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 129 130 assertTrue(rule.isApplicable(task1, task2)); 131 assertTrue(rule.isApplicable(task2, task1)); 132 } 133 134 /** 135 * 136 */ 137 @Test 138 public void test_isApplicable_05() { 139 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 140 141 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 142 143 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_C); 144 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 145 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 146 147 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_D); 148 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 149 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 150 151 assertTrue(rule.isApplicable(task1, task2)); 152 assertTrue(rule.isApplicable(task2, task1)); 153 } 154 155 /** 156 * 157 */ 158 @Test 159 public void test_isApplicable_06() { 160 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 161 162 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 163 164 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 5, 6); 165 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 166 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 167 168 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.MIDDLE, 3, 1); 169 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 170 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 171 172 assertTrue(rule.isApplicable(task1, task2)); 173 assertTrue(rule.isApplicable(task2, task1)); 174 } 175 176 /** 177 * 178 */ 179 @Test 180 public void test_isApplicable_07() { 181 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 182 183 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 184 185 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 4, 7); 186 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 187 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 188 189 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.X, 9, 12); 190 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 191 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 192 193 assertTrue(rule.isApplicable(task1, task2)); 194 assertTrue(rule.isApplicable(task2, task1)); 195 } 196 197 /** 198 * 199 */ 200 @Test 201 public void test_isApplicable_08() { 202 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 203 204 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 205 206 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 207 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 208 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 209 210 IEventType eventType2 = new MouseDragAndDrop(5, 6, 7, 8); 211 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 212 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 213 214 assertTrue(rule.isApplicable(task1, task2)); 215 assertTrue(rule.isApplicable(task2, task1)); 216 } 217 218 /** 219 * 220 */ 221 @Test 222 public void test_isApplicable_09() { 223 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 224 225 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 226 227 IEventType eventType1 = new Scroll(1, 2); 228 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 229 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 230 231 IEventType eventType2 = new Scroll(3, 4); 232 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 233 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 234 235 assertTrue(rule.isApplicable(task1, task2)); 236 assertTrue(rule.isApplicable(task2, task1)); 237 } 238 239 /** 240 * 241 */ 242 @Test 243 public void test_isApplicable_10() { 244 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 245 246 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 247 248 List<Event> inputEvents = new ArrayList<Event>(); 249 IEventType eventType1 = new TextInput("text1", inputEvents); 250 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 251 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 252 253 IEventType eventType2 = new TextInput("text2", inputEvents); 254 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 255 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 256 257 assertTrue(rule.isApplicable(task1, task2)); 258 assertTrue(rule.isApplicable(task2, task1)); 259 } 260 261 /** 262 * 263 */ 264 @Test 265 public void test_isApplicable_11() { 266 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 267 268 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 269 270 IEventType eventType1 = new TextSelection(); 271 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 272 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 273 274 IEventType eventType2 = new ValueSelection<String>("value"); 275 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 276 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 277 278 assertTrue(rule.isApplicable(task1, task2)); 279 assertTrue(rule.isApplicable(task2, task1)); 280 } 281 282 /** 283 * 284 */ 285 @Test 286 public void test_isApplicable_12() { 287 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 288 289 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 290 291 IEventType eventType1 = new StringEventType("eventType1"); 292 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 293 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 294 295 ITaskTreeNode selection = treeNodeFactory.createNewSelection(); 296 297 assertFalse(rule.isApplicable(task1, selection)); 298 assertFalse(rule.isApplicable(selection, task1)); 299 } 300 301 /** 302 * 303 */ 304 @Test 305 public void test_isApplicable_13() { 306 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 307 308 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 309 310 IEventType eventType1 = new StringEventType("eventType1"); 311 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 312 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 313 314 ITaskTreeNode sequence = treeNodeFactory.createNewSequence(); 315 316 assertFalse(rule.isApplicable(task1, sequence)); 317 assertFalse(rule.isApplicable(sequence, task1)); 318 } 319 320 /** 321 * 322 */ 323 @Test 324 public void test_isApplicable_14() { 325 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 326 327 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 328 329 IEventType eventType1 = new StringEventType("eventType1"); 330 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 331 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 332 333 ITaskTreeNode iteration = treeNodeFactory.createNewIteration(); 334 335 assertFalse(rule.isApplicable(task1, iteration)); 336 assertFalse(rule.isApplicable(iteration, task1)); 337 } 338 339 /** 340 * 341 */ 342 @Test 343 public void test_isApplicable_15() { 344 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 345 346 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 347 348 IEventType eventType1 = new StringEventType("eventType1"); 349 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 350 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 351 352 ITaskTreeNode optional = treeNodeFactory.createNewOptional(); 353 354 assertFalse(rule.isApplicable(task1, optional)); 355 assertFalse(rule.isApplicable(optional, task1)); 356 } 357 358 /** 359 * 360 */ 361 @Test 362 public void test_compare_KeyboardFocusChange_01() { 363 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 364 365 IEventType eventType1 = new KeyboardFocusChange(); 366 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 367 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 368 369 assertLexicallyEqual(task1, task1); 370 } 371 372 /** 373 * 374 */ 375 @Test 376 public void test_compare_KeyboardFocusChange_02() { 377 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 378 379 IEventType eventType1 = new KeyboardFocusChange(); 380 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 381 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 382 383 IEventType eventType2 = new KeyboardFocusChange(); 384 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 385 386 assertLexicallyEqual(task1, task2); 387 } 388 389 /** 390 * 391 */ 392 @Test 393 public void test_compare_KeyboardFocusChange_03() { 394 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 395 396 IEventType eventType1 = new KeyboardFocusChange(); 397 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 398 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 399 400 IEventType eventType2 = new KeyboardFocusChange(); 401 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 402 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 403 404 assertUnequal(task1, task2); 405 } 406 407 /** 408 * 409 */ 410 @Test 411 public void test_compare_KeyPressed_01() { 412 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 413 414 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 415 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 416 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 417 418 assertLexicallyEqual(task1, task1); 419 } 420 421 /** 422 * 423 */ 424 @Test 425 public void test_compare_KeyPressed_02() { 426 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 427 428 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 429 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 430 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 431 432 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 433 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 434 435 assertLexicallyEqual(task1, task2); 436 } 437 438 /** 439 * 440 */ 441 @Test 442 public void test_compare_KeyPressed_03() { 443 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 444 445 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 446 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 447 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 448 449 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_B); 450 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 451 452 assertSemanticallyEqual(task1, task2); 453 } 454 455 /** 456 * 457 */ 458 @Test 459 public void test_compare_KeyPressed_04() { 460 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 461 462 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 463 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 464 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 465 466 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 467 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 468 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 469 470 assertUnequal(task1, task2); 471 } 472 473 /** 474 * 475 */ 476 @Test 477 public void test_compare_KeyReleased_01() { 478 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 479 480 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 481 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 482 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 483 484 assertLexicallyEqual(task1, task1); 485 } 486 487 /** 488 * 489 */ 490 @Test 491 public void test_compare_KeyReleased_02() { 492 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 493 494 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 495 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 496 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 497 498 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 499 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 500 501 assertLexicallyEqual(task1, task2); 502 } 503 504 /** 505 * 506 */ 507 @Test 508 public void test_compare_KeyReleased_03() { 509 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 510 511 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 512 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 513 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 514 515 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 516 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 517 518 assertSemanticallyEqual(task1, task2); 519 } 520 521 /** 522 * 523 */ 524 @Test 525 public void test_compare_KeyReleased_04() { 526 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 527 528 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 529 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 530 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 531 532 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 533 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 534 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 535 536 assertUnequal(task1, task2); 537 } 538 539 /** 540 * 541 */ 542 @Test 543 public void test_compare_KeyTyped_01() { 544 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 545 546 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 547 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 548 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 549 550 assertLexicallyEqual(task1, task1); 551 } 552 553 /** 554 * 555 */ 556 @Test 557 public void test_compare_KeyTyped_02() { 558 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 559 560 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 561 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 562 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 563 564 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 565 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 566 567 assertLexicallyEqual(task1, task2); 568 } 569 570 /** 571 * 572 */ 573 @Test 574 public void test_compare_KeyTyped_03() { 575 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 576 577 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 578 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 579 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 580 581 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_B); 582 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 583 584 assertSemanticallyEqual(task1, task2); 585 } 586 587 /** 588 * 589 */ 590 @Test 591 public void test_compare_KeyTyped_04() { 592 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 593 594 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 595 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 596 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 597 598 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 599 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 600 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 601 602 assertUnequal(task1, task2); 603 } 604 605 /** 606 * 607 */ 608 @Test 609 public void test_compare_MouseButtonDown_01() { 610 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 611 612 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 613 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 614 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 615 616 assertLexicallyEqual(task1, task1); 617 } 618 619 /** 620 * 621 */ 622 @Test 623 public void test_compare_MouseButtonDown_02() { 624 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 625 626 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 627 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 628 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 629 630 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 631 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 632 633 assertLexicallyEqual(task1, task2); 634 } 635 636 /** 637 * 638 */ 639 @Test 640 public void test_compare_MouseButtonDown_03() { 641 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 642 643 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 644 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 645 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 646 647 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 3); 648 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 649 650 assertSemanticallyEqual(task1, task2); 651 } 652 653 /** 654 * 655 */ 656 @Test 657 public void test_compare_MouseButtonDown_04() { 658 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 659 660 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 661 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 662 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 663 664 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 3, 2); 665 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 666 667 assertSemanticallyEqual(task1, task2); 668 } 669 670 /** 671 * 672 */ 673 @Test 674 public void test_compare_MouseButtonDown_05() { 675 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 676 677 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 678 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 679 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 680 681 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.RIGHT, 1, 2); 682 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 683 684 assertUnequal(task1, task2); 685 } 686 687 /** 688 * 689 */ 690 @Test 691 public void test_compare_MouseButtonDown_06() { 692 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 693 694 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 695 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 696 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 697 698 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 699 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 700 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 701 702 assertUnequal(task1, task2); 703 } 704 705 /** 706 * 707 */ 708 @Test 709 public void test_compare_MouseButtonUp_01() { 710 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 711 712 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 713 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 714 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 715 716 assertLexicallyEqual(task1, task1); 717 } 718 719 /** 720 * 721 */ 722 @Test 723 public void test_compare_MouseButtonUp_02() { 724 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 725 726 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 727 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 728 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 729 730 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 731 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 732 733 assertLexicallyEqual(task1, task2); 734 } 735 736 /** 737 * 738 */ 739 @Test 740 public void test_compare_MouseButtonUp_03() { 741 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 742 743 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 744 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 745 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 746 747 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 3); 748 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 749 750 assertSemanticallyEqual(task1, task2); 751 } 752 753 /** 754 * 755 */ 756 @Test 757 public void test_compare_MouseButtonUp_04() { 758 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 759 760 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 761 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 762 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 763 764 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 3, 2); 765 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 766 767 assertSemanticallyEqual(task1, task2); 768 } 769 770 /** 771 * 772 */ 773 @Test 774 public void test_compare_MouseButtonUp_05() { 775 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 776 777 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 778 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 779 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 780 781 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.RIGHT, 1, 2); 782 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 783 784 assertUnequal(task1, task2); 785 } 786 787 /** 788 * 789 */ 790 @Test 791 public void test_compare_MouseButtonUp_06() { 792 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 793 794 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 795 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 796 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 797 798 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 799 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 800 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 801 802 assertUnequal(task1, task2); 803 } 804 805 /** 806 * 807 */ 808 @Test 809 public void test_compare_MouseClick_01() { 810 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 811 812 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 813 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 814 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 815 816 assertLexicallyEqual(task1, task1); 817 } 818 819 /** 820 * 821 */ 822 @Test 823 public void test_compare_MouseClick_02() { 824 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 825 826 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 827 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 828 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 829 830 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 831 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 832 833 assertLexicallyEqual(task1, task2); 834 } 835 836 /** 837 * 838 */ 839 @Test 840 public void test_compare_MouseClick_03() { 841 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 842 843 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 844 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 845 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 846 847 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 3); 848 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 849 850 assertSemanticallyEqual(task1, task2); 851 } 852 853 /** 854 * 855 */ 856 @Test 857 public void test_compare_MouseClick_04() { 858 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 859 860 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 861 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 862 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 863 864 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 3, 2); 865 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 866 867 assertSemanticallyEqual(task1, task2); 868 } 869 870 /** 871 * 872 */ 873 @Test 874 public void test_compare_MouseClick_05() { 875 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 876 877 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 878 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 879 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 880 881 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 882 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 883 884 assertUnequal(task1, task2); 885 } 886 887 /** 888 * 889 */ 890 @Test 891 public void test_compare_MouseClick_06() { 892 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 893 894 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 895 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 896 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 897 898 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 899 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 900 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 901 902 assertUnequal(task1, task2); 903 } 904 905 /** 906 * 907 */ 908 @Test 909 public void test_compare_MouseDoubleClick_01() { 910 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 911 912 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 913 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 914 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 915 916 assertLexicallyEqual(task1, task1); 917 } 918 919 /** 920 * 921 */ 922 @Test 923 public void test_compare_MouseDoubleClick_02() { 924 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 925 926 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 927 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 928 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 929 930 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 931 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 932 933 assertLexicallyEqual(task1, task2); 934 } 935 936 /** 937 * 938 */ 939 @Test 940 public void test_compare_MouseDoubleClick_03() { 941 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 942 943 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 944 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 945 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 946 947 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 3); 948 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 949 950 assertSemanticallyEqual(task1, task2); 951 } 952 953 /** 954 * 955 */ 956 @Test 957 public void test_compare_MouseDoubleClick_04() { 958 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 959 960 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 961 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 962 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 963 964 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 3, 2); 965 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 966 967 assertSemanticallyEqual(task1, task2); 968 } 969 970 /** 971 * 972 */ 973 @Test 974 public void test_compare_MouseDoubleClick_05() { 975 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 976 977 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 978 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 979 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 980 981 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 982 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 983 984 assertUnequal(task1, task2); 985 } 986 987 /** 988 * 989 */ 990 @Test 991 public void test_compare_MouseDoubleClick_06() { 992 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 993 994 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 995 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 996 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 997 998 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 999 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1000 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1001 1002 assertUnequal(task1, task2); 1003 } 1004 1005 /** 1006 * 1007 */ 1008 @Test 1009 public void test_compare_MouseDragAndDrop_01() { 1010 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1011 1012 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1013 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1014 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1015 1016 assertLexicallyEqual(task1, task1); 1017 } 1018 1019 /** 1020 * 1021 */ 1022 @Test 1023 public void test_compare_MouseDragAndDrop_02() { 1024 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1025 1026 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1027 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1028 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1029 1030 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 1031 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1032 1033 assertLexicallyEqual(task1, task2); 1034 } 1035 1036 /** 1037 * 1038 */ 1039 @Test 1040 public void test_compare_MouseDragAndDrop_03() { 1041 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1042 1043 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1044 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1045 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1046 1047 IEventType eventType2 = new MouseDragAndDrop(5, 2, 3, 4); 1048 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1049 1050 assertSemanticallyEqual(task1, task2); 1051 } 1052 1053 /** 1054 * 1055 */ 1056 @Test 1057 public void test_compare_MouseDragAndDrop_04() { 1058 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1059 1060 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1061 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1062 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1063 1064 IEventType eventType2 = new MouseDragAndDrop(1, 5, 3, 4); 1065 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1066 1067 assertSemanticallyEqual(task1, task2); 1068 } 1069 1070 /** 1071 * 1072 */ 1073 @Test 1074 public void test_compare_MouseDragAndDrop_05() { 1075 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1076 1077 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1078 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1079 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1080 1081 IEventType eventType2 = new MouseDragAndDrop(1, 2, 5, 4); 1082 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1083 1084 assertSemanticallyEqual(task1, task2); 1085 } 1086 1087 /** 1088 * 1089 */ 1090 @Test 1091 public void test_compare_MouseDragAndDrop_06() { 1092 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1093 1094 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1095 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1096 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1097 1098 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 5); 1099 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1100 1101 assertSemanticallyEqual(task1, task2); 1102 } 1103 1104 /** 1105 * 1106 */ 1107 @Test 1108 public void test_compare_MouseDragAndDrop_07() { 1109 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1110 1111 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1112 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1113 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1114 1115 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 1116 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1117 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1118 1119 assertUnequal(task1, task2); 1120 } 1121 1122 /** 1123 * 1124 */ 1125 @Test 1126 public void test_compare_Scroll_01() { 1127 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1128 1129 IEventType eventType1 = new Scroll(1, 2); 1130 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1131 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1132 1133 assertLexicallyEqual(task1, task1); 1134 } 1135 1136 /** 1137 * 1138 */ 1139 @Test 1140 public void test_compare_Scroll_02() { 1141 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1142 1143 IEventType eventType1 = new Scroll(1, 2); 1144 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1145 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1146 1147 IEventType eventType2 = new Scroll(1, 2); 1148 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1149 1150 assertLexicallyEqual(task1, task2); 1151 } 1152 1153 /** 1154 * 1155 */ 1156 @Test 1157 public void test_compare_Scroll_03() { 1158 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1159 1160 IEventType eventType1 = new Scroll(1, 2); 1161 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1162 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1163 1164 IEventType eventType2 = new Scroll(3, 2); 1165 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1166 1167 assertSemanticallyEqual(task1, task2); 1168 } 1169 1170 /** 1171 * 1172 */ 1173 @Test 1174 public void test_compare_Scroll_04() { 1175 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1176 1177 IEventType eventType1 = new Scroll(1, 2); 1178 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1179 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1180 1181 IEventType eventType2 = new Scroll(1, 3); 1182 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1183 1184 assertSemanticallyEqual(task1, task2); 1185 } 1186 1187 /** 1188 * 1189 */ 1190 @Test 1191 public void test_compare_Scroll_05() { 1192 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1193 1194 IEventType eventType1 = new Scroll(1, 2); 1195 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1196 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1197 1198 IEventType eventType2 = new Scroll(1, 2); 1199 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1200 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1201 1202 assertUnequal(task1, task2); 1203 } 1204 1205 /** 1206 * 1207 */ 1208 @Test 1209 public void test_compare_TextInput_01() { 1210 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1211 1212 IEventType eventType1 = new StringEventType("eventType1"); 1213 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 92 1214 List<Event> textInputEvents1 = new ArrayList<Event>(); 93 1215 textInputEvents1.add(new Event(eventType1, eventTarget1)); 94 1216 eventType1 = new TextInput("enteredText1", textInputEvents1); 95 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 96 97 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 98 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 99 100 eventType2 = new TextInput("enteredText1", textInputEvents1); 101 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 102 103 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 104 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 105 1217 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1218 1219 assertLexicallyEqual(task1, task1); 1220 } 1221 1222 /** 1223 * 1224 */ 1225 @Test 1226 public void test_compare_TextInput_02() { 1227 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1228 1229 IEventType eventType1 = new StringEventType("eventType1"); 1230 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1231 List<Event> textInputEvents1 = new ArrayList<Event>(); 1232 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1233 eventType1 = new TextInput("enteredText1", textInputEvents1); 1234 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1235 1236 IEventType eventType2 = new TextInput("enteredText1", textInputEvents1); 1237 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1238 1239 assertLexicallyEqual(task1, task2); 1240 } 1241 1242 /** 1243 * 1244 */ 1245 @Test 1246 public void test_compare_TextInput_03() { 1247 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1248 1249 IEventType eventType1 = new StringEventType("eventType1"); 1250 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1251 List<Event> textInputEvents1 = new ArrayList<Event>(); 1252 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1253 eventType1 = new TextInput("enteredText1", textInputEvents1); 1254 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1255 1256 IEventType eventType2 = new StringEventType("eventType2"); 106 1257 List<Event> textInputEvents2 = new ArrayList<Event>(); 107 1258 textInputEvents2.add(new Event(eventType2, eventTarget1)); 108 1259 eventType2 = new TextInput("enteredText1", textInputEvents2); 109 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1260 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1261 1262 assertSyntacticallyEqual(task1, task2); 1263 } 1264 1265 /** 1266 * 1267 */ 1268 @Test 1269 public void test_compare_TextInput_04() { 1270 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1271 1272 IEventType eventType1 = new StringEventType("eventType1"); 1273 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1274 List<Event> textInputEvents1 = new ArrayList<Event>(); 1275 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1276 eventType1 = new TextInput("enteredText1", textInputEvents1); 1277 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1278 1279 IEventType eventType2 = new StringEventType("eventType2"); 1280 List<Event> textInputEvents2 = new ArrayList<Event>(); 1281 textInputEvents2.add(new Event(eventType2, eventTarget1)); 1282 eventType2 = new TextInput("enteredText2", textInputEvents2); 1283 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1284 1285 assertSemanticallyEqual(task1, task2); 1286 } 1287 1288 /** 1289 * 1290 */ 1291 @Test 1292 public void test_compare_TextInput_05() { 1293 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1294 1295 IEventType eventType1 = new StringEventType("eventType1"); 1296 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1297 List<Event> textInputEvents1 = new ArrayList<Event>(); 1298 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1299 eventType1 = new TextInput("enteredText1", textInputEvents1); 1300 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1301 1302 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1303 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2); 1304 1305 assertUnequal(task1, task2); 1306 } 1307 1308 /** 1309 * 1310 */ 1311 @Test 1312 public void test_compare_TextSelection_01() { 1313 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1314 1315 IEventType eventType1 = new TextSelection(); 1316 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1317 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1318 1319 assertLexicallyEqual(task1, task1); 1320 } 1321 1322 /** 1323 * 1324 */ 1325 @Test 1326 public void test_compare_TextSelection_02() { 1327 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1328 1329 IEventType eventType1 = new TextSelection(); 1330 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1331 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1332 1333 IEventType eventType2 = new TextSelection(); 1334 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1335 1336 assertLexicallyEqual(task1, task2); 1337 } 1338 1339 /** 1340 * 1341 */ 1342 @Test 1343 public void test_compare_TextSelection_03() { 1344 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1345 1346 IEventType eventType1 = new TextSelection(); 1347 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1348 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1349 1350 IEventType eventType2 = new TextSelection(); 1351 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1352 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1353 1354 assertUnequal(task1, task2); 1355 } 1356 1357 /** 1358 * 1359 */ 1360 @Test 1361 public void test_compare_ValueSelection_01() { 1362 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1363 1364 IEventType eventType1 = new ValueSelection<String>("value1"); 1365 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1366 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1367 1368 assertLexicallyEqual(task1, task1); 1369 } 1370 1371 /** 1372 * 1373 */ 1374 @Test 1375 public void test_compare_ValueSelection_02() { 1376 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1377 1378 IEventType eventType1 = new ValueSelection<String>("value1"); 1379 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1380 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1381 1382 IEventType eventType2 = new ValueSelection<String>("value1"); 1383 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1384 1385 assertLexicallyEqual(task1, task2); 1386 } 1387 1388 /** 1389 * 1390 */ 1391 @Test 1392 public void test_compare_ValueSelection_03() { 1393 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1394 1395 IEventType eventType1 = new ValueSelection<String>("value1"); 1396 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1397 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1398 1399 IEventType eventType2 = new ValueSelection<String>("value2"); 1400 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1401 1402 assertSemanticallyEqual(task1, task2); 1403 } 1404 1405 /** 1406 * 1407 */ 1408 @Test 1409 public void test_compare_ValueSelection_04() { 1410 ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 1411 1412 IEventType eventType1 = new ValueSelection<String>("value1"); 1413 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1414 ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 1415 1416 IEventType eventType2 = new ValueSelection<String>("value1"); 1417 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1418 ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1419 1420 assertUnequal(task1, task2); 1421 } 1422 1423 /** 1424 * 1425 */ 1426 private void assertLexicallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 1427 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1428 1429 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 1430 assertTrue(rule.areLexicallyEqual(task1, task2)); 1431 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 1432 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1433 1434 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 1435 assertTrue(rule.areLexicallyEqual(task2, task1)); 1436 assertTrue(rule.areSyntacticallyEqual(task2, task1)); 1437 assertTrue(rule.areSemanticallyEqual(task2, task1)); 1438 } 1439 1440 /** 1441 * 1442 */ 1443 private void assertSyntacticallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 1444 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 110 1445 111 1446 assertEquals(NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2)); 1447 assertFalse(rule.areLexicallyEqual(task1, task2)); 1448 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 1449 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1450 112 1451 assertEquals(NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1)); 113 114 eventType2 = new TextInput("enteredText2", textInputEvents2); 115 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 1452 assertFalse(rule.areLexicallyEqual(task2, task1)); 1453 assertTrue(rule.areSyntacticallyEqual(task2, task1)); 1454 assertTrue(rule.areSemanticallyEqual(task2, task1)); 1455 } 1456 1457 /** 1458 * 1459 */ 1460 private void assertSemanticallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 1461 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 116 1462 117 1463 assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 1464 assertFalse(rule.areLexicallyEqual(task1, task2)); 1465 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 1466 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1467 118 1468 assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 119 120 // now ensure unequality for all combinations, if the event targets do not match 121 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 122 eventType1 = new KeyboardFocusChange(); 123 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 124 task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 1469 assertFalse(rule.areLexicallyEqual(task2, task1)); 1470 assertFalse(rule.areSyntacticallyEqual(task2, task1)); 1471 assertTrue(rule.areSemanticallyEqual(task2, task1)); 1472 } 1473 1474 /** 1475 * 1476 */ 1477 private void assertUnequal(ITaskTreeNode task1, ITaskTreeNode task2) { 1478 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1479 125 1480 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 1481 assertFalse(rule.areLexicallyEqual(task1, task2)); 1482 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 1483 assertFalse(rule.areSemanticallyEqual(task1, task2)); 1484 126 1485 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 127 128 eventType1 = new ValueSelection<String>("value1"); 129 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 130 task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2); 131 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 132 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 133 134 eventType1 = new TextInput("enteredText1", textInputEvents1); 135 task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 136 task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2); 137 assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 138 assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 139 140 ISelection selection = treeNodeFactory.createNewSelection(); 141 assertNull(rule.compare(task1, selection)); 142 assertNull(rule.compare(selection, task1)); 143 assertNull(rule.compare(task2, selection)); 144 assertNull(rule.compare(selection, task2)); 145 } 146 1486 assertFalse(rule.areLexicallyEqual(task2, task1)); 1487 assertFalse(rule.areSyntacticallyEqual(task2, task1)); 1488 assertFalse(rule.areSemanticallyEqual(task2, task1)); 1489 } 147 1490 } -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/IterationComparisonRuleTest.java
r927 r1125 52 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 53 53 54 assert Null(rule.compare(task1, task2));54 assertFalse(rule.isApplicable(task1, task2)); 55 55 56 56 IIteration iteration1 = treeNodeFactory.createNewIteration(); 57 assertEquals(NodeEquality. IDENTICAL, rule.compare(iteration1, iteration1));57 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1)); 58 58 59 59 IIteration iteration2 = treeNodeFactory.createNewIteration(); … … 96 96 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 97 97 98 assert Null(rule.compare(iteration1, selection1));99 assert Null(rule.compare(selection1, iteration1));100 assert Null(rule.compare(iteration2, selection1));101 assert Null(rule.compare(selection1, iteration2));98 assertFalse(rule.isApplicable(iteration1, selection1)); 99 assertFalse(rule.isApplicable(selection1, iteration1)); 100 assertFalse(rule.isApplicable(iteration2, selection1)); 101 assertFalse(rule.isApplicable(selection1, iteration2)); 102 102 103 assert Null(rule.compare(iteration1, selection2));104 assert Null(rule.compare(selection2, iteration1));105 assert Null(rule.compare(iteration2, selection2));106 assert Null(rule.compare(selection2, iteration2));103 assertFalse(rule.isApplicable(iteration1, selection2)); 104 assertFalse(rule.isApplicable(selection2, iteration1)); 105 assertFalse(rule.isApplicable(iteration2, selection2)); 106 assertFalse(rule.isApplicable(selection2, iteration2)); 107 107 } 108 108 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/SelectionComparisonRuleTest.java
r927 r1125 52 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 53 53 54 assert Null(rule.compare(task1, task2));54 assertFalse(rule.isApplicable(task1, task2)); 55 55 56 56 ISelection selection1 = treeNodeFactory.createNewSelection(); 57 assertEquals(NodeEquality. IDENTICAL, rule.compare(selection1, selection1));57 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1)); 58 58 59 59 ISelection selection2 = treeNodeFactory.createNewSelection(); … … 93 93 94 94 ISequence sequence = treeNodeFactory.createNewSequence(); 95 assert Null(rule.compare(selection1, sequence));96 assert Null(rule.compare(sequence, selection1));97 assert Null(rule.compare(selection2, sequence));98 assert Null(rule.compare(sequence, selection2));99 assert Null(rule.compare(selection3, sequence));100 assert Null(rule.compare(sequence, selection3));95 assertFalse(rule.isApplicable(selection1, sequence)); 96 assertFalse(rule.isApplicable(sequence, selection1)); 97 assertFalse(rule.isApplicable(selection2, sequence)); 98 assertFalse(rule.isApplicable(sequence, selection2)); 99 assertFalse(rule.isApplicable(selection3, sequence)); 100 assertFalse(rule.isApplicable(sequence, selection3)); 101 101 } 102 102 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/nodeequality/SequenceComparisonRuleTest.java
r927 r1125 52 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 53 53 54 assert Null(rule.compare(task1, task2));54 assertFalse(rule.isApplicable(task1, task2)); 55 55 56 56 ISequence sequence1 = treeNodeFactory.createNewSequence(); 57 assertEquals(NodeEquality. IDENTICAL, rule.compare(sequence1, sequence1));57 assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1)); 58 58 59 59 ISequence sequence2 = treeNodeFactory.createNewSequence(); … … 92 92 93 93 ISelection selection = treeNodeFactory.createNewSelection(); 94 assert Null(rule.compare(sequence1, selection));95 assert Null(rule.compare(selection, sequence1));96 assert Null(rule.compare(sequence2, selection));97 assert Null(rule.compare(selection, sequence2));98 assert Null(rule.compare(sequence3, selection));99 assert Null(rule.compare(selection, sequence3));94 assertFalse(rule.isApplicable(sequence1, selection)); 95 assertFalse(rule.isApplicable(selection, sequence1)); 96 assertFalse(rule.isApplicable(sequence2, selection)); 97 assertFalse(rule.isApplicable(selection, sequence2)); 98 assertFalse(rule.isApplicable(sequence3, selection)); 99 assertFalse(rule.isApplicable(selection, sequence3)); 100 100 } 101 101
Note: See TracChangeset
for help on using the changeset viewer.