package jalview.gui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertTrue;
+
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import javax.swing.JButton;
import javax.swing.JPanel;
-import org.junit.Before;
-import org.junit.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
/**
* Unit tests for AnnotationChooser
AlignFrame af;
- @Before
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws IOException
{
+ // pin down annotation sort order for test
+ Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name());
+ final String True = Boolean.TRUE.toString();
+ Cache.applicationProperties.setProperty(
+ Preferences.SHOW_AUTOCALC_ABOVE, True);
+ Cache.applicationProperties.setProperty("SHOW_QUALITY", True);
+ Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True);
+ Cache.applicationProperties.setProperty("SHOW_IDENTITY", True);
+
AlignmentI al = new jalview.io.FormatAdapter().readFile(TEST_DATA,
AppletFormatAdapter.PASTE, "FASTA");
af = new AlignFrame(al, 700, 500);
/**
* Test creation of panel with OK and Cancel buttons
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testBuildActionButtonsPanel()
{
testee = new AnnotationChooser(parentPanel);
* Test 'Apply to' has 3 radio buttons enabled, 'Selected Sequences' selected,
* when there is a current selection group.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testBuildApplyToOptionsPanel_withSelectionGroup()
{
selectSequences(0, 2, 3);
* Test 'Apply to' has 1 radio button enabled, 'All Sequences' selected, when
* there is no current selection group.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testBuildApplyToOptionsPanel_noSelectionGroup()
{
testee = new AnnotationChooser(parentPanel);
/**
* Test Show and Hide radio buttons created, with Hide initially selected.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testBuildShowHidePanel()
{
testee = new AnnotationChooser(parentPanel);
/**
* Test construction of panel containing two sub-panels
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testBuildShowHideOptionsPanel()
{
testee = new AnnotationChooser(parentPanel);
* Test that annotation types are (uniquely) identified.
*
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testGetAnnotationTypes()
{
selectSequences(1);
* We expect all annotations of that type to be set hidden. Other annotations
* should be left visible.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testSelectType_hideForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set hidden. Other annotations should be left visible.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testSelectType_hideForSelected()
{
selectSequences(1, 2);
* We expect all annotations of that type to be set visible. Other annotations
* should be left unchanged.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testDeselectType_hideForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set visible. Other annotations should be left unchanged.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testDeselectType_hideForSelected()
{
selectSequences(1, 2);
* We expect all annotations of that type to be set visible. Other annotations
* should be left unchanged
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testSelectType_showForAll()
{
selectSequences(1, 2);
* We expect all annotations of that type, linked to the sequence group, to be
* set visible. Other annotations should be left unchanged
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testSelectType_showForSelected()
{
+ // sequences 1 and 2 have annotations IUPred and Jmol
selectSequences(1, 2);
testee = new AnnotationChooser(parentPanel);
final Checkbox showCheckbox = (Checkbox) getComponent(testee, 1, 0, 0);
setSelected(selectedSequencesCheckbox, true);
setSelected(hideCheckbox, true);
setSelected(getTypeCheckbox("JMol"), true);
+
assertTrue(anns[5].visible); // JMol for seq3
assertFalse(anns[7].visible); // JMol for seq1
// ...now show them...
* We expect all annotations of that type to be set hidden. Other annotations
* should be left unchanged.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testDeselectType_showForAll()
{
selectSequences(1, 2);
* We expect the annotations of that type, linked to the sequence group, to be
* set hidden. Other annotations should be left unchanged.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testDeselectType_showForSelected()
{
selectSequences(1, 2);
* Test cases include sequences in the selection group, and others not in the
* group.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testIsInActionScope_selectedScope()
{
// sequences 1 and 2 have annotations 4 and 3 respectively
* Test cases include sequences in the selection group, and others not in the
* group.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testIsInActionScope_unselectedScope()
{
// sequences 1 and 2 have annotations 4 and 3 respectively
/**
* Test that the reset method restores previous visibility flags.
*/
- @Test
+ @Test(groups ={ "Functional" })
public void testResetOriginalState()
{
testee = new AnnotationChooser(parentPanel);
assertTrue(anns[0].visible); // Conservation
assertTrue(anns[1].visible); // Quality
assertTrue(anns[2].visible); // Consensus
- assertFalse(anns[3].visible); // IUPRED
- assertTrue(anns[4].visible); // Beauty (not seq-related)
+ assertTrue(anns[3].visible); // Beauty (not seq-related)
+ assertFalse(anns[4].visible); // IUPRED
assertFalse(anns[5].visible); // JMol
assertFalse(anns[6].visible); // IUPRED
assertFalse(anns[7].visible); // JMol