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.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
import jalview.datamodel.SequenceGroup; |
27 |
|
import jalview.io.DataSourceType; |
28 |
|
import jalview.io.FileLoader; |
29 |
|
|
30 |
|
import javax.swing.JTextArea; |
31 |
|
|
32 |
|
import junit.extensions.PA; |
33 |
|
|
34 |
|
import org.testng.annotations.Test; |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 2 |
Complexity Density: 0.1 |
|
36 |
|
public class PairwiseAlignmentPanelTest |
37 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
38 |
1 |
@Test(groups = "Functional")... |
39 |
|
public void testConstructor_withSelectionGroup() |
40 |
|
{ |
41 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( |
42 |
|
"examples/uniref50.fa", DataSourceType.FILE); |
43 |
1 |
AlignViewport viewport = af.getViewport(); |
44 |
1 |
AlignmentI al = viewport.getAlignment(); |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
1 |
SequenceGroup sg = new SequenceGroup(); |
52 |
1 |
sg.addSequence(al.getSequenceAt(3), false); |
53 |
1 |
sg.addSequence(al.getSequenceAt(4), false); |
54 |
1 |
sg.setStartRes(28); |
55 |
1 |
sg.setEndRes(35); |
56 |
1 |
viewport.setSelectionGroup(sg); |
57 |
|
|
58 |
1 |
PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport); |
59 |
|
|
60 |
1 |
String text = ((JTextArea) PA.getValue(testee, "textarea")).getText(); |
61 |
1 |
String expected = "Score = 80.0\n" + "Length of alignment = 4\n" |
62 |
|
+ "Sequence FER1_PEA/29-32 (Sequence length = 7)\n" |
63 |
|
+ "Sequence Q93XJ9_SOLTU/23-26 (Sequence length = 7)\n\n" |
64 |
|
+ " FER1_PEA/29-32 TKAF\n" + " ||.\n" |
65 |
|
+ "Q93XJ9_SOLTU/23-26 LKAI\n\n" + "Percentage ID = 50.00\n\n"; |
66 |
1 |
assertEquals(text, expected); |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
75 |
1 |
@Test(groups = "Functional")... |
76 |
|
public void testConstructor_noSelectionGroup() |
77 |
|
{ |
78 |
1 |
String seqs = ">Q93XJ9_SOLTU/23-29\nL-KAISNV\n>FER1_PEA/26-32\nV-TTTKAF\n"; |
79 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs, |
80 |
|
DataSourceType.PASTE); |
81 |
1 |
AlignViewport viewport = af.getViewport(); |
82 |
|
|
83 |
1 |
PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport); |
84 |
|
|
85 |
1 |
String text = ((JTextArea) PA.getValue(testee, "textarea")).getText(); |
86 |
1 |
String expected = "Score = 80.0\n" + "Length of alignment = 4\n" |
87 |
|
+ "Sequence FER1_PEA/29-32 (Sequence length = 7)\n" |
88 |
|
+ "Sequence Q93XJ9_SOLTU/23-26 (Sequence length = 7)\n\n" |
89 |
|
+ " FER1_PEA/29-32 TKAF\n" + " ||.\n" |
90 |
|
+ "Q93XJ9_SOLTU/23-26 LKAI\n\n" + "Percentage ID = 50.00\n\n"; |
91 |
1 |
assertEquals(text, expected); |
92 |
|
} |
93 |
|
} |