import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.analysis.Finder;
+import jalview.api.AlignViewControllerI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.io.FileLoader;
+import jalview.io.FormatAdapter;
+import java.util.Arrays;
import java.util.BitSet;
import org.testng.annotations.Test;
assertEquals(0, seqCount);
assertEquals(0, bs.cardinality());
}
+
+ /**
+ * shameless copy of test data from findFeature for testing mark columns from
+ * highlight
+ */
+ @Test(groups = "Functional")
+ public void testSelectColumnsWithHighlight()
+ {
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ "seq1 aMMMaaaaaaaaaaaaaaaa\n" + "seq2 aaaMMMMMMMaaaaaaaaaa\n"
+ + "seq3 aaaaaaaaaaMMMMMaaaaa\n"
+ + "seq4 aaaaaaaaaaaaaaaaaaaa\n", FormatAdapter.PASTE);
+
+ SearchResultsI sr = new SearchResults();
+ SequenceI[] sqs = af.getViewport().getAlignment().getSequencesArray();
+ SequenceI seq1 = sqs[0];
+ SequenceI seq2 = sqs[1];
+ SequenceI seq3 = sqs[2];
+ SequenceI seq4 = sqs[3];
+
+ /*
+ * features start/end are base 1
+ */
+ sr.addResult(seq1, 2, 4);
+ sr.addResult(seq2, 4, 10);
+ sr.addResult(seq3, 11, 15);
+
+ /*
+ * test Match/Find works first
+ */
+ Finder f = new Finder(af.getViewport().getAlignment(), null);
+ f.setFindAll(true);
+ f.setCaseSensitive(true);
+ f.find("M+");
+ assertEquals(
+ "Finder found different set of results to manually created SearchResults",
+ f.getSearchResults(), sr);
+
+ /*
+ * now check simple mark columns from find operation
+ */
+ af.getViewport().setSearchResults(sr);
+ AlignViewControllerI avc = af.avc;
+
+ avc.markHighlightedColumns(false, false, false);
+ assertEquals("Didn't select highlighted columns", af.getViewport()
+ .getColumnSelection().getSelectedRanges(),
+ Arrays.asList(new int[][] { { 1, 13 } }));
+ }
}