1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertFalse; |
24 |
|
import static org.testng.Assert.assertTrue; |
25 |
|
|
26 |
|
import jalview.gui.JvOptionPane; |
27 |
|
|
28 |
|
import java.awt.Button; |
29 |
|
import java.awt.Event; |
30 |
|
import java.awt.event.MouseEvent; |
31 |
|
|
32 |
|
import org.testng.annotations.BeforeClass; |
33 |
|
import org.testng.annotations.Test; |
34 |
|
|
|
|
| 50% |
Uncovered Elements: 17 (34) |
Complexity: 3 |
Complexity Density: 0.1 |
|
35 |
|
public class PlatformTest |
36 |
|
{ |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
1 |
@BeforeClass(alwaysRun = true)... |
39 |
|
public void setUpJvOptionPane() |
40 |
|
{ |
41 |
1 |
JvOptionPane.setInteractiveMode(false); |
42 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
43 |
|
} |
44 |
|
|
45 |
|
Button b = new Button(); |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
3FAIL
|
|
51 |
0 |
@Test(groups = "Functional")... |
52 |
|
public void testIsControlDown_mac() |
53 |
|
{ |
54 |
0 |
int clickCount = 1; |
55 |
0 |
boolean isPopupTrigger = false; |
56 |
0 |
int buttonNo = MouseEvent.BUTTON1; |
57 |
0 |
boolean mac = true; |
58 |
|
|
59 |
0 |
int mods = 0; |
60 |
|
|
61 |
0 |
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
62 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
63 |
|
|
64 |
0 |
mods = Event.CTRL_MASK; |
65 |
0 |
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
66 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
67 |
|
|
68 |
0 |
mods = Event.META_MASK; |
69 |
0 |
assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
70 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
71 |
|
|
72 |
0 |
isPopupTrigger = true; |
73 |
0 |
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
74 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
75 |
|
|
76 |
0 |
isPopupTrigger = false; |
77 |
0 |
buttonNo = MouseEvent.BUTTON2; |
78 |
0 |
mods = 0; |
79 |
0 |
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
80 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
87 |
1 |
@Test(groups = "Functional")... |
88 |
|
public void testIsControlDown_notMac() |
89 |
|
{ |
90 |
1 |
int clickCount = 1; |
91 |
1 |
boolean isPopupTrigger = false; |
92 |
1 |
int buttonNo = MouseEvent.BUTTON1; |
93 |
1 |
boolean mac = false; |
94 |
|
|
95 |
1 |
int mods = 0; |
96 |
|
|
97 |
1 |
assertFalse(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
98 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
99 |
|
|
100 |
1 |
mods = Event.CTRL_MASK; |
101 |
1 |
assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
102 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
103 |
|
|
104 |
1 |
mods = Event.CTRL_MASK | Event.SHIFT_MASK | Event.ALT_MASK; |
105 |
1 |
clickCount = 2; |
106 |
1 |
buttonNo = 2; |
107 |
1 |
isPopupTrigger = true; |
108 |
1 |
assertTrue(Platform.isControlDown(new MouseEvent(b, 0, 0L, mods, 0, 0, |
109 |
|
0, 0, clickCount, isPopupTrigger, buttonNo), mac)); |
110 |
|
} |
111 |
|
} |