X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FJvSwingUtilsTest.java;h=b185f53017d1e9ae449ffec5591af21141164d56;hb=6653b3cf6395383a775abfa8244b56cafcf9a18a;hp=f1358d82a69e47d3f1b9328d48685969240f6669;hpb=8f118c154e74caaef6bec19acd0466904ac424d4;p=jalview.git diff --git a/test/jalview/gui/JvSwingUtilsTest.java b/test/jalview/gui/JvSwingUtilsTest.java index f1358d8..b185f53 100644 --- a/test/jalview/gui/JvSwingUtilsTest.java +++ b/test/jalview/gui/JvSwingUtilsTest.java @@ -25,11 +25,19 @@ import static org.testng.AssertJUnit.assertFalse; import javax.swing.JScrollBar; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class JvSwingUtilsTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @Test(groups = { "Functional" }) public void testGetScrollBarProportion() { @@ -78,7 +86,11 @@ public class JvSwingUtilsTest JvSwingUtils.wrapTooltip(true, tip)); tip = "0123456789012345678901234567890123456789012345678901234567890"; // 61 - assertFalse(tip.equals(JvSwingUtils.wrapTooltip(false, tip))); + // n/a -- message is too long for "false" +// +// assertFalse(tip.equals(JvSwingUtils.wrapTooltip(false, tip))); +// + assertFalse(("" + tip + "").equals(JvSwingUtils .wrapTooltip(true, tip))); } @@ -92,9 +104,21 @@ public class JvSwingUtilsTest public void testWrapTooltip_multilineShortText() { String tip = "Now is the winter of our discontent
Made glorious summer by this sun of York"; - assertEquals(tip, JvSwingUtils.wrapTooltip(false, tip)); - assertEquals("" + tip + "", - JvSwingUtils.wrapTooltip(true, tip)); + String tip2 = "Now is the winter of our discontent
Made glorious summer by this sun of York"; + +// BH not applicable in Jalview; "false" is only for when no
and only for short j2s2Discover messages +// +// String s = JvSwingUtils.wrapTooltip(false, tip); +// System.out.println("" + tip + ""); +// assertEquals(tip, s); + + String s; + s = JvSwingUtils.wrapTooltip(true, tip); + System.out.println(s); + assertEquals("" + tip + "", s); + s = JvSwingUtils.wrapTooltip(true, tip2); + System.out.println(s); + assertEquals("" + tip + "", s); } /** @@ -104,11 +128,13 @@ public class JvSwingUtilsTest @Test(groups = { "Functional" }) public void testWrapTooltip_longText() { + // BH should work in Java and JavaScript String tip = "Now is the winter of our discontent made glorious summer by this sun of York"; - String expected = "

" - + tip + "

"; - assertEquals("" + expected + "", - JvSwingUtils.wrapTooltip(true, tip)); - assertEquals(expected, JvSwingUtils.wrapTooltip(false, tip)); + String expected = JvSwingUtils.HTML_PREFIX + tip + ""; + String s = JvSwingUtils.wrapTooltip(true, tip); + assertEquals(expected, s); + // BH not applicable in Jalview; "false" is only for when no
and only for short j2s2Discover messages +// s = JvSwingUtils.wrapTooltip(false, tip); +// assertEquals(expected, s); } }