equal
deleted
inserted
replaced
44 private int[][] pointsToCheck; |
44 private int[][] pointsToCheck; |
45 |
45 |
46 private static Robot robot; |
46 private static Robot robot; |
47 |
47 |
48 public ShapeNotSetSometimes() throws Exception { |
48 public ShapeNotSetSometimes() throws Exception { |
49 EventQueue.invokeAndWait(new Runnable() { |
49 EventQueue.invokeAndWait(this::initializeGUI); |
50 public void run() { |
50 robot.waitForIdle(); |
51 initializeGUI(); |
|
52 } |
|
53 }); |
|
54 } |
51 } |
55 |
52 |
56 private void initializeGUI() { |
53 private void initializeGUI() { |
57 backgroundFrame = new BackgroundFrame(); |
54 backgroundFrame = new BackgroundFrame(); |
58 backgroundFrame.setUndecorated(true); |
55 backgroundFrame.setUndecorated(true); |
117 } |
114 } |
118 |
115 |
119 public static void main(String[] args) throws Exception { |
116 public static void main(String[] args) throws Exception { |
120 robot = new Robot(); |
117 robot = new Robot(); |
121 |
118 |
122 for(int i = 0; i < 100; i++) { |
119 for(int i = 0; i < 50; i++) { |
123 System.out.println("Attempt " + i); |
120 System.out.println("Attempt " + i); |
124 new ShapeNotSetSometimes().doTest(); |
121 new ShapeNotSetSometimes().doTest(); |
125 } |
122 } |
126 } |
123 } |
127 |
124 |
132 robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); |
129 robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); |
133 robot.delay(10); |
130 robot.delay(10); |
134 robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); |
131 robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); |
135 robot.delay(500); |
132 robot.delay(500); |
136 |
133 |
137 EventQueue.invokeAndWait(new Runnable() { |
134 EventQueue.invokeAndWait(window::requestFocus); |
138 public void run() { |
|
139 window.requestFocus(); |
|
140 } |
|
141 }); |
|
142 |
135 |
143 robot.waitForIdle(); |
136 robot.waitForIdle(); |
144 try { |
137 try { |
145 Thread.sleep(300); |
138 Thread.sleep(300); |
146 } catch (InterruptedException e) { |
139 } catch (InterruptedException e) { |