Search in sources :

Example 1 with GuiTester

use of de.neemann.digital.integration.GuiTester in project Digital by hneemann.

the class ScreenShots method hierarchicalDesign.

private static void hierarchicalDesign() {
    ScreenShot.n = 20;
    new GuiTester("dig/test/docu/halfAdder.dig", "halfAdder.dig").add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY))).press("control typed -", 4).delay(500).add(new ScreenShot<>(Main.class)).execute();
    new GuiTester("dig/test/docu/fullAdder.dig", "fullAdder.dig").add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY))).delay(500).add(new ScreenShot<>(Main.class)).add(new TestInGUI.SetMouseToElement((v) -> v.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION))).mouseClick(InputEvent.BUTTON3_MASK).delay(500).add(new GuiTester.WindowCheck<>(AttributeDialog.class, (gt, w) -> {
        Point p = w.getLocation();
        p.y -= 50;
        p.x -= 70;
        w.setLocation(p);
    })).delay(500).press("TAB", "SPACE").delay(500).add(new GuiTester.WindowCheck<>(TestCaseDescriptionDialog.class, (gt, w) -> {
        Point p = w.getLocation();
        p.y -= 50;
        p.x -= 50;
        w.setLocation(p);
        w.getContentPane().setPreferredSize(new Dimension(400, 300));
        w.pack();
    })).delay(500).add(new ScreenShot<>(TestCaseDescriptionDialog.class).useParent().useParent()).add(new GuiTester.CloseTopMost()).add(new GuiTester.CloseTopMost()).press("F8").add(new GuiTester.WindowCheck<>(ValueTableDialog.class, (gt, w) -> {
        Point p = w.getLocation();
        p.y += 90;
        w.setLocation(p);
        w.getContentPane().setPreferredSize(new Dimension(400, 300));
        w.pack();
    })).add(new ScreenShot<>(ValueTableDialog.class).useParent()).execute();
    new GuiTester("dig/test/docu/rcAdder.dig", "rcAdder.dig").add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY))).delay(500).add(new ScreenShot<>(Main.class)).add(new TestInGUI.SetMouseToElement((v) -> v.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION))).mouseClick(InputEvent.BUTTON3_MASK).delay(500).add(new GuiTester.WindowCheck<>(AttributeDialog.class, (gt, w) -> {
        Point p = w.getLocation();
        p.y -= 50;
        w.setLocation(p);
    })).delay(500).press("TAB", "SPACE").delay(500).add(new GuiTester.WindowCheck<>(TestCaseDescriptionDialog.class, (gt, w) -> {
        Point p = w.getLocation();
        p.y -= 50;
        w.setLocation(p);
        w.getContentPane().setPreferredSize(new Dimension(400, 300));
        w.pack();
    })).delay(500).add(new ScreenShot<>(TestCaseDescriptionDialog.class).useParent().useParent()).execute();
}
Also used : Keys(de.neemann.digital.core.element.Keys) InputEvent(java.awt.event.InputEvent) AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) Resources(de.neemann.digital.integration.Resources) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) BufferedImage(java.awt.image.BufferedImage) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) Language(de.neemann.gui.language.Language) TestCaseDescriptionDialog(de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog) Lang(de.neemann.digital.lang.Lang) TestCaseElement(de.neemann.digital.testing.TestCaseElement) File(java.io.File) TableDialog(de.neemann.digital.gui.components.table.TableDialog) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) ImageIO(javax.imageio.ImageIO) TestInGUI(de.neemann.digital.integration.TestInGUI) Main(de.neemann.digital.gui.Main) GraphicDialog(de.neemann.digital.gui.components.graphics.GraphicDialog) GuiTester(de.neemann.digital.integration.GuiTester) javax.swing(javax.swing) TestInGUI(de.neemann.digital.integration.TestInGUI) GuiTester(de.neemann.digital.integration.GuiTester) TestCaseDescriptionDialog(de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) Main(de.neemann.digital.gui.Main)

Example 2 with GuiTester

use of de.neemann.digital.integration.GuiTester in project Digital by hneemann.

the class ScreenShots method firstSteps.

// Set all settings as needed before start this method
private static void firstSteps() {
    ScreenShot.n = 0;
    int x = 300;
    int y = 180;
    new GuiTester().add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(WIN_DX, WIN_DY))).press("F10").press("RIGHT", 5).press("DOWN", 2).press("RIGHT").press("DOWN", 2).add(new ScreenShot<>(Main.class)).press("ENTER").add(new ClickAtCircuit(x, y, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).press("typed l").add(new ClickAtCircuit(x, y + SIZE * 2, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).press("F10").press("RIGHT", 5).press("DOWN", 1).press("RIGHT").press("DOWN", 4).add(new ScreenShot<>(Main.class)).press("ENTER").add(new ClickAtCircuit(x + SIZE * 5, y + SIZE, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).press("F10").press("RIGHT", 5).press("DOWN", 2).press("RIGHT").add(new ScreenShot<>(Main.class)).press("ENTER").add(new ClickAtCircuit(x + SIZE * 9, y + SIZE, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).add(new ClickAtCircuit(x, y - SIZE, InputEvent.BUTTON1_MASK)).add(new ClickAtCircuit(x + SIZE * 2, y - SIZE, InputEvent.BUTTON1_MASK)).add(new ClickAtCircuit(x, y + SIZE, InputEvent.BUTTON1_MASK)).add(new ClickAtCircuit(x + SIZE * 2, y + SIZE, InputEvent.BUTTON1_MASK)).add(new ClickAtCircuit(x + SIZE * 5, y, InputEvent.BUTTON1_MASK)).add(new ClickAtCircuit(x + SIZE * 7, y, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).press(' ').add(new ScreenShot<>(Main.class)).add(new ClickAtCircuit(x - SIZE, y - SIZE, InputEvent.BUTTON1_MASK)).add(new ScreenShot<>(Main.class)).press(' ').add(new ClickAtCircuit(x - SIZE, y - SIZE, InputEvent.BUTTON3_MASK)).press("shift typed a").add(new ScreenShot<>(AttributeDialog.class).useParent()).press("ENTER").add(new ClickAtCircuit(x - SIZE, y + SIZE, InputEvent.BUTTON3_MASK)).press("shift typed b", "ENTER").add(new ClickAtCircuit(x + SIZE * 8, y, InputEvent.BUTTON3_MASK)).press("shift typed y", "ENTER").press("F10").press("RIGHT", 4).press("DOWN", 1).add(new ScreenShot<>(Main.class)).press("ENTER").delay(500).add(new GuiTester.WindowCheck<>(TableDialog.class, (gt, td) -> {
        final Point location = td.getParent().getLocation();
        location.x += 10;
        location.y += 10;
        td.setLocation(location);
        td.getContentPane().setPreferredSize(new Dimension(370, 400));
        td.pack();
    })).delay(500).add(new ScreenShot<>(TableDialog.class).useParent()).press("F10").press("RIGHT", 5).press("DOWN", 1).add(new ScreenShot<>(TableDialog.class).useParent()).press("ENTER").delay(500).add(new GuiTester.WindowCheck<>(KarnaughMapDialog.class, (gt, td) -> {
        td.getContentPane().setPreferredSize(new Dimension(300, 300));
        td.pack();
    })).delay(500).add(new ScreenShot<>(KarnaughMapDialog.class).useParent().useParent()).execute();
}
Also used : Keys(de.neemann.digital.core.element.Keys) InputEvent(java.awt.event.InputEvent) AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) Resources(de.neemann.digital.integration.Resources) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) BufferedImage(java.awt.image.BufferedImage) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) Language(de.neemann.gui.language.Language) TestCaseDescriptionDialog(de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog) Lang(de.neemann.digital.lang.Lang) TestCaseElement(de.neemann.digital.testing.TestCaseElement) File(java.io.File) TableDialog(de.neemann.digital.gui.components.table.TableDialog) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) ImageIO(javax.imageio.ImageIO) TestInGUI(de.neemann.digital.integration.TestInGUI) Main(de.neemann.digital.gui.Main) GraphicDialog(de.neemann.digital.gui.components.graphics.GraphicDialog) GuiTester(de.neemann.digital.integration.GuiTester) javax.swing(javax.swing) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) GuiTester(de.neemann.digital.integration.GuiTester) Main(de.neemann.digital.gui.Main)

Example 3 with GuiTester

use of de.neemann.digital.integration.GuiTester in project Digital by hneemann.

the class ScreenShots method mainScreenShot.

private static void mainScreenShot() {
    Lang.setActualRuntimeLanguage(new Language("en"));
    Settings.getInstance().getAttributes().set(Keys.SETTINGS_IEEE_SHAPES, true);
    new GuiTester("../../main/dig/processor/Processor.dig", "examples/processor/Processor.dig").press(' ').delay(500).add(new GuiTester.WindowCheck<>(GraphicDialog.class, (gt, gd) -> {
        graphic = gd;
        final Main main = (Main) gd.getParent();
        main.getCircuitComponent().requestFocus();
    })).delay(500).press(' ').add((gt) -> graphic.dispose()).delay(500).press("F1").add(new MainScreenShot("screenshot.png")).execute();
    new GuiTester().press("F10").press("RIGHT", 4).press("DOWN", 3).press("ENTER").delay(500).press("control typed a").type("A B + B !C + A !C").add(new GuiTester.SetFocusTo<>(ExpressionDialog.class, comp -> comp instanceof JButton && ((JButton) comp).getText().equals(Lang.get("btn_create")))).press("SPACE").delay(500).press("control typed -", 1).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> main.getCircuitComponent().translateCircuit(-120, 0))).delay(500).press("F9").delay(500).add(new GuiTester.WindowCheck<>(TableDialog.class, (gt, td) -> {
        td.getContentPane().setPreferredSize(new Dimension(370, 280));
        td.pack();
        final Point location = td.getParent().getLocation();
        location.x += 640;
        location.y += 410;
        td.setLocation(location);
    })).delay(500).press("F1").delay(500).add(new GuiTester.WindowCheck<>(KarnaughMapDialog.class, (gt, td) -> {
        final Point location = td.getParent().getLocation();
        location.x -= 150;
        location.y -= 340;
        td.setLocation(location);
        td.getContentPane().setPreferredSize(new Dimension(390, 300));
        td.pack();
    })).delay(500).add(new MainScreenShot("screenshot2.png")).add(new GuiTester.CloseTopMost()).add(new GuiTester.CloseTopMost()).add(new GuiTester.CloseTopMost()).execute();
}
Also used : Keys(de.neemann.digital.core.element.Keys) InputEvent(java.awt.event.InputEvent) AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) Resources(de.neemann.digital.integration.Resources) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) BufferedImage(java.awt.image.BufferedImage) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) Language(de.neemann.gui.language.Language) TestCaseDescriptionDialog(de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog) Lang(de.neemann.digital.lang.Lang) TestCaseElement(de.neemann.digital.testing.TestCaseElement) File(java.io.File) TableDialog(de.neemann.digital.gui.components.table.TableDialog) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) ImageIO(javax.imageio.ImageIO) TestInGUI(de.neemann.digital.integration.TestInGUI) Main(de.neemann.digital.gui.Main) GraphicDialog(de.neemann.digital.gui.components.graphics.GraphicDialog) GuiTester(de.neemann.digital.integration.GuiTester) javax.swing(javax.swing) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) Language(de.neemann.gui.language.Language) GuiTester(de.neemann.digital.integration.GuiTester) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) Main(de.neemann.digital.gui.Main)

Aggregations

Keys (de.neemann.digital.core.element.Keys)3 SIZE (de.neemann.digital.draw.shapes.GenericShape.SIZE)3 Main (de.neemann.digital.gui.Main)3 Settings (de.neemann.digital.gui.Settings)3 AttributeDialog (de.neemann.digital.gui.components.AttributeDialog)3 ExpressionDialog (de.neemann.digital.gui.components.expression.ExpressionDialog)3 GraphicDialog (de.neemann.digital.gui.components.graphics.GraphicDialog)3 KarnaughMapDialog (de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog)3 TableDialog (de.neemann.digital.gui.components.table.TableDialog)3 TestCaseDescriptionDialog (de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog)3 ValueTableDialog (de.neemann.digital.gui.components.testing.ValueTableDialog)3 GuiTester (de.neemann.digital.integration.GuiTester)3 Resources (de.neemann.digital.integration.Resources)3 TestInGUI (de.neemann.digital.integration.TestInGUI)3 Lang (de.neemann.digital.lang.Lang)3 TestCaseElement (de.neemann.digital.testing.TestCaseElement)3 Language (de.neemann.gui.language.Language)3 java.awt (java.awt)3 InputEvent (java.awt.event.InputEvent)3 BufferedImage (java.awt.image.BufferedImage)3