| 242 // give WM time to deliver the event |
241 // give WM time to deliver the event |
| 243 TimeUnit.MILLISECONDS.sleep(100); |
242 TimeUnit.MILLISECONDS.sleep(100); |
| 244 // then |
243 // then |
| 245 SwingUtilities.invokeAndWait(() -> assertNull(tf.getSelectedText())); |
244 SwingUtilities.invokeAndWait(() -> assertNull(tf.getSelectedText())); |
| 246 } |
245 } |
| |
246 |
| |
247 @Test |
| |
248 void testFont() { |
| |
249 final var tf = new SudokuTextField(); |
| |
250 assertEquals(18, tf.getFont().getSize()); |
| |
251 } |
| |
252 |
| |
253 @Test |
| |
254 void testAlignment() { |
| |
255 final var tf = new SudokuTextField(); |
| |
256 assertEquals(JTextField.CENTER, tf.getHorizontalAlignment()); |
| |
257 } |
| |
258 |
| |
259 @Test |
| |
260 void testBackground() { |
| |
261 final var tf = new SudokuTextField(); |
| |
262 assertEquals(Color.WHITE, tf.getBackground()); |
| |
263 } |
| |
264 |
| |
265 @Test |
| |
266 void testSize() { |
| |
267 final var tf = new SudokuTextField(); |
| |
268 final var expected = new Dimension(40, 40); |
| |
269 assertEquals(expected, tf.getMinimumSize()); |
| |
270 assertEquals(expected, tf.getPreferredSize()); |
| |
271 assertEquals(expected, tf.getMaximumSize()); |
| |
272 } |
| |
273 |
| |
274 @Test |
| |
275 void testBorder() { |
| |
276 final var tf = new SudokuTextField(); |
| |
277 assertNull(tf.getBorder()); |
| |
278 } |
| 247 } |
279 } |