JAL-3904 failing test
authorJim Procter <j.procter@dundee.ac.uk>
Mon, 18 Oct 2021 11:39:40 +0000 (12:39 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Mon, 18 Oct 2021 11:54:34 +0000 (12:54 +0100)
src/jalview/api/structures/JalviewStructureDisplayI.java
src/jalview/gui/StructureViewerBase.java
test/jalview/ext/rbvi/chimera/JalviewChimeraView.java

index d8c8371..d0351a8 100644 (file)
@@ -161,4 +161,10 @@ public interface JalviewStructureDisplayI
    */
   void stopProgressBar(String msg, long handle);
 
+  /**
+   * 
+   * @return true if the actions menu is shown for this viewer
+   */
+  boolean hasViewerActionsMenu();
+
 }
index 021e2f6..f5d350c 100644 (file)
@@ -1276,5 +1276,9 @@ public abstract class StructureViewerBase extends GStructureViewer
                       + ex.getMessage());
     }
   }
-
+  @Override
+  public boolean hasViewerActionsMenu()
+  {
+    return viewerActionMenu!=null && viewerActionMenu.isEnabled() && viewerActionMenu.getItemCount()>0 && viewerActionMenu.isVisible();
+  }
 }
index d397a6b..e8b5bea 100644 (file)
@@ -39,8 +39,10 @@ import jalview.api.FeatureRenderer;
 import jalview.api.structures.JalviewStructureDisplayI;
 import jalview.bin.Cache;
 import jalview.bin.Jalview;
+import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
@@ -118,6 +120,7 @@ public class JalviewChimeraView
   @Test(groups = { "External" })
   public void testSingleSeqViewChimera()
   {
+
     String inFile = "examples/1gaq.txt";
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(inFile,
             DataSourceType.FILE);
@@ -139,7 +142,7 @@ public class JalviewChimeraView
     /*
      * Wait for viewer load thread to complete
      */
-    while (!binding.isFinishedInit())
+    do
     {
       try
       {
@@ -147,11 +150,36 @@ public class JalviewChimeraView
       } catch (InterruptedException e)
       {
       }
-    }
+    } while (!binding.isFinishedInit()  ||  !chimeraViewer.isVisible());
 
     assertTrue(binding.isViewerRunning(), "Failed to start Chimera");
 
     assertEquals(chimeraViewer.getBinding().getPdbCount(), 1);
+    assertTrue(chimeraViewer.hasViewerActionsMenu());
+
+    // now add another sequence and bind to view
+    // 
+    AlignmentI al = af.getViewport().getAlignment();
+    PDBEntry xpdb = al.getSequenceAt(0).getPDBEntry("1GAQ");
+    sq = new Sequence("1GAQ", al.getSequenceAt(0).getSequence(25, 95).toString());
+    al.addSequence(sq);
+    structureViewer.viewStructures(new PDBEntry[] { xpdb }, new SequenceI[] { sq }, af.getCurrentView().getAlignPanel());
+
+    /*
+     * Wait for viewer load thread to complete
+     */
+    do 
+    {
+      try {
+        Thread.sleep(1500);
+      } catch (InterruptedException q) {};
+    } while (!binding.isLoadingFinished());
+    
+    // still just one PDB structure shown
+    assertEquals(chimeraViewer.getBinding().getPdbCount(), 1);
+    // and the viewer action menu should still be visible
+    assertTrue(chimeraViewer.hasViewerActionsMenu());
+
     chimeraViewer.closeViewer(true);
     chimeraViewer = null;
     return;