bug8072767.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(50);
    SwingUtilities.invokeAndWait(bug8072767::createAndShowGUI);
    robot.waitForIdle();
    SwingUtilities.invokeAndWait(() -> {
        point = table.getLocationOnScreen();
        Rectangle rect = table.getCellRect(0, 0, true);
        point.translate(rect.width / 2, rect.height / 2);
    });
    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.waitForIdle();

    robot.keyPress(KeyEvent.VK_1);
    robot.keyRelease(KeyEvent.VK_1);
    robot.waitForIdle();

    SwingUtilities.invokeAndWait(() -> {
        point = frame.getLocationOnScreen();
        point.translate(frame.getWidth() / 2, frame.getHeight() / 2);
    });

    robot.mouseMove(point.x, point.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    robot.waitForIdle();

    SwingUtilities.invokeAndWait(() -> {
        testPass = TEST2.equals(table.getValueAt(0, 0));
        frame.dispose();
    });

    if (!testPass) {
        throw new RuntimeException("Table cell is not edited!");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号