1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.junit.Assert.assertNotEquals; |
24 |
|
import static org.testng.Assert.assertEquals; |
25 |
|
import static org.testng.Assert.assertFalse; |
26 |
|
import static org.testng.Assert.assertNotSame; |
27 |
|
import static org.testng.Assert.assertSame; |
28 |
|
import static org.testng.Assert.assertTrue; |
29 |
|
|
30 |
|
import java.awt.Color; |
31 |
|
import java.util.Iterator; |
32 |
|
|
33 |
|
import javax.swing.SwingUtilities; |
34 |
|
|
35 |
|
import org.junit.Assert; |
36 |
|
import org.testng.annotations.AfterMethod; |
37 |
|
import org.testng.annotations.BeforeClass; |
38 |
|
import org.testng.annotations.BeforeMethod; |
39 |
|
import org.testng.annotations.Test; |
40 |
|
|
41 |
|
import jalview.api.FeatureColourI; |
42 |
|
import jalview.bin.Cache; |
43 |
|
import jalview.bin.Jalview; |
44 |
|
import jalview.datamodel.Alignment; |
45 |
|
import jalview.datamodel.AlignmentI; |
46 |
|
import jalview.datamodel.HiddenColumns; |
47 |
|
import jalview.datamodel.Sequence; |
48 |
|
import jalview.datamodel.SequenceFeature; |
49 |
|
import jalview.datamodel.SequenceGroup; |
50 |
|
import jalview.datamodel.SequenceI; |
51 |
|
import jalview.io.DataSourceType; |
52 |
|
import jalview.io.FileLoader; |
53 |
|
import jalview.project.Jalview2xmlTests; |
54 |
|
import jalview.renderer.ResidueShaderI; |
55 |
|
import jalview.schemes.BuriedColourScheme; |
56 |
|
import jalview.schemes.FeatureColour; |
57 |
|
import jalview.schemes.HelixColourScheme; |
58 |
|
import jalview.schemes.JalviewColourScheme; |
59 |
|
import jalview.schemes.StrandColourScheme; |
60 |
|
import jalview.schemes.TurnColourScheme; |
61 |
|
import jalview.util.MessageManager; |
62 |
|
|
|
|
| 94.1% |
Uncovered Elements: 2 (34) |
Complexity: 9 |
Complexity Density: 0.35 |
|
63 |
|
public class DesktopTests |
64 |
|
{ |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
66 |
1 |
@BeforeClass(alwaysRun = true)... |
67 |
|
public static void setUpBeforeClass() throws Exception |
68 |
|
{ |
69 |
1 |
setUpJvOptionPane(); |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
74 |
1 |
Jalview.main(new String[] { "--nonews" }); |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
77 |
1 |
@AfterMethod(alwaysRun = true)... |
78 |
|
public void tearDown() |
79 |
|
{ |
80 |
1 |
Desktop.instance.closeAll_actionPerformed(null); |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
88 |
1 |
public AlignFrame loadTestFile()... |
89 |
|
{ |
90 |
1 |
Cache.loadProperties("test/jalview/io/testProps.jvprops"); |
91 |
1 |
Cache.applicationProperties.setProperty("SHOW_IDENTITY", |
92 |
|
Boolean.TRUE.toString()); |
93 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( |
94 |
|
"examples/uniref50.fa", DataSourceType.FILE); |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
1 |
do |
100 |
|
{ |
101 |
1 |
try |
102 |
|
{ |
103 |
1 |
Thread.sleep(50); |
104 |
|
} catch (InterruptedException x) |
105 |
|
{ |
106 |
|
} |
107 |
1 |
} while (af.getViewport().getCalcManager().isWorking()); |
108 |
1 |
return af; |
109 |
|
} |
110 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
111 |
1 |
public static void setUpJvOptionPane()... |
112 |
|
{ |
113 |
1 |
JvOptionPane.setInteractiveMode(false); |
114 |
1 |
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); |
115 |
|
} |
116 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1PASS
|
|
117 |
1 |
@Test(groups = { "Functional" })... |
118 |
|
public void testInternalCopyPaste() |
119 |
|
{ |
120 |
1 |
AlignFrame internalSource = loadTestFile(); |
121 |
|
|
122 |
1 |
try |
123 |
|
{ |
124 |
1 |
SwingUtilities.invokeAndWait(new Runnable() |
125 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
126 |
1 |
@Override... |
127 |
|
public void run() |
128 |
|
{ |
129 |
1 |
internalSource.selectAllSequenceMenuItem_actionPerformed(null); |
130 |
1 |
internalSource.copy_actionPerformed(); |
131 |
1 |
Desktop.instance.paste(); |
132 |
|
} |
133 |
|
}); |
134 |
|
} catch (Exception x) |
135 |
|
{ |
136 |
0 |
Assert.fail("Unexpected exception " + x); |
137 |
|
} |
138 |
1 |
AlignFrame[] alfs = Desktop.getDesktopAlignFrames(); |
139 |
1 |
Assert.assertEquals("Expect just 2 alignment frames", 2, alfs.length); |
140 |
|
|
141 |
1 |
AlignmentI dataset = internalSource.getViewport().getAlignment() |
142 |
|
.getDataset(); |
143 |
1 |
Assert.assertNotNull(dataset); |
144 |
|
|
145 |
1 |
for (AlignFrame alf : alfs) |
146 |
|
{ |
147 |
2 |
Assert.assertTrue( |
148 |
|
"Internal paste should yield alignment with same dataset.", |
149 |
|
dataset == alf.getViewport().getAlignment().getDataset()); |
150 |
|
} |
151 |
|
|
152 |
|
} |
153 |
|
} |