JAL-3493 failing test - creates a highlight and column selection and then called...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 29 Jun 2020 16:19:19 +0000 (17:19 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 29 Jun 2020 17:32:29 +0000 (18:32 +0100)
 Conflicts:
test/jalview/gui/SeqCanvasTest.java

test/jalview/gui/SeqCanvasTest.java

index 21d67f4..de33b52 100644 (file)
  */
 package jalview.gui;
 
-import static org.testng.Assert.assertEquals;
-
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentI;
 import jalview.io.DataSourceType;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
 import jalview.io.FileLoader;
 import jalview.util.Platform;
 import jalview.viewmodel.ViewportRanges;
@@ -35,6 +35,11 @@ import java.awt.FontMetrics;
 
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 
 import junit.extensions.PA;
 
@@ -369,4 +374,24 @@ public class SeqCanvasTest
     int h = charHeight * (2 + al.getHeight());
     assertEquals(repeatingHeight, h);
   }
+  @Test(groups = "Functional")
+  public void testClear_HighlightAndSelection()
+  {
+    AlignViewport av = af.getViewport();
+    SearchResultsI highlight = new SearchResults();
+    highlight.addResult(
+            av.getAlignment().getSequenceAt(1).getDatasetSequence(), 50,
+            80);
+    af.alignPanel.highlightSearchResults(highlight);
+    af.avc.markHighlightedColumns(false, false, false);
+    assertNotNull(av.getSearchResults(),
+            "No highlight was created on alignment");
+    assertFalse(av.getColumnSelection().isEmpty(),
+            "No selection was created from highlight");
+    af.deselectAllSequenceMenuItem_actionPerformed(null);
+    assertTrue(av.getColumnSelection().isEmpty(),
+            "No Selection should be present after deselecting all.");
+    assertNull(av.getSearchResults(),
+            "No higlighted search results should be present after deselecting all.");
+  }
 }