private void testClose() { assertEquals(2, ImageComponents.getNrOfOpenImages()); runMenuCommand("Close"); assertEquals(1, ImageComponents.getNrOfOpenImages()); }
private void testCloseAll() { assertThat(ImageComponents.getNrOfOpenImages() > 1); // save for the next test runMenuCommand("Copy Composite"); runMenuCommand("Close All"); // close all warnings boolean warnings = true; while (warnings) { try { JOptionPaneFixture pane = findJOptionPane(); // click "Don't Save" pane.button( new GenericTypeMatcher<JButton>(JButton.class) { @Override protected boolean isMatching(JButton button) { return button.getText().equals("Don't Save"); } }) .click(); } catch (Exception e) { // no more JOptionPane found warnings = false; } } assertEquals(0, ImageComponents.getNrOfOpenImages()); // restore for the next test runMenuCommand("Paste as New Image"); }
private void testScreenCapture() { ImageComponent activeIC = ImageComponents.getActiveIC(); testScreenCapture(true); testScreenCapture(false); try { SwingUtilities.invokeAndWait( () -> { ImageComponents.setActiveImageComponent(activeIC, true); }); } catch (InterruptedException | InvocationTargetException e) { e.printStackTrace(); } }
private void testMouseWheelZooming() { window.pressKey(VK_CONTROL); ImageComponent c = ImageComponents.getActiveIC(); robot.rotateMouseWheel(c, 2); robot.rotateMouseWheel(c, -2); window.releaseKey(VK_CONTROL); }
private void testBatchFilter() { FileChoosers.setLastOpenDir(INPUT_DIR); FileChoosers.setLastSaveDir(BATCH_FILTER_OUTPUT_DIR); assertTrue(ImageComponents.getActiveComp().isPresent()); runMenuCommand("Batch Filter..."); DialogFixture dialog = findDialogByTitle("Batch Filter"); dialog.comboBox("filtersCB").selectItem("Angular Waves"); dialog.button("ok").click(); // next sleep(3, SECONDS); findButtonByText(dialog, "Randomize Settings").click(); dialog.button("ok").click(); // start processing waitForProgressMonitorEnd(); }
private void testExportTweeningAnimation() { assertTrue(ImageComponents.getActiveComp().isPresent()); runMenuCommand("Export Tweening Animation..."); DialogFixture dialog = findDialogByTitle("Export Tweening Animation"); dialog.comboBox().selectItem("Angular Waves"); dialog.button("ok").click(); // next findButtonByText(dialog, "Randomize Settings").click(); dialog.button("ok").click(); // next findButtonByText(dialog, "Randomize Settings").click(); dialog.button("ok").click(); // next dialog.button("ok").click(); // render // say OK to the folder not empty question JOptionPaneFixture optionPane = findJOptionPane(); optionPane.yesButton().click(); waitForProgressMonitorEnd(); }
private void testMoveToolImpl(boolean altDrag) { move(400, 400); click(); if (altDrag) { altDrag(300, 300); } else { ImageLayer layer = ImageComponents.getActiveIC().getComp().getActiveImageLayerOrMask(); int txx = layer.getTranslationX(); int txy = layer.getTranslationY(); assert txx == 0; assert txy == 0; drag(200, 300); txx = layer.getTranslationX(); txy = layer.getTranslationY(); // This will be true only if we are at 100% zoom! assert txx == -200 : "txx = " + txx; assert txy == -100 : "txy = " + txx; } keyboardUndoRedo(); keyboardUndo(); }
@Override public void internalFrameClosed(InternalFrameEvent e) { ImageComponents.imageClosed(ic); }
@Override public void internalFrameActivated(InternalFrameEvent e) { ImageComponents.activeImageHasChanged(ic); ic.onActivation(); }
private void addNewLayer() { int nrLayers = ImageComponents.getActiveComp().get().getNrLayers(); runMenuCommand("Duplicate Layer"); checkNumLayers(nrLayers + 1); keyboardInvert(); }
private static void checkNumLayers(int num) { int nrLayers = ImageComponents.getActiveComp().get().getNrLayers(); assertEquals(nrLayers, num); }