FEST Swing新框架点击,无法制作新的框架夹具
我正在尝试写一个Fest Swing测试,但我在制作/找到一个框架夹具时遇到了麻烦。 我有两个JFrame,一个打开另一个点击,我想要:
1.)找到新JFrame的框架夹具打开
2.)从创建的新JFrame对象中创建一个新的框架夹具(我可以从原始的JFrame对象中获取对象。)
我试过用
GenericTypeMatcher matcher = new GenericTypeMatcher(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() { @Override protected secondGUI executeInEDT() throws Throwable { return firstGUI.getController().getWindows().get("0"); } }); FrameFixture secondWindow = new FrameFixture(secGUI);
但最后一行也给出了EdtViolationException。 有什么建议么? 谢谢!
尝试使用框架标题查找框架:
Robot robot = BasicRobot.robotWithCurrentAwtHierarchy(); FrameFixture frame = WindowFinder.findFrame("Title of my frame").using(robot);
另外, secondGUI
应该是SecondGUI
因为它是一个类名。
顺便说一句,很高兴看到另一个FEST用户。