mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
added input invert editor gui test
This commit is contained in:
parent
84ac10aeb6
commit
0064bf822a
@ -662,6 +662,26 @@ public class TestInGUI extends TestCase {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public void testInputInvertEdit() {
|
||||
new GuiTester("dig/manualError/14_inputInvert.dig")
|
||||
.add(new SetMouseToElement((v) -> v.equalsDescription(And.DESCRIPTION)))
|
||||
.mouseClick(InputEvent.BUTTON3_MASK)
|
||||
.delay(500)
|
||||
.press("TAB", 3)
|
||||
.press("SPACE")
|
||||
.delay(200)
|
||||
.press("TAB", "SPACE", "TAB", "SPACE")
|
||||
.delay(200)
|
||||
.press("TAB", "TAB", "TAB", "SPACE")
|
||||
.delay(200)
|
||||
.press("F8")
|
||||
.delay(200)
|
||||
.add(new GuiTester.CheckTextInWindow<>(ValueTableDialog.class, Lang.get("msg_test_N_Passed", "")))
|
||||
.add(new GuiTester.CheckTableRows<>(ValueTableDialog.class, 4))
|
||||
.add(new GuiTester.CloseTopMost())
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
public static class CheckErrorDialog extends GuiTester.WindowCheck<ErrorMessage.ErrorDialog> {
|
||||
private final String[] expected;
|
||||
@ -800,18 +820,14 @@ public class TestInGUI extends TestCase {
|
||||
@Override
|
||||
public void checkWindow(GuiTester guiTester, Main main) throws Exception {
|
||||
Thread.sleep(200);
|
||||
Circuit c = main.getCircuitComponent().getCircuit();
|
||||
VisualElement found = null;
|
||||
int foundCounter = 0;
|
||||
for (VisualElement v : c.getElements())
|
||||
if (v.equalsDescription(description)) {
|
||||
found = v;
|
||||
foundCounter++;
|
||||
}
|
||||
List<VisualElement> el = main
|
||||
.getCircuitComponent()
|
||||
.getCircuit()
|
||||
.findElements(v -> v.equalsDescription(description));
|
||||
|
||||
assertEquals("not exact one " + description.getName() + " found in circuit", 1, foundCounter);
|
||||
assertEquals("not exact one " + description.getName() + " found in circuit", 1, el.size());
|
||||
|
||||
final Vector posInCirc = found.getPos().add(dx, dy);
|
||||
final Vector posInCirc = el.get(0).getPos().add(dx, dy);
|
||||
Point p = main.getCircuitComponent().transform(posInCirc);
|
||||
SwingUtilities.convertPointToScreen(p, main.getCircuitComponent());
|
||||
|
||||
@ -821,7 +837,36 @@ public class TestInGUI extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private class ClickInputsAndOutputs extends GuiTester.WindowCheck<NumberingWizard> {
|
||||
private static class SetMouseToElement extends GuiTester.WindowCheck<Main> {
|
||||
private final Circuit.ElementFilter filter;
|
||||
|
||||
public SetMouseToElement(Circuit.ElementFilter filter) {
|
||||
super(Main.class);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkWindow(GuiTester guiTester, Main main) throws Exception {
|
||||
Thread.sleep(200);
|
||||
|
||||
List<VisualElement> el = main
|
||||
.getCircuitComponent()
|
||||
.getCircuit()
|
||||
.findElements(filter);
|
||||
|
||||
assertEquals("not exact one element found in circuit", 1, el.size());
|
||||
|
||||
final VisualElement ve = el.get(0);
|
||||
GraphicMinMax mm = ve.getMinMax(false);
|
||||
Vector pos = mm.getMin().add(mm.getMax()).div(2);
|
||||
Point p = main.getCircuitComponent().transform(pos);
|
||||
SwingUtilities.convertPointToScreen(p, main.getCircuitComponent());
|
||||
|
||||
guiTester.getRobot().mouseMove(p.x, p.y);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClickInputsAndOutputs extends GuiTester.WindowCheck<NumberingWizard> {
|
||||
public ClickInputsAndOutputs() {
|
||||
super(NumberingWizard.class);
|
||||
}
|
||||
@ -846,7 +891,7 @@ public class TestInGUI extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private class PinNameChecker extends GuiTester.WindowCheck<Main> {
|
||||
private static class PinNameChecker extends GuiTester.WindowCheck<Main> {
|
||||
private final String prefix;
|
||||
|
||||
public PinNameChecker(String prefix) {
|
||||
@ -864,7 +909,7 @@ public class TestInGUI extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
private class CheckOutputValue extends GuiTester.WindowCheck<Main> {
|
||||
private static class CheckOutputValue extends GuiTester.WindowCheck<Main> {
|
||||
private final int val;
|
||||
|
||||
public CheckOutputValue(int val) {
|
||||
|
73
src/test/resources/dig/manualError/14_inputInvert.dig
Normal file
73
src/test/resources/dig/manualError/14_inputInvert.dig
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes/>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="340" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="340" y="160"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>Y</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="480" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B Y
|
||||
0 0 0
|
||||
0 1 0
|
||||
1 0 1
|
||||
1 1 0
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="360" y="180"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="340" y="160"/>
|
||||
<p2 x="360" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="120"/>
|
||||
<p2 x="380" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="140"/>
|
||||
<p2 x="480" y="140"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
Loading…
x
Reference in New Issue
Block a user