X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FFreeUpMemoryTest.java;h=9b212749bca07fda9d9c8704a9234be18ab4faa8;hb=3c8a25936a2d805e7e3d7ab82f83b13135406d18;hp=e93bfac7162c27177ffb25d1c8e0a438d550c9d7;hpb=29e2e6c24876ec39e589ad4f37365286a5db86b7;p=jalview.git diff --git a/test/jalview/gui/FreeUpMemoryTest.java b/test/jalview/gui/FreeUpMemoryTest.java index e93bfac..9b21274 100644 --- a/test/jalview/gui/FreeUpMemoryTest.java +++ b/test/jalview/gui/FreeUpMemoryTest.java @@ -1,6 +1,7 @@ package jalview.gui; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import jalview.analysis.AlignmentGenerator; @@ -11,6 +12,7 @@ import jalview.datamodel.SequenceGroup; import jalview.io.DataSourceType; import jalview.io.FileLoader; +import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; import java.io.PrintStream; @@ -18,6 +20,8 @@ import java.io.PrintStream; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import junit.extensions.PA; + public class FreeUpMemoryTest { private static final int ONE_MB = 1000 * 1000; @@ -30,16 +34,12 @@ public class FreeUpMemoryTest { Jalview.main(new String[] { "-nonews", "-props", "test/jalview/testProps.jvprops" }); - Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", - Boolean.TRUE.toString()); - Cache.applicationProperties.setProperty("SHOW_QUALITY", - Boolean.TRUE.toString()); - Cache.applicationProperties.setProperty("SHOW_CONSERVATION", - Boolean.TRUE.toString()); - Cache.applicationProperties.setProperty("SHOW_OCCUPANCY", - Boolean.TRUE.toString()); - Cache.applicationProperties.setProperty("SHOW_IDENTITY", - Boolean.TRUE.toString()); + String True = Boolean.TRUE.toString(); + Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", True); + Cache.applicationProperties.setProperty("SHOW_QUALITY", True); + Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True); + Cache.applicationProperties.setProperty("SHOW_OCCUPANCY", True); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", True); } /** @@ -84,18 +84,19 @@ public class FreeUpMemoryTest protected void checkUsedMemory(long expectedMax) { /* - * request garbage collection and wait briefly for it to run; + * request garbage collection and wait for it to run; * NB there is no guarantee when, or whether, it will do so + * wait time depends on JRE/processor, generous allowance here */ System.gc(); - waitFor(100); + waitFor(1500); /* * a second gc() call should not be necessary - but it is! * the test passes with it, and fails without it */ System.gc(); - waitFor(100); + waitFor(1500); /* * check used memory is 'reasonably low' @@ -142,6 +143,20 @@ public class FreeUpMemoryTest } /* + * open an Overview window + */ + af.overviewMenuItem_actionPerformed(null); + assertNotNull(af.alignPanel.overviewPanel); + + /* + * exercise the pop-up menu in the Overview Panel (JAL-2864) + */ + Object[] args = new Object[] { + new MouseEvent(af, 0, 0, 0, 0, 0, 1, true) }; + PA.invokeMethod(af.alignPanel.overviewPanel, + "showPopupMenu(java.awt.event.MouseEvent)", args); + + /* * set a selection group - potential memory leak if it retains * a reference to the alignment */