Ignore:
Timestamp:
11/15/12 19:55:45 (12 years ago)
Author:
pharms
Message:
  • added detection of drag and drop
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/gui/MouseClickCondenserTest.java

    r957 r995  
    146146        simulateEvent(new MouseClick(leftBtn, 1, 1), element1); 
    147147        assertCondensedMouseClicks("", "", "click left elem1", "", "", "click middle elem1", 
    148                                    "", "", "click left elem1"); 
     148                                   "drag left elem1", "click left elem1"); 
     149    } 
     150 
     151    /** 
     152     * 
     153     */ 
     154    @Test 
     155    public void testDragAndDrop() { 
     156        MouseButtonInteraction.Button leftBtn = MouseButtonInteraction.Button.LEFT; 
     157        MouseButtonInteraction.Button middleBtn = MouseButtonInteraction.Button.MIDDLE; 
     158        MouseButtonInteraction.Button rightBtn = MouseButtonInteraction.Button.RIGHT; 
     159 
     160        IGUIElement element1 = new DummyGUIElement("elem1"); 
     161 
     162        simulateEvent(new MouseButtonDown(leftBtn, 0, 0), element1); 
     163        simulateEvent(new MouseButtonUp(leftBtn, 1, 0), element1); 
     164        assertCondensedMouseClicks("drag left elem1"); 
     165 
     166        simulateEvent(new MouseButtonDown(leftBtn, 0, 0), element1); 
     167        simulateEvent(new MouseButtonUp(leftBtn, 1, 1), element1); 
     168        assertCondensedMouseClicks("drag left elem1", "drag left elem1"); 
     169 
     170        simulateEvent(new MouseButtonDown(leftBtn, 0, 0), element1); 
     171        simulateEvent(new MouseButtonUp(leftBtn, 0, 1), element1); 
     172        simulateEvent(new MouseClick(leftBtn, 0, 0), element1); 
     173        assertCondensedMouseClicks("drag left elem1", "drag left elem1", "drag left elem1", 
     174                                   "click left elem1"); 
     175 
     176        simulateEvent(new MouseButtonDown(middleBtn, 1, 0), element1); 
     177        simulateEvent(new MouseButtonUp(middleBtn, 0, 0), element1); 
     178        simulateEvent(new MouseClick(middleBtn, 0, 0), element1); 
     179        assertCondensedMouseClicks("drag left elem1", "drag left elem1", "drag left elem1", 
     180                                   "click left elem1", "", "", "click middle elem1"); 
     181 
     182        simulateEvent(new MouseButtonDown(rightBtn, 0, 1), element1); 
     183        simulateEvent(new MouseButtonUp(rightBtn, 0, 0), element1); 
     184        simulateEvent(new MouseClick(rightBtn, 0, 0), element1); 
     185        assertCondensedMouseClicks("drag left elem1", "drag left elem1", "drag left elem1", 
     186                                   "click left elem1", "", "", "click middle elem1", 
     187                                   "", "", "click right elem1"); 
    149188    } 
    150189 
     
    175214                    assertTrue(result.get(i).getType() instanceof MouseClick); 
    176215                } 
     216                else if ("drag".equals(parts[0])) { 
     217                    assertTrue(result.get(i).getType() instanceof MouseDragAndDrop); 
     218                } 
    177219                else { 
    178220                    fail("invalid assertion in test case"); 
Note: See TracChangeset for help on using the changeset viewer.