当前位置: 首页>>代码示例>>Java>>正文


Java Util.waitForIdle方法代码示例

本文整理汇总了Java中test.java.awt.regtesthelpers.Util.waitForIdle方法的典型用法代码示例。如果您正苦于以下问题:Java Util.waitForIdle方法的具体用法?Java Util.waitForIdle怎么用?Java Util.waitForIdle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.java.awt.regtesthelpers.Util的用法示例。


在下文中一共展示了Util.waitForIdle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    try {
        sleep(100);
        robot.mousePress(InputEvent.BUTTON1_MASK);
        sleep(100);
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
        sleep(100);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    Util.drag(robot, dragSourcePoint, new Point (AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
            AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
            InputEvent.BUTTON1_MASK);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:DragUnicodeBetweenJVMTest.java

示例2: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
    Frame frame = new Frame("Frame Minimize Test");
    Button b = new Button("Focus ownder");
    frame.add("South", b);
    frame.pack();
    frame.setVisible(true);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after showing :(");
    }
    frame.setExtendedState(Frame.ICONIFIED);
    Util.waitForIdle(null);
    frame.setExtendedState(Frame.NORMAL);
    Util.waitForIdle(null);
    if (!b.hasFocus()) {
        throw new RuntimeException("button is not a focus owner after restoring :(");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:FrameMinimizeTest.java

示例3: init

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static void init()
{
    String[] instructions =
    {
        "This is an AUTOMATIC test, simply wait until it is done.",
        "The result (passed or failed) will be shown in the",
        "message window below."
    };
    Sysout.createDialog( );
    Sysout.printInstructions( instructions );

    Frame f = new Frame();
    f.setSize(100, 100);
    f.setVisible(true);

    Robot robot = Util.createRobot();
    Util.waitForIdle(robot);

    Dimension size = SecurityWarning.getSize(f);
    if (size.width == 0 || size.height == 0) {
        fail("Reported security warning size: " + size);
        return;
    }
    pass();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:GetSizeShouldNotReturnZero.java

示例4: testSetText

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private void testSetText() {
    textField.setText(null);
    textField.requestFocus();
    Util.clickOnComp(textField, robot);
    Util.waitForIdle(robot);
    robot.keyPress(KeyEvent.VK_A);
    robot.delay(5);
    robot.keyRelease(KeyEvent.VK_A);
    Util.waitForIdle(robot);
    textField.setText(null);
    checkTest("");
    textField.setText("CaseSensitive");
    checkTest("CaseSensitive");
    textField.setText("caseSensitive");
    checkTest("caseSensitive");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TextFieldEditing.java

示例5: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
    owner.setBounds(100, 100, 200, 100);
    window.setBounds(100, 250, 200, 100);
    frame.setBounds(350, 100, 200, 100);
    window.add(button);

    owner.setVisible(true);
    frame.setVisible(true);
    window.setVisible(true);

    Util.waitForIdle(robot);

    test();

    System.out.println("Test passed");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:OwnedWindowFocusIMECrashTest.java

示例6: URIListBetweenJVMsTest

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public URIListBetweenJVMsTest (Point targetFrameLocation, Point dragSourcePoint,
        int transferredFilesNumber)
        throws InterruptedException
{
    TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation,
            transferredFilesNumber);

    Util.waitForIdle(null);

    final Robot robot = Util.createRobot();

    robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
    sleep(100);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    sleep(100);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    sleep(100);

    Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
            InputEvent.BUTTON1_MASK);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:URIListBetweenJVMsTest.java

示例7: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) {
    final Frame f = new Frame("F");
    f.setBounds(0,0,200,200);
    f.setEnabled(false); // <- disable the top-level
    f.setVisible(true);

    Window w = new Window(f);
    w.setBounds(300,300,300,300);
    w.add(new TextField(20));
    w.setVisible(true);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(1000);
    Util.waitForIdle(robot);
    robot.delay(1000);
    Util.clickOnTitle(f, robot);
    Util.waitForIdle(robot);

    f.dispose();
    System.out.println("Test passed!");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:bug7024749.java

示例8: clickAndBlink

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
/**
 * Verifies point using specified AWT Robot.
 * <p>Firstly, verifies point by color pixel check
 * <p>Secondly, verifies event delivery by mouse click
 * @param robot AWT Robot. Usually created by {@link Util#createRobot() }
 * @param lLoc point to verify
 * @param defaultShift if true verified position will be shifted by {@link OverlappingTestBase#shift }.
 */
protected void clickAndBlink(Robot robot, Point lLoc, boolean defaultShift) {
    Point loc = lLoc.getLocation();
    //check color
    Util.waitForIdle(robot);
    try{
        Thread.sleep(500);
    }catch(Exception exx){
        exx.printStackTrace();
    }

    if (defaultShift) {
        loc.translate(shift.x, shift.y);
    }
    if (!(System.getProperty("os.name").toLowerCase().contains("os x"))) {
        Color c = robot.getPixelColor(loc.x, loc.y);
        System.out.println("C&B. color: "+c+" compare with "+AWT_VERIFY_COLOR);
        if (c.equals(AWT_VERIFY_COLOR)) {
            fail(failMessageColorCheck);
            passed = false;
        }

        // perform click
        Util.waitForIdle(robot);
    }

    robot.mouseMove(loc.x, loc.y);

    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    Util.waitForIdle(robot);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:OverlappingTestBase.java

示例9: setFocus

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static void setFocus(final Component comp, final Robot r) {
    if (comp.hasFocus()) {
        return;
    }

    Util.clickOnComp(comp, r);
    Util.waitForIdle(r);

    if (!comp.hasFocus()) {
        throw new RuntimeException("can not set focus on " + comp);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TranserFocusToWindow.java

示例10: test

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void test() {
    robot.keyPress(KeyEvent.VK_TAB);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_TAB);
    robot.delay(50);

    robot.keyPress(KeyEvent.VK_ALT);
    robot.delay(50);
    robot.keyPress(KeyEvent.VK_TAB);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_ALT);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_TAB);

    robot.delay(500);

    robot.keyPress(KeyEvent.VK_ALT);
    robot.delay(50);
    robot.keyPress(KeyEvent.VK_TAB);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_ALT);
    robot.delay(50);
    robot.keyRelease(KeyEvent.VK_TAB);

    // Control shot.
    Util.clickOnTitle(f, robot);
    Util.waitForIdle(robot);

    if (menu.isSelected()) {
        throw new RuntimeException("Test failed: the menu gets selected");
    }
    if (!b1.hasFocus()) {
        throw new RuntimeException("Test failed: the button is not a focus owner " + b1);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:Test3.java

示例11: testComponent

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static void testComponent(final Component comp){
    Runnable action = new Runnable(){
            public void run(){
                Util.clickOnComp(comp, robot);
                Util.waitForIdle(robot);
            }
        };

    if (! Util.trackFocusGained(comp, action, REASONABLE_PATH_TIME, true)){
        AbstractTest.fail("Focus didn't come to " + comp);
    }
    testKeys();
    Util.waitForIdle(robot);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:CorrectTime.java

示例12: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) {
    frame.setLayout(new GridLayout(3, 1));
    frame.add(btn1);
    frame.add(btn2);
    frame.add(btn3);
    frame.pack();
    frame.setVisible(true);

    Util.waitForIdle(null);

    if (!btn1.hasFocus()) {
        btn1.requestFocus();
        Util.waitForIdle(null);
        if (!btn1.hasFocus()) {
            throw new TestErrorException("couldn't focus " + btn1);
        }
    }

    if (!Util.trackFocusGained(btn3, new Runnable() {
            public void run() {
                btn3.requestFocus();
                frame.remove(btn1);
                frame.invalidate();
                            frame.validate();
                            frame.repaint();
            }
        }, 2000, true))
    {
        throw new TestFailedException("focus request on removal failed");
    }

    System.out.println("Test passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:RemoveAfterRequest.java

示例13: start

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start ()
{
    JButton jButton = new JButton();

    this.setSize(200, 200);
    this.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(MouseWheelEvent e)
            {
                System.out.println("Wheel moved on APPLET : "+e);
                actualEvents++;
            }
        });

    this.add(jButton);

    this.setVisible(true);
    this.validate();

    Util.waitForIdle(robot);

    Util.pointOnComp(jButton, robot);
    Util.waitForIdle(robot);

    for (int i = 0; i < MOVE_COUNT; i++){
        robot.mouseWheel(1);
        robot.delay(10);
    }

    for (int i = 0; i < MOVE_COUNT; i++){
        robot.mouseWheel(-1);
        robot.delay(10);
    }

    Util.waitForIdle(robot);
    //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
    //result in a single wheel rotation.
    if (actualEvents != EXPECTED_COUNT) {
        AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:41,代码来源:InfiniteRecursion_3.java

示例14: main

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException, java.lang.reflect.InvocationTargetException
{
    final Frame frame = new Frame("the test");
    frame.setLayout(new FlowLayout());
    final Button btn1 = new Button("button 1");
    frame.add(btn1);
    frame.add(new Button("button 2"));
    frame.add(new Button("button 3"));
    frame.pack();
    frame.setVisible(true);

    Robot r = Util.createRobot();
    Util.waitForIdle(r);
    Util.clickOnComp(btn1, r);
    Util.waitForIdle(r);
    KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    if (kfm.getFocusOwner() != btn1) {
        throw new RuntimeException("test error: can not set focus on " + btn1 + ".");
    }

    EventQueue.invokeAndWait(new Runnable() {
            public void run() {
                final int n_comps = frame.getComponentCount();
                for (int i = 0; i < n_comps; ++i) {
                    frame.getComponent(i).setVisible(false);
                }
            }
        });
    Util.waitForIdle(r);
    final Component focus_owner = kfm.getFocusOwner();

    if (focus_owner != null && !focus_owner.isVisible()) {
        throw new RuntimeException("we have invisible focus owner");
    }
    System.out.println("test passed");
    frame.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:RequestFocusAndHideTest.java

示例15: showWindows

import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
private static void showWindows(Window win, Window[] wins, final boolean visible) {
    pause(100);

    if (wins == null) {
        wins = new Window[] {win}; // operate with 'win'
    }
    for (final Window w: wins) {
        if (visible) {
            if ((w instanceof Dialog) && ((Dialog)w).isModal()) {
                TestHelper.invokeLaterAndWait(new Runnable() {
                        public void run() {
                            w.setVisible(true);
                        }
                    }, robot);
            } else {
                setVisible(w, true);
            }
        } else {
            w.dispose();
        }
    }
    setVisible(auxFrame, visible);

    if (visible) {
        if (!auxFrame.isFocused()) {
            Util.clickOnTitle(auxFrame, robot);
            Util.waitForIdle(robot);
            if (!auxFrame.isFocused()) {
                throw new Error("Test error: the frame couldn't be focused.");
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:AutoRequestFocusToFrontTest.java


注:本文中的test.java.awt.regtesthelpers.Util.waitForIdle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。