From: Jim Procter Date: Wed, 7 Feb 2018 13:08:22 +0000 (+0000) Subject: JAL-2780 JAL-2781 JAL-2902 refactored helper method in test for programmatically... X-Git-Tag: Release_2_10_4~68^2~32 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=195a6e587f98547544ede302b8670f37408076e9 JAL-2780 JAL-2781 JAL-2902 refactored helper method in test for programmatically viewing structure via structure chooser --- diff --git a/test/jalview/structure/StructureSelectionManagerTest.java b/test/jalview/structure/StructureSelectionManagerTest.java index 2e00144..96d36ba 100644 --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@ -20,11 +20,13 @@ */ package jalview.structure; +import static org.junit.Assert.assertArrayEquals; import static org.testng.Assert.assertNotNull; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertTrue; import jalview.analysis.AlignmentUtils; +import jalview.api.structures.JalviewStructureDisplayI; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -238,32 +240,11 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase AlignmentI al = alf.getViewport().getAlignment(); SequenceI seq = al.getSequenceAt(0); assertEquals(470, seq.getStart()); - SequenceI[] selectedSeqs = new SequenceI[] { seq }; - // load 4IM2 (full length, SIFTS) SiftsSettings.setMapWithSifts(true); StructureImportSettings.setProcessSecondaryStructure(true); StructureImportSettings.setVisibleChainAnnotation(true); - - StructureChooser schoose = new StructureChooser(selectedSeqs, seq, - alf.getViewport().getAlignPanel()); - - try - { - Thread.sleep(5000); - } catch (InterruptedException q) - { - } - ; - schoose.selectStructure(PDBID); - schoose.ok_ActionPerformed(); - try - { - Thread.sleep(10000); - } catch (InterruptedException q) - { - } - ; + openStructureViaChooser(alf, seq, PDBID); AlignmentAnnotation subseq_tf=null; assertTrue(seq.getDBRefs() != null && seq.getDBRefs().length > 0); @@ -294,13 +275,7 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase // verify location of secondary structure annotation // Specific positions: LYS477 (h),THR478 (no helix), ... GLY496(no helix), // GLU497 (helix), - PDBEntry pdbe = seq.getPDBEntry(PDBID); - StructureMapping[] sm = alf.alignPanel.getStructureSelectionManager() - .getMapping(pdbe.getFile()); - assertNotNull(sm); - assertNotNull(sm[0]); - List ranges = sm[0].getPDBResNumRanges(seq.getStart(),seq.getEnd()); // check there is or is not a tempfactor for each mapped position, and that // values are equal for those positions. for (int p=seq.getStart();p<=seq.getEnd();p++) @@ -326,4 +301,27 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase } + private JalviewStructureDisplayI openStructureViaChooser(AlignFrame alf, + SequenceI seq, + String pDBID) + { + + SequenceI[] selectedSeqs = new SequenceI[] { seq }; + + StructureChooser schoose = new StructureChooser(selectedSeqs, seq, + alf.getViewport().getAlignPanel()); + + try + { + Thread.sleep(5000); + } catch (InterruptedException q) + { + } + ; + Assert.assertTrue(schoose.selectStructure(pDBID), + "Couldn't select structure via structure chooser: " + pDBID); + schoose.showStructures(true); + return schoose.getOpenedStructureViewer(); + } + }