import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;
-import jalview.analysis.AlignmentGenerator;
-import jalview.gui.JvOptionPane;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
-import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.ThresholdType;
-
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.analysis.AlignmentGenerator;
+import jalview.gui.JvOptionPane;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField;
+import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.ThresholdType;
+
public class ColumnSelectionTest
{
*/
@Test(
groups = "Functional",
- expectedExceptions = { ConcurrentModificationException.class })
+ expectedExceptions =
+ { ConcurrentModificationException.class })
public void testGetSelected_concurrentModification()
{
ColumnSelection cs = new ColumnSelection();
assertEquals("[3, 1]", cs2.getSelected().toString());
}
-
@Test(groups = { "Functional" })
public void testStretchGroup_expand()
{
public void testFilterAnnotations()
{
ColumnSelection cs = new ColumnSelection();
+ AlignmentAnnotation alann = new AlignmentAnnotation("dummy",
+ "dummyDesc", null);
/*
* filter with no conditions clears the selection
Annotation[] anns = new Annotation[] { null };
AnnotationFilterParameter filter = new AnnotationFilterParameter();
cs.addElement(3);
- int added = cs.filterAnnotations(anns, filter);
+ alann.annotations = anns;
+ int added = cs.filterAnnotations(alann, filter);
assertEquals(0, added);
assertTrue(cs.isEmpty());
filter.addRegexSearchField(SearchableAnnotationField.DESCRIPTION);
Annotation helix = new Annotation("(", "hello", '<', 2f);
Annotation sheet = new Annotation("(", "world", '<', 2f);
- added = cs.filterAnnotations(new Annotation[] { null, helix, sheet },
- filter);
+ alann.annotations = new Annotation[] { null, helix, sheet };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(1, added);
assertTrue(cs.contains(2));
filter = new AnnotationFilterParameter();
filter.setRegexString("(");
filter.addRegexSearchField(SearchableAnnotationField.DISPLAY_STRING);
- added = cs.filterAnnotations(new Annotation[] { null, helix, sheet },
- filter);
+ alann.annotations = new Annotation[] { null, helix, sheet };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(2, added);
assertTrue(cs.contains(1));
assertTrue(cs.contains(2));
sheet = new Annotation("x", "desc", 'E', 1f);
Annotation turn = new Annotation("x", "desc", 'S', 2f);
Annotation ann4 = new Annotation("x", "desc", 'Y', 3f);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 },
- filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(1, added);
assertTrue(cs.contains(1));
* select Helix and Sheet (E)
*/
filter.setFilterBetaSheet(true);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(2, added);
assertTrue(cs.contains(1));
assertTrue(cs.contains(2));
*/
filter.setFilterAlphaHelix(false);
filter.setFilterTurn(true);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(2, added);
assertTrue(cs.contains(2));
assertTrue(cs.contains(3));
filter = new AnnotationFilterParameter();
filter.setThresholdType(ThresholdType.BELOW_THRESHOLD);
filter.setThresholdValue(2f);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(2, added);
assertTrue(cs.contains(1));
assertTrue(cs.contains(2));
* select value > 2f (ann4 only)
*/
filter.setThresholdType(ThresholdType.ABOVE_THRESHOLD);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(1, added);
assertTrue(cs.contains(4));
* select >2f or Helix
*/
filter.setFilterAlphaHelix(true);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(2, added);
assertTrue(cs.contains(1));
assertTrue(cs.contains(4));
*/
filter.setThresholdType(ThresholdType.BELOW_THRESHOLD);
filter.setThresholdValue(1f);
- added = cs
- .filterAnnotations(new Annotation[]
- { null, helix, sheet, turn, ann4 }, filter);
+ alann.annotations = new Annotation[] { null, helix, sheet, turn, ann4 };
+ added = cs.filterAnnotations(alann, filter);
assertEquals(1, added);
assertTrue(cs.contains(1));
}