From 46120698389d42367d1793f219b9524ec52c0864 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 1 Nov 2016 16:32:09 +0000 Subject: [PATCH] JAL-1738 JAL-345 trivial tests for relocated SearchResultsI ref on AlignViewportI --- test/jalview/gui/AlignViewportTest.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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()); + } } -- 1.7.10.2