嘗試使用從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 /拉里