gui tests are running on Win7

This commit is contained in:
hneemann 2018-02-02 18:23:36 +01:00
parent 515bb73d96
commit d0efbcdbfa
2 changed files with 15 additions and 9 deletions

View File

@ -16,6 +16,7 @@ import java.util.ArrayList;
import static java.awt.event.InputEvent.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class GuiTester {
@ -548,7 +549,12 @@ public class GuiTester {
* @param expectedColor the expected color
*/
public ColorPicker(Class<? extends Component> target, int x, int y, Color expectedColor) {
this(target, x, y, (c) -> assertEquals(expectedColor, c));
this(target, x, y, (c) -> {
boolean ok = (Math.abs (expectedColor.getRed() - c.getRed()) < 5)
&& (Math.abs(expectedColor.getGreen() - c.getGreen()) < 5)
&& (Math.abs(expectedColor.getBlue() - c.getBlue()) < 5);
assertTrue("expected:<" + expectedColor + "> but was:<" + c + ">", ok);
});
}
/**

View File

@ -201,14 +201,14 @@ public class TestInGUI extends TestCase {
.use(createNew4VarTruthTable)
.add(new EnterTruthTable(0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1))
.press("F1")
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 144, 109, new Color(191,127,127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 266, 110, new Color(127,127,191)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 82, 168, new Color(255,127,127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 205, 170, new Color(127,255,127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 143, 232, new Color(127,127,255)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 265, 230, new Color(255,127,255)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 83, 292, new Color(227,227,127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 204, 291, new Color(127,255,255)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 144, 109, new Color(191, 127, 127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 266, 110, new Color(127, 127, 191)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 82, 168, new Color(255, 127, 127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 205, 170, new Color(127, 255, 127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 143, 232, new Color(127, 127, 255)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 265, 230, new Color(255, 127, 255)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 83, 292, new Color(227, 227, 127)))
.add(new GuiTester.ColorPicker(KarnaughMapComponent.class, 204, 291, new Color(127, 255, 255)))
// .add(new GuiTester.ColorPickerCreator(KarnaughMapComponent.class))
// .ask("Shows the k-map a checkerboard pattern?")
.add(new GuiTester.CloseTopMost())