Changeset 1053
- Timestamp:
- 02/01/13 11:57:41 (13 years ago)
- Location:
- trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel
- Files:
-
- 2 edited
-
GUIElementTreeTest.java (modified) (1 diff)
-
MockGUIElementSpec.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIElementTreeTest.java
r1025 r1053 12 12 public class GUIElementTreeTest { 13 13 14 @Test15 public void testAdd() {16 GUIElementTree tree = new GUIElementTree();17 IGUIElementSpec spec = new MockGUIElementSpec();18 tree.add(10l, null, spec);19 20 assertEquals(1, tree.size());21 }22 23 @Test24 public void testAddWithParent(){25 GUIElementTree tree = new GUIElementTree();26 IGUIElementSpec parentspec = new MockGUIElementSpec();27 IGUIElementSpec spec = new MockGUIElementSpec();28 tree.add(10l, null, parentspec);29 tree.add(20l, 10l, spec);30 31 assertEquals(2, tree.size());32 33 IGUIElement element = tree.find(20l);34 assertEquals(parentspec, element.getParent().getSpecification());35 }14 @Test 15 public void testAdd() { 16 GUIElementTree tree = new GUIElementTree(); 17 IGUIElementSpec spec = new MockGUIElementSpec(); 18 tree.add(10l, null, spec); 19 20 assertEquals(1, tree.size()); 21 } 22 23 @Test 24 public void testAddWithParent(){ 25 GUIElementTree tree = new GUIElementTree(); 26 IGUIElementSpec parentspec = new MockGUIElementSpec(); 27 IGUIElementSpec spec = new MockGUIElementSpec(); 28 tree.add(10l, null, parentspec); 29 tree.add(20l, 10l, spec); 30 31 assertEquals(2, tree.size()); 32 33 IGUIElement element = tree.find(20l); 34 assertEquals(parentspec, element.getParent().getSpecification()); 35 } 36 36 37 @Test38 public void testFindExisting() {39 GUIElementTree tree = new GUIElementTree();40 IGUIElementSpec spec = new MockGUIElementSpec();41 tree.add(10l, 0l, spec);42 43 IGUIElement element = tree.find(10l);44 assertNotNull(element);45 }46 47 @Test48 public void testFindNonExisting(){49 GUIElementTree tree = new GUIElementTree();50 assertEquals(tree.find(10l), null);51 }37 @Test 38 public void testFindExisting() { 39 GUIElementTree tree = new GUIElementTree(); 40 IGUIElementSpec spec = new MockGUIElementSpec(); 41 tree.add(10l, 0l, spec); 42 43 IGUIElement element = tree.find(10l); 44 assertNotNull(element); 45 } 46 47 @Test 48 public void testFindNonExisting(){ 49 GUIElementTree tree = new GUIElementTree(); 50 assertEquals(tree.find(10l), null); 51 } 52 52 53 @Test54 public void testRemoveSingleElement() {55 GUIElementTree tree = new GUIElementTree();56 IGUIElementSpec spec = new MockGUIElementSpec();57 tree.add(10l, null, spec);58 59 assertEquals(1, tree.size());60 assertEquals(1, tree.remove(10l));61 }62 63 @Test64 public void testRemoveWithChildElement(){65 GUIElementTree tree = new GUIElementTree();66 IGUIElementSpec parentspec = new MockGUIElementSpec();67 IGUIElementSpec spec = new MockGUIElementSpec();68 tree.add(10l, null, parentspec);69 tree.add(20l, 10l, spec);70 71 assertEquals(2, tree.remove(10l));72 assertEquals(0, tree.size());73 }74 75 @Test76 public void testRemoveNonExisting(){77 GUIElementTree tree = new GUIElementTree();78 assertEquals(0, tree.remove(10l));79 }53 @Test 54 public void testRemoveSingleElement() { 55 GUIElementTree tree = new GUIElementTree(); 56 IGUIElementSpec spec = new MockGUIElementSpec(); 57 tree.add(10l, null, spec); 58 59 assertEquals(1, tree.size()); 60 assertEquals(1, tree.remove(10l)); 61 } 62 63 @Test 64 public void testRemoveWithChildElement(){ 65 GUIElementTree tree = new GUIElementTree(); 66 IGUIElementSpec parentspec = new MockGUIElementSpec(); 67 IGUIElementSpec spec = new MockGUIElementSpec(); 68 tree.add(10l, null, parentspec); 69 tree.add(20l, 10l, spec); 70 71 assertEquals(2, tree.remove(10l)); 72 assertEquals(0, tree.size()); 73 } 74 75 @Test 76 public void testRemoveNonExisting(){ 77 GUIElementTree tree = new GUIElementTree(); 78 assertEquals(0, tree.remove(10l)); 79 } 80 80 81 @Test82 public void testGetGUIModel() {83 GUIElementTree tree = new GUIElementTree();84 assertNotNull(tree.getGUIModel());85 }81 @Test 82 public void testGetGUIModel() { 83 GUIElementTree tree = new GUIElementTree(); 84 assertNotNull(tree.getGUIModel()); 85 } 86 86 } -
trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/MockGUIElementSpec.java
r1005 r1053 3 3 public class MockGUIElementSpec implements IGUIElementSpec { 4 4 5 @Override 6 public String getType() { 7 return "dummy"; 8 } 5 /** */ 6 private static final long serialVersionUID = 1L; 9 7 10 @Override11 public String[] getTypeHierarchy() {12 return new String[]{getType()};13 }8 @Override 9 public String getType() { 10 return "dummy"; 11 } 14 12 15 @Override 16 public boolean getSimilarity(IGUIElementSpec other) { 17 // TODO Auto-generated method stub 18 return false; 19 } 13 @Override 14 public String[] getTypeHierarchy() { 15 return new String[]{getType()}; 16 } 17 18 @Override 19 public boolean getSimilarity(IGUIElementSpec other) { 20 // TODO Auto-generated method stub 21 return false; 22 } 20 23 21 24 }
Note: See TracChangeset
for help on using the changeset viewer.
