final protected void takeSnapshot(String suffix) { // To make sure the mouse is not over a component in the frame, which //would change its appearance, hence modify the snapshot. hideMouse(); // Take snapshot if (suffix.length() > 0) { suffix = "-" + suffix; } String snapshot = TestConfiguration.SCREENSHOT_PATH + "/" + _example.getClass().getSimpleName() + suffix + ".png"; _screenshot.saveComponentAsPng(_frame.panel("TOP").component(), snapshot); }
/** * Basic test showing usage of FEST and checking combo box * * @throws Exception */ //@Test public void scratchTestFEST() throws Exception { FrameFixture frame = new FrameFixture(IGV.getMainFrame()); JPanelFixture contentFixture = frame.panel("contentPane"); JPanelFixture commandBar = frame.panel("igvCommandBar"); JComboBoxFixture chromoBox = frame.comboBox("chromosomeComboBox"); String[] chromos = commandBar.comboBox("chromosomeComboBox").contents(); Assert.assertEquals(26, chromos.length); }
final protected void checkSnapshot(String suffix) { if (_checkSnapshots) { // To make sure the mouse is not over a component in the frame, which //would change its appearance, hence modify the snapshot. hideMouse(); // Take snapshot of current layout if (suffix.length() > 0) { suffix = "-" + suffix; } String name = _example.getClass().getSimpleName() + suffix; String snapshot = TestConfiguration.SCREENSHOT_PATH + "/" + name + "-org.png"; _screenshot.saveComponentAsPng(_frame.panel("TOP").component(), snapshot); // Compare with previously recorded snapshots String expected = REFERENCE_SCREENSHOT_PATH + name + ".png"; assertThat(new File(snapshot)).hasSameContentAs(new File(expected)); } else { takeSnapshot(suffix); } }