Search in sources :

Example 1 with SIZE

use of de.neemann.digital.draw.shapes.GenericShape.SIZE in project Digital by hneemann.

the class TestInGUI method testShortcutsPlusMinus.

public void testShortcutsPlusMinus() {
    new GuiTester().mouseMove(100 + SIZE * 2, 100 + SIZE * 2).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> {
        final CircuitComponent cc = main.getCircuitComponent();
        final VisualElement ve = new VisualElement(And.DESCRIPTION.getName()).setShapeFactory(cc.getLibrary().getShapeFactory());
        cc.setPartToInsert(ve);
    })).mouseClick(InputEvent.BUTTON1_MASK).mouseMove(100, 100).press("PLUS").press("PLUS").add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> {
        final Circuit c = main.getCircuitComponent().getCircuit();
        assertEquals(1, c.getElements().size());
        assertEquals(4, (int) c.getElements().get(0).getElementAttributes().get(Keys.INPUT_COUNT));
    })).press("MINUS").press("MINUS").add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> {
        final Circuit c = main.getCircuitComponent().getCircuit();
        assertEquals(1, c.getElements().size());
        assertEquals(2, (int) c.getElements().get(0).getElementAttributes().get(Keys.INPUT_COUNT));
    })).execute();
}
Also used : InputEvent(java.awt.event.InputEvent) Wire(de.neemann.digital.draw.elements.Wire) Signal(de.neemann.digital.core.Signal) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) In(de.neemann.digital.core.io.In) de.neemann.digital.gui.components(de.neemann.digital.gui.components) TestCaseElement(de.neemann.digital.testing.TestCaseElement) GraphicMinMax(de.neemann.digital.draw.graphics.GraphicMinMax) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ArrayList(java.util.ArrayList) Expression(de.neemann.digital.analyse.expression.Expression) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ElementTypeDescription(de.neemann.digital.core.element.ElementTypeDescription) VisualElement(de.neemann.digital.draw.elements.VisualElement) AllSolutionsDialog(de.neemann.digital.gui.components.table.AllSolutionsDialog) ErrorMessage(de.neemann.gui.ErrorMessage) Main(de.neemann.digital.gui.Main) TestCase(junit.framework.TestCase) Style(de.neemann.digital.draw.graphics.Style) External(de.neemann.digital.core.extern.External) KarnaughMapComponent(de.neemann.digital.gui.components.karnaugh.KarnaughMapComponent) GraphDialog(de.neemann.digital.gui.components.data.GraphDialog) ExpressionListenerStore(de.neemann.digital.gui.components.table.ExpressionListenerStore) TableModel(javax.swing.table.TableModel) Keys(de.neemann.digital.core.element.Keys) SIZE2(de.neemann.digital.draw.shapes.GenericShape.SIZE2) ROM(de.neemann.digital.core.memory.ROM) IOException(java.io.IOException) Lang(de.neemann.digital.lang.Lang) MouseEvent(java.awt.event.MouseEvent) File(java.io.File) TESTDATA(de.neemann.digital.testing.TestCaseElement.TESTDATA) Circuit(de.neemann.digital.draw.elements.Circuit) NumberingWizard(de.neemann.digital.gui.NumberingWizard) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) List(java.util.List) Out(de.neemann.digital.core.io.Out) And(de.neemann.digital.core.basic.And) Driver(de.neemann.digital.core.wiring.Driver) TestCaseDescription(de.neemann.digital.testing.TestCaseDescription) Vector(de.neemann.digital.draw.graphics.Vector) ElementLibrary(de.neemann.digital.draw.library.ElementLibrary) javax.swing(javax.swing) VisualElement(de.neemann.digital.draw.elements.VisualElement) Circuit(de.neemann.digital.draw.elements.Circuit) Main(de.neemann.digital.gui.Main)

Example 2 with SIZE

use of de.neemann.digital.draw.shapes.GenericShape.SIZE in project Digital by hneemann.

the class TestInGUI method test74xxFunctions.

public void test74xxFunctions() {
    new GuiTester("dig/manualError/10_74xx.dig").press("F10").press("RIGHT", 2).press("DOWN", 4).press("RIGHT").press("DOWN", 2).press("ENTER").add(new ClickInputsAndOutputs()).press("ESCAPE").add(new GuiTester.WindowCheck<>(Main.class, (guiTester, main) -> {
        final CircuitComponent cc = main.getCircuitComponent();
        ArrayList<VisualElement> el = cc.getCircuit().getElements();
        int n = 0;
        for (VisualElement ve : el) if (ve.equalsDescription(In.DESCRIPTION) || ve.equalsDescription(Out.DESCRIPTION)) {
            n++;
            assertEquals("" + n, ve.getElementAttributes().get(Keys.PINNUMBER));
        }
    })).add(new SelectAll()).press("F10").press("RIGHT", 2).press("DOWN", 5).press("RIGHT").press("ENTER").type("U").press("ENTER").add(new PinNameChecker("UC")).press("F10").press("RIGHT", 2).press("DOWN", 5).press("RIGHT").press("DOWN").press("ENTER").add(new PinNameChecker("C")).press("F10").press("RIGHT", 2).press("DOWN", 5).press("RIGHT").press("DOWN", 3).press("ENTER").add(new GuiTester.WindowCheck<>(Main.class, (guiTester, main) -> {
        final CircuitComponent cc = main.getCircuitComponent();
        ArrayList<VisualElement> el = cc.getCircuit().getElements();
        for (VisualElement ve : el) if (ve.equalsDescription(In.DESCRIPTION) || ve.equalsDescription(Out.DESCRIPTION))
            assertEquals("", ve.getElementAttributes().get(Keys.PINNUMBER));
    })).press("F10").press("RIGHT", 2).press("DOWN", 5).press("RIGHT").press("DOWN", 4).press("ENTER").mouseClick(InputEvent.BUTTON1_MASK).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> assertEquals(7, main.getCircuitComponent().getCircuit().getElements().size()))).execute();
}
Also used : InputEvent(java.awt.event.InputEvent) Wire(de.neemann.digital.draw.elements.Wire) Signal(de.neemann.digital.core.Signal) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) In(de.neemann.digital.core.io.In) de.neemann.digital.gui.components(de.neemann.digital.gui.components) TestCaseElement(de.neemann.digital.testing.TestCaseElement) GraphicMinMax(de.neemann.digital.draw.graphics.GraphicMinMax) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ArrayList(java.util.ArrayList) Expression(de.neemann.digital.analyse.expression.Expression) ElementAttributes(de.neemann.digital.core.element.ElementAttributes) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ElementTypeDescription(de.neemann.digital.core.element.ElementTypeDescription) VisualElement(de.neemann.digital.draw.elements.VisualElement) AllSolutionsDialog(de.neemann.digital.gui.components.table.AllSolutionsDialog) ErrorMessage(de.neemann.gui.ErrorMessage) Main(de.neemann.digital.gui.Main) TestCase(junit.framework.TestCase) Style(de.neemann.digital.draw.graphics.Style) External(de.neemann.digital.core.extern.External) KarnaughMapComponent(de.neemann.digital.gui.components.karnaugh.KarnaughMapComponent) GraphDialog(de.neemann.digital.gui.components.data.GraphDialog) ExpressionListenerStore(de.neemann.digital.gui.components.table.ExpressionListenerStore) TableModel(javax.swing.table.TableModel) Keys(de.neemann.digital.core.element.Keys) SIZE2(de.neemann.digital.draw.shapes.GenericShape.SIZE2) ROM(de.neemann.digital.core.memory.ROM) IOException(java.io.IOException) Lang(de.neemann.digital.lang.Lang) MouseEvent(java.awt.event.MouseEvent) File(java.io.File) TESTDATA(de.neemann.digital.testing.TestCaseElement.TESTDATA) Circuit(de.neemann.digital.draw.elements.Circuit) NumberingWizard(de.neemann.digital.gui.NumberingWizard) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) List(java.util.List) Out(de.neemann.digital.core.io.Out) And(de.neemann.digital.core.basic.And) Driver(de.neemann.digital.core.wiring.Driver) TestCaseDescription(de.neemann.digital.testing.TestCaseDescription) Vector(de.neemann.digital.draw.graphics.Vector) ElementLibrary(de.neemann.digital.draw.library.ElementLibrary) javax.swing(javax.swing) ArrayList(java.util.ArrayList) VisualElement(de.neemann.digital.draw.elements.VisualElement) Main(de.neemann.digital.gui.Main)

Example 3 with SIZE

use of de.neemann.digital.draw.shapes.GenericShape.SIZE 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)

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 KarnaughMapDialog (de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog)3 TableDialog (de.neemann.digital.gui.components.table.TableDialog)3 ValueTableDialog (de.neemann.digital.gui.components.testing.ValueTableDialog)3 Lang (de.neemann.digital.lang.Lang)3 TestCaseElement (de.neemann.digital.testing.TestCaseElement)3 java.awt (java.awt)3 InputEvent (java.awt.event.InputEvent)3 File (java.io.File)3 Expression (de.neemann.digital.analyse.expression.Expression)2 Signal (de.neemann.digital.core.Signal)2 And (de.neemann.digital.core.basic.And)2 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)2 ElementTypeDescription (de.neemann.digital.core.element.ElementTypeDescription)2 External (de.neemann.digital.core.extern.External)2 In (de.neemann.digital.core.io.In)2 Out (de.neemann.digital.core.io.Out)2