Changeset 946 for trunk


Ignore:
Timestamp:
10/26/12 10:15:00 (12 years ago)
Author:
pharms
Message:
  • added support for mouse click coordinates
Location:
trunk
Files:
5 edited

Legend:

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

    r927 r946  
    389389        // Check if mouse events stay where they are 
    390390        input.add(new Event(new KeyPressed(VirtualKey.LETTER_A), guiElement)); 
    391         input.add(new Event(new MouseButtonDown(Button.LEFT), guiElement)); 
    392         input.add(new Event(new MouseButtonUp(Button.LEFT), guiElement)); 
    393         input.add(new Event(new MouseClick(Button.LEFT), guiElement)); 
    394         input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement)); 
    395  
    396         expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement)); 
    397         expected.add(new Event(new MouseButtonDown(Button.LEFT), guiElement)); 
    398         expected.add(new Event(new MouseButtonUp(Button.LEFT), guiElement)); 
    399         expected.add(new Event(new MouseClick(Button.LEFT), guiElement)); 
     391        input.add(new Event(new MouseButtonDown(Button.LEFT, 0, 0), guiElement)); 
     392        input.add(new Event(new MouseButtonUp(Button.LEFT, 0, 0), guiElement)); 
     393        input.add(new Event(new MouseClick(Button.LEFT, 0, 0), guiElement)); 
     394        input.add(new Event(new KeyReleased(VirtualKey.LETTER_A), guiElement)); 
     395 
     396        expected.add(new Event(new KeyTyped(VirtualKey.LETTER_A), guiElement)); 
     397        expected.add(new Event(new MouseButtonDown(Button.LEFT, 0, 0), guiElement)); 
     398        expected.add(new Event(new MouseButtonUp(Button.LEFT, 0, 0), guiElement)); 
     399        expected.add(new Event(new MouseClick(Button.LEFT, 0, 0), guiElement)); 
    400400 
    401401        List<Event> output = sorter.sortKeyInteractions(input); 
  • trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/gui/MouseClickCondenserTest.java

    r927 r946  
    5555        IGUIElement element2 = new DummyGUIElement("elem2"); 
    5656 
    57         simulateEvent(new MouseButtonDown(leftBtn), element1); 
    58         simulateEvent(new MouseButtonUp(leftBtn), element1); 
    59         simulateEvent(new MouseClick(leftBtn), element1); 
     57        simulateEvent(new MouseButtonDown(leftBtn, 0, 0), element1); 
     58        simulateEvent(new MouseButtonUp(leftBtn, 0, 0), element1); 
     59        simulateEvent(new MouseClick(leftBtn, 0, 0), element1); 
    6060        assertCondensedMouseClicks("elem1"); 
    6161 
    6262        simulateEvent(new DummyInteraction("bla", 1), element1); 
    6363        simulateEvent(new DummyInteraction("bli", 1), element1); 
    64         simulateEvent(new MouseButtonDown(middleBtn), element1); 
    65         simulateEvent(new MouseButtonUp(middleBtn), element1); 
    66         simulateEvent(new MouseClick(middleBtn), element1); 
     64        simulateEvent(new MouseButtonDown(middleBtn, 0, 0), element1); 
     65        simulateEvent(new MouseButtonUp(middleBtn, 0, 0), element1); 
     66        simulateEvent(new MouseClick(middleBtn, 0, 0), element1); 
    6767        simulateEvent(new DummyInteraction("blo", 1), element1); 
    6868        simulateEvent(new DummyInteraction("blu", 1), element1); 
     
    7171        simulateEvent(new DummyInteraction("bla", 1), element2); 
    7272        simulateEvent(new DummyInteraction("bli", 1), element2); 
    73         simulateEvent(new MouseButtonDown(rightBtn), element2); 
    74         simulateEvent(new MouseButtonUp(rightBtn), element2); 
    75         simulateEvent(new MouseClick(rightBtn), element2); 
     73        simulateEvent(new MouseButtonDown(rightBtn, 0, 0), element2); 
     74        simulateEvent(new MouseButtonUp(rightBtn, 0, 0), element2); 
     75        simulateEvent(new MouseClick(rightBtn, 0, 0), element2); 
    7676        simulateEvent(new DummyInteraction("blo", 1), element2); 
    7777        simulateEvent(new DummyInteraction("blu", 1), element2); 
    7878        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", ""); 
    7979 
    80         simulateEvent(new MouseButtonDown(leftBtn), element1); 
    81         simulateEvent(new MouseButtonUp(leftBtn), element1); 
    82         simulateEvent(new MouseClick(leftBtn), element2); 
     80        simulateEvent(new MouseButtonDown(leftBtn, 0, 0), element1); 
     81        simulateEvent(new MouseButtonUp(leftBtn, 0, 0), element1); 
     82        simulateEvent(new MouseClick(leftBtn, 0, 0), element2); 
    8383        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", "", 
    8484                                   "", "", "elem2"); 
    8585 
    86         simulateEvent(new MouseButtonDown(middleBtn), element1); 
    87         simulateEvent(new MouseButtonUp(middleBtn), element1); 
    88         simulateEvent(new MouseClick(rightBtn), element1); 
     86        simulateEvent(new MouseButtonDown(middleBtn, 0, 0), element1); 
     87        simulateEvent(new MouseButtonUp(middleBtn, 0, 0), element1); 
     88        simulateEvent(new MouseClick(rightBtn, 0, 0), element1); 
    8989        simulateEvent(new DummyInteraction("bla", 1), element2); 
    9090        assertCondensedMouseClicks("elem1", "", "", "elem1", "", "", "", "", "elem2", "", "", 
  • trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/gui/TextInputDetectorTest.java

    r927 r946  
    164164        IGUIElement element3 = new DummyGUIElement("elem3"); 
    165165         
    166         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2); 
     166        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element2); 
    167167        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1); 
    168168        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1); 
     
    173173        assertTextInput("", "abc"); 
    174174 
    175         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2); 
    176         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3); 
    177         simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1); 
    178         simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1); 
    179         simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1); 
    180         simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1); 
    181         simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1); 
    182         simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1); 
    183         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3); 
     175        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element2); 
     176        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element3); 
     177        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1); 
     178        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1); 
     179        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1); 
     180        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1); 
     181        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1); 
     182        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1); 
     183        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element3); 
    184184        assertTextInput("", "abc", "", "", "abc", ""); 
    185185 
    186         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element2); 
    187         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3); 
    188         simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1); 
    189         simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1); 
    190         simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1); 
    191         simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1); 
    192         simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1); 
    193         simulateEvent(new MouseClick(MouseClick.Button.LEFT), element3); 
     186        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element2); 
     187        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element3); 
     188        simulateEvent(new KeyPressed(VirtualKey.LETTER_A), element1); 
     189        simulateEvent(new KeyReleased(VirtualKey.LETTER_A), element1); 
     190        simulateEvent(new KeyPressed(VirtualKey.LETTER_B), element1); 
     191        simulateEvent(new KeyReleased(VirtualKey.LETTER_B), element1); 
     192        simulateEvent(new KeyPressed(VirtualKey.LETTER_C), element1); 
     193        simulateEvent(new MouseClick(MouseClick.Button.LEFT, 0, 0), element3); 
    194194        simulateEvent(new KeyReleased(VirtualKey.LETTER_C), element1); 
    195195         
  • trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/JFCLogParser.java

    r927 r946  
    533533        if (JFCEventId.MOUSE_CLICKED == eventId) 
    534534        { 
    535             return new MouseClick(button); 
     535            int x = Integer.parseInt(eventParameters.get("X")); 
     536            int y = Integer.parseInt(eventParameters.get("Y")); 
     537            return new MouseClick(button, x, y); 
    536538        } 
    537539        else if (JFCEventId.MOUSE_PRESSED == eventId) 
    538540        { 
    539             return new MouseButtonDown(button); 
     541            int x = Integer.parseInt(eventParameters.get("X")); 
     542            int y = Integer.parseInt(eventParameters.get("Y")); 
     543            return new MouseButtonDown(button, x, y); 
    540544        } 
    541545        else if (JFCEventId.MOUSE_RELEASED == eventId) 
    542546        { 
    543             return new MouseButtonUp(button); 
     547            int x = Integer.parseInt(eventParameters.get("X")); 
     548            int y = Integer.parseInt(eventParameters.get("Y")); 
     549            return new MouseButtonUp(button, x, y); 
    544550        } 
    545551        else 
  • trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/eventcore/MFCEventTypeFactory.java

    r927 r946  
    7575     */ 
    7676    public IEventType getEventType(String eventName, Map<String, String> messageParameters) { 
     77        // TODO create scrolls were necessary and correct the coordinates of scrolls and mouse 
     78        // clicks 
    7779        if ("LeftClickButton".equals(eventName)) { 
    78             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     80            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    7981        } 
    8082        else if ("LeftClickListBox".equals(eventName)) { 
     
    8284        } 
    8385        else if ("TabChange".equals(eventName)) { 
    84             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     86            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    8587        } 
    8688        else if ("LeftClickCommand".equals(eventName)) { 
    87             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     89            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    8890        } 
    8991        else if ("LeftClickSysCommand".equals(eventName)) { 
    90             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     92            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    9193        } 
    9294        else if ("NCLeftClickSysCommand".equals(eventName)) { 
    93             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     95            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    9496        } 
    9597        else if ("LeftClickMenuItemCmd".equals(eventName)) { 
    96             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     98            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    9799        } 
    98100        else if ("HScroll_TrackBar".equals(eventName)) { 
     
    103105        } 
    104106        else if ("HScroll_ScrollBar".equals(eventName)) { 
    105             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     107            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    106108        } 
    107109        else if ("VScroll_ScrollBar".equals(eventName)) { 
    108             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     110            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    109111        } 
    110112        else if ("VScrollNC".equals(eventName)) { 
    111             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     113            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    112114        } 
    113115        else if ("LeftClickSetFocus".equals(eventName)) { 
     
    130132        } 
    131133        else if ("LeftClickCoordinates".equals(eventName)) { 
    132             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     134            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    133135        } 
    134136        else if ("NCLeftClickCoordinates".equals(eventName)) { 
    135             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     137            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    136138        } 
    137139        else if ("NCLeftClickCoordinates2".equals(eventName)) { 
    138             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     140            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    139141        } 
    140142        else if ("LeftClickCoordinatesTargetChanged".equals(eventName)) { 
    141             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     143            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    142144        } 
    143145        else if ("LeftClickCoordinatesTargetChanged2".equals(eventName)) { 
    144             return new MouseClick(MouseButtonInteraction.Button.LEFT); 
     146            return new MouseClick(MouseButtonInteraction.Button.LEFT, -1, -1); 
    145147        } 
    146148        else { 
Note: See TracChangeset for help on using the changeset viewer.