1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package de.aikiit.fotorenamer.util;
16
17 import org.junit.jupiter.api.Disabled;
18 import org.junit.jupiter.api.Test;
19
20 import javax.swing.*;
21 import java.awt.*;
22
23 import static de.aikiit.fotorenamer.util.ComponentGaugeUtil.createImageIcon;
24 import static de.aikiit.fotorenamer.util.ComponentGaugeUtil.makeCentered;
25 import static org.junit.jupiter.api.Assertions.*;
26
27
28
29
30
31
32
33 @Disabled("No X11 on GHA")
34 class ComponentGaugeUtilTest {
35
36
37
38 @Test
39 void createIconFromStringPath() {
40
41
42 assertNull(createImageIcon("wuumansho"));
43 }
44
45
46
47
48 @Test
49 void createIconFromStringPathWithAssertionFailure() {
50 assertThrows(AssertionError.class, () ->
51 assertNull(createImageIcon(null))
52 );
53 }
54
55
56
57
58
59 @Test
60 void gaugeSwingComponent() {
61 JButton button = new JButton("Test");
62 Point buttonSize = button.getLocation();
63 assertEquals(new Point(0, 0), buttonSize);
64 makeCentered(button);
65 assertNotSame(new Point(0, 0), button.getLocation());
66 }
67
68 }