Ejemplo n.º 1
0
 private void testMouseWheelZooming() {
   window.pressKey(VK_CONTROL);
   ImageComponent c = ImageComponents.getActiveIC();
   robot.rotateMouseWheel(c, 2);
   robot.rotateMouseWheel(c, -2);
   window.releaseKey(VK_CONTROL);
 }
 private @Nullable JList<?> findListIn(@Nonnull Container parent) {
   List<Component> found = newArrayList(robot.finder().findAll(parent, LIST_MATCHER));
   if (found.size() != 1) {
     return null;
   }
   return (JList<?>) found.get(0);
 }
 public static Robot getRobot() {
   if (robot == null) {
     robot = BasicRobot.robotWithCurrentAwtHierarchyWithoutScreenLock();
     robot.settings().delayBetweenEvents(10);
     // robot.settings().eventPostingDelay(10);
   }
   return robot;
 }
 /**
  * Finds the {@code JList} in the pop-up raised by a {@code JComboBox}, if the LAF actually uses
  * one.
  *
  * @return the found {@code JList}, or {@code null} if a drop-down list cannot be found.
  */
 @RunsInEDT
 @Nullable
 JList<?> findDropDownList() {
   JPopupMenu popup = robot.findActivePopupMenu();
   if (popup == null) {
     TimeoutWatch watch = startWatchWithTimeoutOf(robot.settings().timeoutToFindPopup());
     popup = robot.findActivePopupMenu();
     while (popup == null) {
       if (watch.isTimeOut()) {
         return null;
       }
       pause();
       popup = robot.findActivePopupMenu();
     }
   }
   return findListIn(popup);
 }
Ejemplo n.º 5
0
 private LayerButtonFixture findLayerButton(String layerName) {
   return new LayerButtonFixture(
       robot,
       robot
           .finder()
           .find(
               new GenericTypeMatcher<LayerButton>(LayerButton.class) {
                 @Override
                 protected boolean isMatching(LayerButton layerButton) {
                   return layerButton.getLayerName().equals(layerName);
                 }
               }));
 }
Ejemplo n.º 6
0
 private DialogFixture findDialogByTitle(String title) {
   return new DialogFixture(
       robot,
       robot
           .finder()
           .find(
               new GenericTypeMatcher<JDialog>(JDialog.class) {
                 @Override
                 protected boolean isMatching(JDialog dialog) {
                   return dialog.getTitle().equals(title);
                 }
               }));
 }
Ejemplo n.º 7
0
 private JMenuItemFixture findMenuItemByText(String guiName) {
   return new JMenuItemFixture(
       robot,
       robot
           .finder()
           .find(
               new GenericTypeMatcher<JMenuItem>(JMenuItem.class) {
                 @Override
                 protected boolean isMatching(JMenuItem menuItem) {
                   return guiName.equals(menuItem.getText());
                 }
               }));
 }
Ejemplo n.º 8
0
 private void altClick() {
   robot.pressKey(VK_ALT);
   robot.pressMouse(MouseButton.LEFT_BUTTON);
   robot.releaseMouse(MouseButton.LEFT_BUTTON);
   robot.releaseKey(VK_ALT);
 }
Ejemplo n.º 9
0
 private void click() {
   robot.pressMouse(MouseButton.LEFT_BUTTON);
   robot.releaseMouse(MouseButton.LEFT_BUTTON);
 }
Ejemplo n.º 10
0
 private void setUpRobot() {
   robot = BasicRobot.robotWithNewAwtHierarchy();
   robot.settings().delayBetweenEvents(ROBOT_DELAY_MILLIS);
 }
Ejemplo n.º 11
0
 private void drag(int x, int y) {
   robot.pressMouse(MouseButton.LEFT_BUTTON);
   robot.moveMouse(x, y);
   robot.releaseMouse(MouseButton.LEFT_BUTTON);
 }
Ejemplo n.º 12
0
 private void move(int x, int y) {
   robot.moveMouse(x, y);
 }