fest

FEST Swing new frame on click, can't make new frame fixture

北城以北 提交于 2019-12-06 11:20:09
I am trying to write a Fest Swing test but am having trouble making / finding a frame fixture. I have two JFrames, one opens the other on click, and I'd like to either: 1.) find the frame fixture of the new JFrame opened 2.) make a new frame fixture out of the the new JFrame object created (I can get the object from the original JFrame Object.) I have tried using 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

Making FEST to wait for the application to load

房东的猫 提交于 2019-12-01 04:58:35
问题 I am new to FEST based GUI Testing. MyFrame is the root class for my application. @Before public void onSetUp() { MyFrame frame = GuiActionRunner.execute(new GuiQuery<MyFrame>() { protected MyFrame executeInEDT() { return new MyFrame(); } }); frame2 = new FrameFixture(robot(), frame); frame2.show(); // shows the frame to test } When I run the test case, @Test public void testGui() { String rs = frame2.label("hl").text().toString(); assertTrue(rs.equals("First")); } The above method doesn't

Get the VK int from an arbitrary char in java

我是研究僧i 提交于 2019-11-30 09:15:42
How do you get the VK code from a char that is a letter? It seems like you should be able to do something like javax.swing.KeyStroke.getKeyStroke('c').getKeyCode() , but that doesn't work (the result is zero). Everyone knows how to get the key code if you already have a KeyEvent, but what if you just want to turn chars into VK ints? I'm not interested in getting the FK code for strange characters, only [A-Z],[a-z],[0-9]. Context of this problem -------- All of the Robot tutorials I've seen assume programmers love to spell out words by sending keypresses with VK codes: int keyInput[] = {

How do I read pixels from a PNG file?

随声附和 提交于 2019-11-27 14:27:00
I know how to capture a screenshot by using Robot, Windowtester or FEST. I also know how to read a pixel from the screen by using robot. int x = 10; int y = 10; Color px = getPixelColor(int x, int y); However, I don't know how to read a pixel from an image that is already captured. I'm planning to compare a current image, with an image from file. Lets say both are PNG. Are there any frameworks that I can use to compare images pixel by pixel? hughes Is this in Java? If so, you can use ImageIO.read( "yourImage.png" ) to get a BufferedImage . That will have a getData() method which will give you