From be7bf233b7e6af4f824613b1dbd3d5338498b4c8 Mon Sep 17 00:00:00 2001 From: hansonr Date: Mon, 26 Aug 2019 13:42:31 -0500 Subject: [PATCH] JAL-3423 testNG fix for revised tooltip html format --- src/jalview/gui/JvSwingUtils.java | 4 +++- test/jalview/gui/JvSwingUtilsTest.java | 5 ++--- test/jalview/gui/PopupMenuTest.java | 9 ++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index c1c8c82..b25b2c8 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -56,6 +56,8 @@ import javax.swing.border.TitledBorder; */ public final class JvSwingUtils { + public static final String HTML_PREFIX = "
"; + /** * wrap a bare html safe string to around 60 characters per line using a CSS * style class specifying word-wrap and break-word @@ -97,7 +99,7 @@ public final class JvSwingUtils } // BH 2018,2019 return (enclose - ? "
" + ? HTML_PREFIX + ttext + "
" : ttext); diff --git a/test/jalview/gui/JvSwingUtilsTest.java b/test/jalview/gui/JvSwingUtilsTest.java index 61c5c9b..5a8fba7 100644 --- a/test/jalview/gui/JvSwingUtilsTest.java +++ b/test/jalview/gui/JvSwingUtilsTest.java @@ -113,9 +113,8 @@ public class JvSwingUtilsTest public void testWrapTooltip_longText() { String tip = "Now is the winter of our discontent made glorious summer by this sun of York"; - String expected = "" - + "
" + tip + "
"; - assertEquals("" + expected + "", + String expected = JvSwingUtils.HTML_PREFIX + tip + "
"; + assertEquals(expected, JvSwingUtils.wrapTooltip(true, tip)); assertEquals(expected, JvSwingUtils.wrapTooltip(false, tip)); } diff --git a/test/jalview/gui/PopupMenuTest.java b/test/jalview/gui/PopupMenuTest.java index e42c34c..e9b6e54 100644 --- a/test/jalview/gui/PopupMenuTest.java +++ b/test/jalview/gui/PopupMenuTest.java @@ -199,9 +199,8 @@ public class PopupMenuTest // String expected = "

" // + s + "
Jmol/secondary structure
PDB/Temp

"; - String expected = "" - + "
" + s - + "
Jmol/secondary structure
PDB/Temp
"; + String expected = JvSwingUtils.HTML_PREFIX + s + + "
Jmol/secondary structure
PDB/Temp"; assertEquals(expected, menu.getToolTipText()); } @@ -226,8 +225,8 @@ public class PopupMenuTest // String expected = "

" // + s + "
Jmol/secondary structure
PDB/Temp

"; - String expected = "" - + "
Add annotations for
Jmol/secondary structure
PDB/Temp
"; + String expected = JvSwingUtils.HTML_PREFIX + + "Add annotations for
Jmol/secondary structure
PDB/Temp"; assertEquals(expected, menu.getToolTipText()); } -- 1.7.10.2