【发布时间】:2012-05-17 14:38:22
【问题描述】:
我正在尝试编写 Fest Swing 测试,但无法制作/找到框架夹具。我有两个 JFrame,一个在点击时打开另一个,我想要:
1.) 找到打开的新 JFrame 的框架夹具
2.) 从创建的新 JFrame 对象中制作一个新的框架夹具(我可以从原始 JFrame 对象中获取该对象。)
我尝试过使用
GenericTypeMatcher<secondGUI> matcher = new GenericTypeMatcher<secondGUI>(secondGUI.class) {
protected boolean isMatching(secondGUI frame) {
System.out.println("0".equals(frame.getTitle()) && frame.isShowing());
return "0".equals(frame.getTitle()) && frame.isShowing();
}
};
Robot robot = BasicRobot.robotWithCurrentAwtHierarchy();
找到框架,但遇到 EdtViolationException。
我也试过
secondGUI secGUI = GuiActionRunner.execute(new GuiQuery<secondGUI>() {
@Override
protected secondGUI executeInEDT() throws Throwable {
return firstGUI.getController().getWindows().get("0");
}
});
FrameFixture secondWindow = new FrameFixture(secGUI);
但最后一行也给出了 EdtViolationException。 有什么建议么? 谢谢!
【问题讨论】: