diff --git a/src/test/java/de/neemann/digital/docu/ScreenShots.java b/src/test/java/de/neemann/digital/docu/ScreenShots.java index 5d867263c..530c0e1f4 100644 --- a/src/test/java/de/neemann/digital/docu/ScreenShots.java +++ b/src/test/java/de/neemann/digital/docu/ScreenShots.java @@ -1,11 +1,15 @@ package de.neemann.digital.docu; import de.neemann.digital.gui.Main; +import de.neemann.digital.gui.components.AttributeDialog; +import de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog; +import de.neemann.digital.gui.components.table.TableDialog; import de.neemann.digital.integration.GuiTester; import de.neemann.digital.integration.Resources; import de.neemann.digital.lang.Lang; import javax.imageio.ImageIO; +import javax.swing.*; import java.awt.*; import java.awt.event.InputEvent; import java.awt.image.BufferedImage; @@ -18,10 +22,11 @@ public class ScreenShots { public static void main(String[] args) { int x = 300; - int y = 200; + int y = 180; new GuiTester() .add(new GuiTester.WindowCheck<>(Main.class, (gt, w) -> w.setSize(850, 500))) .add(new ScreenShot<>(Main.class)) + // input .press("F10") .press("RIGHT", 5) .press("DOWN", 2) @@ -29,13 +34,13 @@ public class ScreenShots { .press("DOWN", 2) .add(new ScreenShot<>(Main.class)) .press("ENTER") - .mouseMove(x, y) - .mouseClick(InputEvent.BUTTON1_MASK) + .add(new ClickAtCircuit(x, y, InputEvent.BUTTON1_MASK)) .add(new ScreenShot<>(Main.class)) + // input .press("typed l") - .mouseMove(x, y + SIZE * 2) - .mouseClick(InputEvent.BUTTON1_MASK) + .add(new ClickAtCircuit(x, y + SIZE * 2, InputEvent.BUTTON1_MASK)) .add(new ScreenShot<>(Main.class)) + // xor .press("F10") .press("RIGHT", 5) .press("DOWN", 1) @@ -43,57 +48,117 @@ public class ScreenShots { .press("DOWN", 4) .add(new ScreenShot<>(Main.class)) .press("ENTER") - .mouseMove(x + SIZE * 5, y + SIZE * 1 + SIZE2) - .mouseClick(InputEvent.BUTTON1_MASK) + .add(new ClickAtCircuit(x + SIZE * 5, y + SIZE, InputEvent.BUTTON1_MASK)) .add(new ScreenShot<>(Main.class)) + // output .press("F10") .press("RIGHT", 5) .press("DOWN", 2) .press("RIGHT") - //.press("DOWN", 4) .add(new ScreenShot<>(Main.class)) .press("ENTER") - .mouseMove(x + SIZE * 9, y + SIZE * 1 + SIZE2) - .mouseClick(InputEvent.BUTTON1_MASK) + .add(new ClickAtCircuit(x + SIZE * 9, y + SIZE, InputEvent.BUTTON1_MASK)) .add(new ScreenShot<>(Main.class)) - .mouseMove(x, y - SIZE) - .mouseClick(InputEvent.BUTTON1_MASK) - .mouseMove(x + SIZE * 2, y - SIZE) - .mouseClick(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 ScreenShot<>(Main.class)) - .mouseMove(x, y + SIZE) - .mouseClick(InputEvent.BUTTON1_MASK) - .mouseMove(x + SIZE * 2, y + SIZE) - .mouseClick(InputEvent.BUTTON1_MASK) - .mouseMove(x + SIZE * 5, y) - .mouseClick(InputEvent.BUTTON1_MASK) - .mouseMove(x + SIZE * 7, y) - .mouseClick(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)) - .mouseMove(x - SIZE, y) - .mouseClick(InputEvent.BUTTON1_MASK) + .add(new ClickAtCircuit(x - SIZE, y - SIZE, InputEvent.BUTTON1_MASK)) .add(new ScreenShot<>(Main.class)) + .press(' ') + // labels + .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") + //.add(new ScreenShot<>(Main.class)) + // analyse + .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(400,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 ScreenShot<>(KarnaughMapDialog.class).useParent().useParent()) .execute(); } private static class ScreenShot extends GuiTester.WindowCheck { private static int n; + private int parentCount; ScreenShot(Class expectedClass) { super(expectedClass); + parentCount = 0; } @Override public void checkWindow(GuiTester guiTester, W window) throws Exception { - BufferedImage image = guiTester.getRobot().createScreenCapture(window.getBounds()); + Window win = window; + for (int i = 0; i < parentCount; i++) + win = (Window) win.getParent(); + + BufferedImage image = guiTester.getRobot().createScreenCapture(win.getBounds()); String str = Integer.toString(n); if (str.length() == 1) str = '0' + str; - File file = new File(Resources.getRoot(), "docu/images/"+ Lang.currentLanguage().getName()+"/scr" + str + ".png"); + File file = new File(Resources.getRoot(), "docu/images/" + Lang.currentLanguage().getName() + "/scr" + str + ".png"); ImageIO.write(image, "png", file); n++; } + + ScreenShot useParent() { + parentCount++; + return this; + } + } + + private static class ClickAtCircuit extends GuiTester.WindowCheck
{ + private final int x; + private final int y; + private final int button; + + ClickAtCircuit(int x, int y, int button) { + super(Main.class); + this.x = x; + this.y = y; + this.button = button; + } + + @Override + public void checkWindow(GuiTester guiTester, Main main) throws Exception { + Point p = new Point(x, y); + SwingUtilities.convertPointToScreen(p, main.getCircuitComponent()); + guiTester.getRobot().mouseMove(p.x, p.y); + if (button != 0) { + guiTester.mouseClickNow(button); + } + } } } diff --git a/src/test/resources/docu/images/de/scr00.png b/src/test/resources/docu/images/de/scr00.png index 10e0e6769..0192b9b5f 100644 Binary files a/src/test/resources/docu/images/de/scr00.png and b/src/test/resources/docu/images/de/scr00.png differ diff --git a/src/test/resources/docu/images/de/scr01.png b/src/test/resources/docu/images/de/scr01.png index fc6f3515f..34995f114 100644 Binary files a/src/test/resources/docu/images/de/scr01.png and b/src/test/resources/docu/images/de/scr01.png differ diff --git a/src/test/resources/docu/images/de/scr02.png b/src/test/resources/docu/images/de/scr02.png index 57c67bb2e..e3caeb515 100644 Binary files a/src/test/resources/docu/images/de/scr02.png and b/src/test/resources/docu/images/de/scr02.png differ diff --git a/src/test/resources/docu/images/de/scr03.png b/src/test/resources/docu/images/de/scr03.png index 8c606a8ba..a609e2f9a 100644 Binary files a/src/test/resources/docu/images/de/scr03.png and b/src/test/resources/docu/images/de/scr03.png differ diff --git a/src/test/resources/docu/images/de/scr04.png b/src/test/resources/docu/images/de/scr04.png index 4ab77d6f0..e6936b291 100644 Binary files a/src/test/resources/docu/images/de/scr04.png and b/src/test/resources/docu/images/de/scr04.png differ diff --git a/src/test/resources/docu/images/de/scr05.png b/src/test/resources/docu/images/de/scr05.png index a199101ab..b8807f781 100644 Binary files a/src/test/resources/docu/images/de/scr05.png and b/src/test/resources/docu/images/de/scr05.png differ diff --git a/src/test/resources/docu/images/de/scr06.png b/src/test/resources/docu/images/de/scr06.png index 0e8402bcc..f6586635f 100644 Binary files a/src/test/resources/docu/images/de/scr06.png and b/src/test/resources/docu/images/de/scr06.png differ diff --git a/src/test/resources/docu/images/de/scr07.png b/src/test/resources/docu/images/de/scr07.png index 66ceb8020..3d56bc136 100644 Binary files a/src/test/resources/docu/images/de/scr07.png and b/src/test/resources/docu/images/de/scr07.png differ diff --git a/src/test/resources/docu/images/de/scr08.png b/src/test/resources/docu/images/de/scr08.png index cf78f6ede..ee7d472be 100644 Binary files a/src/test/resources/docu/images/de/scr08.png and b/src/test/resources/docu/images/de/scr08.png differ diff --git a/src/test/resources/docu/images/de/scr09.png b/src/test/resources/docu/images/de/scr09.png index 67dda32f9..d306ed897 100644 Binary files a/src/test/resources/docu/images/de/scr09.png and b/src/test/resources/docu/images/de/scr09.png differ diff --git a/src/test/resources/docu/images/de/scr10.png b/src/test/resources/docu/images/de/scr10.png index 4eb50d3eb..ddf8a6fe3 100644 Binary files a/src/test/resources/docu/images/de/scr10.png and b/src/test/resources/docu/images/de/scr10.png differ diff --git a/src/test/resources/docu/images/de/scr11.png b/src/test/resources/docu/images/de/scr11.png index 9fe4cc849..ee58f6f7a 100644 Binary files a/src/test/resources/docu/images/de/scr11.png and b/src/test/resources/docu/images/de/scr11.png differ diff --git a/src/test/resources/docu/images/de/scr12.png b/src/test/resources/docu/images/de/scr12.png new file mode 100644 index 000000000..bc386306d Binary files /dev/null and b/src/test/resources/docu/images/de/scr12.png differ diff --git a/src/test/resources/docu/images/de/scr13.png b/src/test/resources/docu/images/de/scr13.png new file mode 100644 index 000000000..503fa28cd Binary files /dev/null and b/src/test/resources/docu/images/de/scr13.png differ diff --git a/src/test/resources/docu/images/de/scr14.png b/src/test/resources/docu/images/de/scr14.png new file mode 100644 index 000000000..d4aff4b14 Binary files /dev/null and b/src/test/resources/docu/images/de/scr14.png differ diff --git a/src/test/resources/docu/images/de/scr15.png b/src/test/resources/docu/images/de/scr15.png new file mode 100644 index 000000000..29dc4ab04 Binary files /dev/null and b/src/test/resources/docu/images/de/scr15.png differ diff --git a/src/test/resources/docu/images/de/scr16.png b/src/test/resources/docu/images/de/scr16.png new file mode 100644 index 000000000..edaa8ea99 Binary files /dev/null and b/src/test/resources/docu/images/de/scr16.png differ diff --git a/src/test/resources/docu/images/en/scr00.png b/src/test/resources/docu/images/en/scr00.png index df46b2aeb..9665e30d5 100644 Binary files a/src/test/resources/docu/images/en/scr00.png and b/src/test/resources/docu/images/en/scr00.png differ diff --git a/src/test/resources/docu/images/en/scr01.png b/src/test/resources/docu/images/en/scr01.png index f4867e587..22a005cce 100644 Binary files a/src/test/resources/docu/images/en/scr01.png and b/src/test/resources/docu/images/en/scr01.png differ diff --git a/src/test/resources/docu/images/en/scr02.png b/src/test/resources/docu/images/en/scr02.png index d9af7f33d..302bb1184 100644 Binary files a/src/test/resources/docu/images/en/scr02.png and b/src/test/resources/docu/images/en/scr02.png differ diff --git a/src/test/resources/docu/images/en/scr03.png b/src/test/resources/docu/images/en/scr03.png index 83fe28e28..613b64ad1 100644 Binary files a/src/test/resources/docu/images/en/scr03.png and b/src/test/resources/docu/images/en/scr03.png differ diff --git a/src/test/resources/docu/images/en/scr04.png b/src/test/resources/docu/images/en/scr04.png index 6ef15ab00..7714ce7d4 100644 Binary files a/src/test/resources/docu/images/en/scr04.png and b/src/test/resources/docu/images/en/scr04.png differ diff --git a/src/test/resources/docu/images/en/scr05.png b/src/test/resources/docu/images/en/scr05.png index dbcc2f8c3..809d43255 100644 Binary files a/src/test/resources/docu/images/en/scr05.png and b/src/test/resources/docu/images/en/scr05.png differ diff --git a/src/test/resources/docu/images/en/scr06.png b/src/test/resources/docu/images/en/scr06.png index a51126334..a5fb3da31 100644 Binary files a/src/test/resources/docu/images/en/scr06.png and b/src/test/resources/docu/images/en/scr06.png differ diff --git a/src/test/resources/docu/images/en/scr07.png b/src/test/resources/docu/images/en/scr07.png index cc6fc918b..d15039e8f 100644 Binary files a/src/test/resources/docu/images/en/scr07.png and b/src/test/resources/docu/images/en/scr07.png differ diff --git a/src/test/resources/docu/images/en/scr08.png b/src/test/resources/docu/images/en/scr08.png index 35bfa1018..c3ef7feed 100644 Binary files a/src/test/resources/docu/images/en/scr08.png and b/src/test/resources/docu/images/en/scr08.png differ diff --git a/src/test/resources/docu/images/en/scr09.png b/src/test/resources/docu/images/en/scr09.png index 638c9504f..a8c1ff341 100644 Binary files a/src/test/resources/docu/images/en/scr09.png and b/src/test/resources/docu/images/en/scr09.png differ diff --git a/src/test/resources/docu/images/en/scr10.png b/src/test/resources/docu/images/en/scr10.png index 3532980b7..6364b47d1 100644 Binary files a/src/test/resources/docu/images/en/scr10.png and b/src/test/resources/docu/images/en/scr10.png differ diff --git a/src/test/resources/docu/images/en/scr11.png b/src/test/resources/docu/images/en/scr11.png index 48d57d03d..ddd6edbdb 100644 Binary files a/src/test/resources/docu/images/en/scr11.png and b/src/test/resources/docu/images/en/scr11.png differ diff --git a/src/test/resources/docu/images/en/scr12.png b/src/test/resources/docu/images/en/scr12.png new file mode 100644 index 000000000..e4a64a66c Binary files /dev/null and b/src/test/resources/docu/images/en/scr12.png differ diff --git a/src/test/resources/docu/images/en/scr13.png b/src/test/resources/docu/images/en/scr13.png new file mode 100644 index 000000000..60aab5079 Binary files /dev/null and b/src/test/resources/docu/images/en/scr13.png differ diff --git a/src/test/resources/docu/images/en/scr14.png b/src/test/resources/docu/images/en/scr14.png new file mode 100644 index 000000000..393fc42ad Binary files /dev/null and b/src/test/resources/docu/images/en/scr14.png differ diff --git a/src/test/resources/docu/images/en/scr15.png b/src/test/resources/docu/images/en/scr15.png new file mode 100644 index 000000000..eb99c7e9a Binary files /dev/null and b/src/test/resources/docu/images/en/scr15.png differ diff --git a/src/test/resources/docu/images/en/scr16.png b/src/test/resources/docu/images/en/scr16.png new file mode 100644 index 000000000..2281de7d7 Binary files /dev/null and b/src/test/resources/docu/images/en/scr16.png differ diff --git a/src/test/resources/docu/static_de.xml b/src/test/resources/docu/static_de.xml index 1261d4369..bfa4d8a73 100644 --- a/src/test/resources/docu/static_de.xml +++ b/src/test/resources/docu/static_de.xml @@ -30,7 +30,7 @@ Im Hauptfenster können aus dem Menü Bauteile die verschiedenen Bauteile ausgewahlt werden. - Danach werden diese auf dem Zeichenfeld positioniert. Dieser Vorgang kann mit der ESC-Taste + Danach werden diese auf dem Zeichenfeld positioniert. Das Positionieren kann mit der ESC-Taste jederzeit abgebrochen werden. @@ -88,6 +88,35 @@ aktiv ist, verändert sich der Augang entsprechend der aktuellen Eingangszustände. Die Schaltung verhällt sich wie erwartet wie ein XOR-Gatter. + + Um die Schaltung weiter bearbeiten zu können, muss die Simulation zunächst gestoppt werden. + Dies geschieht am einfachsten mit dem Stop-Knopf in der ToolBar. + Durch Klicken mit der rechten Maustaste auf eine Komponente öffnet sich ein Dialog, welcher die + Eigenschaften dieser Komponente anzeigt. Für den ersten Eingang kann über diesen Dialog die + Bezeichnung 'A' festgelegt werden. + + + Auf diese Weise, können die Bezeichnungen für die übrigen Ein- und Ausgänge + definiert werden. + Im Hauptmenü im Menüpunkt Analyse findet sich auch ein Menüpunkt Analyse. Damit läst sich + eine Analyse der aktuellen Schaltung durchführen. Dies ist jedoch nur möglich, wenn alle Ein- und + Ausgänge mit einer Bezeichnung versehen sind. + + + Es öffnet sich ein Fenster, welches die Wahrheitstabelle der aktuellen Schaltung zeigt. Unter der + Tabelle findet sich der algebraische Ausdruck, welcher zu der Schaltung gehört. Gibt es mehrere + mögliche algebraische Ausdrücke, öffnet sich ein separates Fenster, welches alle Ausdrücke + anzeigt. + + + Der Tabellendialog hat in seinem Hauptmenü den Menüeintrag KV-Tafel. Über diesen läst sich die + Wahrheitstabelle in Form einer KV-Tafel anzeigen. + + + Oben in diesem Dialog gibt es eine Auswahlbox über welche der gewünschte Ausdruck in der KV-Tafel + ausgewählt werden kann. Auf diese Weise läst sich z.B. verdeutlichen, wie sich mehrere equivalente + algebraische Ausdrücke ergeben können. Durch Klicken in der KV-Tafel läst sich die Tabelle bearbeiten. + diff --git a/src/test/resources/docu/static_en.xml b/src/test/resources/docu/static_en.xml index 3b0e28c7b..2b3f0512b 100644 --- a/src/test/resources/docu/static_en.xml +++ b/src/test/resources/docu/static_en.xml @@ -78,6 +78,31 @@ By clicking with the mouse, the inputs can be switched. Since the simulation is now active, the output changes according to the current input states. The circuit behaves as expected like an XOR gate. + + To further process the circuit, the simulation must first be stopped. The easiest way to do this is + with the Stop button in the ToolBar. Clicking on a component with the right mouse button opens a + dialog which displays the properties of this component. The name 'A' can be defined for the first + input via this dialog. + + + In this way, the names for the remaining inputs and outputs can be defined. The menu item + Analysis also contains a menu item Analysis. This function performs an analysis of + the current circuit. However, this is only possible if all inputs and outputs are labeled. + + + It opens a window showing the truth table of the current circuit. Below the table is the algebraic + expression associated with the circuit. If there are several possible algebraic expressions, a + separate window will open showing all expressions. + + + The table dialog has the menu entry K-Map in its main menu. This allows to display the truth + table in the form of a K-map. + + + At the top of this dialog there is a drop-down list which allows the selection of the desired + expression in the K-map. In this way you can, for example, illustrate how several equivalent + algebraic expressions can result. By clicking in the K-map the table can be modified. +