尝试使用从http://easytesting.org/swing/wiki/pmwiki.php?n=FEST-Swing.LaunchFromMainFEST摇摆例如不工作,frame.isShowing()返回false
不幸的是,frame.isShowing(中FEST-Swing的为Swing GUI测试,并且使用的例子)总是返回false虽然我已经看到了JavaApp摇摆运行
见我的代码
...
ApplicationLauncher.application(JavaApp.class).start();
GenericTypeMatcher<Frame> matcher = new GenericTypeMatcher<Frame>(Frame.class) {
protected boolean isMatching(Frame frame) {
System.out.println("title:" + frame.getTitle() + " showing:" +frame.isShowing()); // .getTitle());
return "Java Application".equals(frame.getTitle()) && frame.isShowing();
}
};
Robot robot = BasicRobot.robotWithNewAwtHierarchy();
FrameFixture frame2 = WindowFinder.findFrame(matcher).withTimeout(5000).using(robot);
...
从控制台日志
title: showing: false
两个问题:
1.我必须使用JFrame的Frame insteaf,否则它不能匹配,导致标题不正确,我期望“Java应用程序”
2. frame.isShowing( )总是返回false,这似乎很奇怪
BTW:最新的代码似乎需要参数GenericTypeMatcher() RGS /拉里