From: Jim Procter Date: Tue, 1 Nov 2016 16:32:09 +0000 (+0000) Subject: JAL-1738 JAL-345 trivial tests for relocated SearchResultsI ref on AlignViewportI X-Git-Tag: Release_2_10_1~10^2~6^2~1^2~18 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=46120698389d42367d1793f219b9524ec52c0864;p=jalview.git JAL-1738 JAL-345 trivial tests for relocated SearchResultsI ref on AlignViewportI --- diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 00c52ed..dfe0e68 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -35,6 +35,8 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.io.FileLoader; @@ -347,4 +349,28 @@ public class AlignViewportTest af.getViewport().setGlobalColourScheme(cs); assertFalse(cs.conservationApplied()); } + + @Test(groups = { "Functional" }) + public void testSetGetHasSearchResults() + { + AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( + "examples/uniref50.fa", FormatAdapter.FILE); + SearchResultsI sr = new SearchResults(); + SequenceI s1 = af.getViewport().getAlignment().getSequenceAt(0); + + // create arbitrary range on first sequence + sr.addResult(s1, s1.getStart() + 10, s1.getStart() + 15); + + // test set + af.getViewport().setSearchResults(sr); + // has -> true + assertTrue(af.getViewport().hasSearchResults()); + // get == original + assertEquals(sr, af.getViewport().getSearchResults()); + + // set(null) results in has -> false + + af.getViewport().setSearchResults(null); + assertFalse(af.getViewport().hasSearchResults()); + } }