From: Jim Procter Date: Mon, 18 Oct 2021 11:39:40 +0000 (+0100) Subject: JAL-3904 failing test X-Git-Tag: Release_2_11_2_1~75^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f2c4dcbf716ebf695ffe757c59185bbcb4e6e2ad;p=jalview.git JAL-3904 failing test --- diff --git a/src/jalview/api/structures/JalviewStructureDisplayI.java b/src/jalview/api/structures/JalviewStructureDisplayI.java index d8c8371..d0351a8 100644 --- a/src/jalview/api/structures/JalviewStructureDisplayI.java +++ b/src/jalview/api/structures/JalviewStructureDisplayI.java @@ -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(); + } diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index 021e2f6..f5d350c 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -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(); + } } diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index d397a6b..e8b5bea 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -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;