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


Java Util类代码示例

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


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

示例1: performTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
@Override
protected boolean performTest() {
    // run robot
    Robot robot = Util.createRobot();
    robot.setAutoDelay(ROBOT_DELAY);

    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen();
                vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen();
            }
        });
    } catch (Exception e) {
    }
    hLoc.translate(2, 2);
    vLoc.translate(2, 2);

    clickAndBlink(robot, hLoc, false);
    clickAndBlink(robot, vLoc, false);

    return horizontalClicked && verticalClicked;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:JScrollPaneOverlapping.java

示例2: performTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
@Override
protected boolean performTest() {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                splitterLoc = sp2.getLocationOnScreen();
                Point leftLoc = sp1.getLocationOnScreen();
                leftLoc.translate(sp1.getWidth(), 0);
                splitterLoc.translate(-(splitterLoc.x - leftLoc.x) / 2, 30);
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException("Where is splitter?");
    }
    // run robot
    Robot robot = Util.createRobot();
    robot.setAutoDelay(ROBOT_DELAY);

    robot.mouseMove(splitterLoc.x, splitterLoc.y);
    Util.waitForIdle(robot);

    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseMove(splitterLoc.x - 50, splitterLoc.y);
    Color c = robot.getPixelColor(splitterLoc.x - 50, splitterLoc.y);
    System.out.println("Actual: "+c+", (not) expected: "+AWT_VERIFY_COLOR+" at "+(splitterLoc.x - 50)+", "+ splitterLoc.y);
    if (!ignoreFail && c.equals(AWT_VERIFY_COLOR)) {
        fail("The JSplitPane drag-n-drop image did not pass pixel color check and is overlapped");
    }
    robot.mouseRelease(InputEvent.BUTTON1_MASK);

    clickAndBlink(robot, splitterLoc);

    return clicked;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:JSplitPaneOverlapping.java

示例3: 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

示例4: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) {
    PaintSetEnabledDeadlock frame = new PaintSetEnabledDeadlock();
    frame.setSize(200, 200);
    frame.setVisible(true);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(100);
    robot.setAutoWaitForIdle(true);

    for (int i = 0; i < 20; ++i) {
        Util.clickOnComp(frame.panel, robot);
        Util.clickOnComp(frame.button, robot);
    }

    boolean ret = frame.panel.stop();
    frame.dispose();

    if (!ret) {
        throw new RuntimeException("Test failed!");
    }
    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:PaintSetEnabledDeadlock.java

示例5: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    SwingUtilities.invokeAndWait(() -> {
        new RemovedComponentMouseListener();
    });

    Robot r = Util.createRobot();
    r.setAutoDelay(100);
    r.waitForIdle();
    Util.pointOnComp(button, r);

    r.waitForIdle();
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.waitForIdle();
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    r.waitForIdle();
    if (!mouseReleasedReceived) {
        throw new RuntimeException("mouseReleased event was not received");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:RemovedComponentMouseListener.java

示例6: startRegTest

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:MutterMaximizeTest.java

示例7: createObjects

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void createObjects() {
    textArea = new TextArea( bigString() );
    robot = Util.createRobot();

    Panel panel = new Panel();
    panel.setLayout( new GridLayout(3,3) );

    for( int y=0; y<3; ++y ) {
        for( int x=0; x<3; ++x ) {
            if( x==1 && y==1 ) {
                panel.add( textArea );
            } else {
                panel.add( new Panel() );
            }
        }
    }

    Frame frame = new Frame( "TextArea cursor icon test" );
    frame.setSize( 300, 300 );
    frame.add( panel );
    frame.setVisible( true );
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SelectionAutoscrollTest.java

示例8: test

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public void test() {
    if (!testFocused(textField)) {
        Util.clickOnComp(textField, robot);
        if (!testFocused(textField)) {
            throw new RuntimeException("Error: couldn't focus " + textField);
        }
    }

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

    if (!testFocused(button3)) {
        throw new RuntimeException("Test failed: dialog didn't get focus!");
    }

    System.out.println("Test passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:JDK8013611.java

示例9: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {
    try {

        SwingUtilities.invokeAndWait(() -> initAndShowUI());

        Robot r = new Robot();
        Util.waitForIdle(r);
        Util.drag(r,
                new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
                new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
                InputEvent.BUTTON1_MASK);
        Util.waitForIdle(r);
    } finally {
        if (f != null) {
            f.dispose();
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:AcceptDropMultipleTimes.java

示例10: main

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
public static void main(final String[] args) throws AWTException {
    final bug7097771 frame = new bug7097771();
    frame.setSize(300, 300);
    frame.setLocationRelativeTo(null);
    final Button button = new Button();
    button.addActionListener(frame);
    frame.add(button);
    frame.setVisible(true);
    Robot robot = new Robot();
    sleep(robot);
    frame.setEnabled(false);
    button.setEnabled(false);
    button.setEnabled(true);
    sleep(robot);
    Util.clickOnComp(button, robot);
    sleep(robot);
    frame.dispose();
    if (action) {
        throw new RuntimeException("Button is not disabled.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:bug7097771.java

示例11: 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:FrameMinimizeTest.java

示例12: 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

示例13: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:GetSizeShouldNotReturnZero.java

示例14: runTests

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void runTests()
{
    Frame frame = new Frame("frame");
    frame.setBounds(100, 100, 100, 100);
    frame.setVisible(true);
    frame.validate();
    Util.waitTillShown(frame);

    Robot robot = Util.createRobot();
    robot.setAutoDelay(10);

    oneButtonPressRelease(frame, robot, false, 1);
    oneButtonPressRelease(frame, robot, true, 0);
    twoButtonPressRelease(frame, robot, false, 2);
    twoButtonPressRelease(frame, robot, true, 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:MouseClickTest.java

示例15: showFrame

import test.java.awt.regtesthelpers.Util; //导入依赖的package包/类
void showFrame() {
    if (frame != null) {
        frame.dispose();
        Util.waitForIdle(robot);
    }
    frame = new TestFrame();
    frame.setVisible(true);
    Util.waitTillShown(frame);

    if (!frame.b0.hasFocus()) {
        Util.clickOnComp(frame.b0, robot);
        Util.waitForIdle(robot);
        if (!frame.b0.hasFocus()) {
            throw new TestErrorException("couldn't set focus on " + frame.b2);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:ContainerFocusAutoTransferTest.java


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