本文整理汇总了Java中test.java.awt.regtesthelpers.Util.clickOnTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Util.clickOnTitle方法的具体用法?Java Util.clickOnTitle怎么用?Java Util.clickOnTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.java.awt.regtesthelpers.Util
的用法示例。
在下文中一共展示了Util.clickOnTitle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.ICONIFIED) ||
!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.NORMAL))
{
System.out.println("Frame.ICONIFIED or Frame.NORMAL state is unsupported.");
return;
}
frame.setSize(100, 100);
frame.setVisible(true);
Util.waitForIdle(robot);
if (!frame.isFocused()) {
Util.clickOnTitle(frame, robot);
Util.waitForIdle(robot);
}
if (!frame.isFocused()) {
throw new Error("Test error: couldn't focus the Frame.");
}
test();
System.out.println("Test passed.");
}
示例2: 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!");
}
示例3: 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.");
}
}
}
}
示例4: test
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void test() {
Util.clickOnComp(button, robot);
if (!button.hasFocus()) {
throw new TestErrorException("the button couldn't be focused by click");
}
Util.clickOnTitle(frame, robot); // here there was a crash
}
示例5: clickOnCheckFocus
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void clickOnCheckFocus(Component c) {
if (c instanceof Frame) {
Util.clickOnTitle((Frame)c, robot);
} else {
Util.clickOnComp(c, robot);
}
if (!testFocused(c)) {
throw new TestErrorException(c + "couldn't get focus by click.");
}
}
示例6: clickOwnerCheckFocus
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void clickOwnerCheckFocus(Window focusedWindow, Component focusedComp) {
Util.clickOnTitle(owner, robot);
robot.delay(500);
if (!checkFocusedWindow(focusedWindow)) {
stopTest("Test failed: actual focused window didn't get a focus");
}
if (!checkFocusOwner(focusedComp)) {
stopTest("Test failed: actual focus owner didn't get a focus");
}
}
示例7: clickOnCheckFocusedWindow
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
void clickOnCheckFocusedWindow(Frame f) {
Util.clickOnTitle(f, robot);
robot.delay(500);
if (!checkFocusedWindow(f)) {
stopTest("Error: can't bring a focus on Frame by clicking on it");
}
}
示例8: 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);
}
}
示例9: start
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start() {
if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
System.out.println("No testing on Motif. Test passed.");
return;
}
System.out.println("\nTest started:\n");
// Test 1.
clickOnCheckFocus(wButton);
clickOnCheckFocus(aButton);
Util.clickOnComp(fButton, robot);
if (!testFocused(fButton)) {
throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by click");
}
// Test 2.
clickOnCheckFocus(wButton);
clickOnCheckFocus(aButton);
fButton.requestFocus();
Util.waitForIdle(robot);
if (!testFocused(fButton)) {
throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by request");
}
// Test 3.
clickOnCheckFocus(wButton);
clickOnCheckFocus(aButton);
clickOnCheckFocus(fButton);
clickOnCheckFocus(aButton);
Util.clickOnTitle(owner, robot);
if (!testFocused(fButton)) {
throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused as the most recent focus owner");
}
System.out.println("Test passed.");
}
示例10: test
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void test(Component compToClick) {
tracking = true;
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_TAB);
robot.delay(50);
Util.clickOnComp(compToClick, robot);
robot.delay(50);
Util.clickOnTitle(f0, robot);
Util.waitForIdle(robot);
if (!f0b3.isFocusOwner()) {
throw new RuntimeException("Test failed: f0b3 is not a focus owner");
}
if (!"sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
if (!Arrays.asList(refGainedList).equals(gainedList)) {
System.out.println("gained list: " + gainedList);
throw new RuntimeException("Test failed: wrong FOCUS_GAINED events order");
}
if (!Arrays.asList(refLostList).equals(lostList)) {
System.out.println("lost list: " + lostList);
throw new RuntimeException("Test failed: wrong FOCUS_LOST events order");
}
}
}