JAL-3468 unit tests updated for changes
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 1 Nov 2019 14:56:05 +0000 (14:56 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 1 Nov 2019 14:56:05 +0000 (14:56 +0000)
test/jalview/gui/JvSwingUtilsTest.java
test/jalview/gui/PopupMenuTest.java
test/jalview/io/SequenceAnnotationReportTest.java

index 5e65cc2..22d8a9d 100644 (file)
@@ -113,7 +113,7 @@ 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 = "<style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
+    String expected = "<style> p.ttip {width: 350; text-align: left; word-wrap: break-word;}</style><p class=\"ttip\">"
             + tip + "</p>";
     assertEquals("<html>" + expected + "</html>",
             JvSwingUtils.wrapTooltip(true, tip));
index bf961d8..acef0a1 100644 (file)
@@ -198,7 +198,7 @@ public class PopupMenuTest
     testee.configureReferenceAnnotationsMenu(menu, seqs);
     assertTrue(menu.isEnabled());
     String s = MessageManager.getString("label.add_annotations_for");
-    String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
+    String expected = "<html><style> p.ttip {width: 350; text-align: left; word-wrap: break-word;}</style><p class=\"ttip\">"
             + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
     assertEquals(expected, menu.getToolTipText());
   }
@@ -221,7 +221,7 @@ public class PopupMenuTest
     testee.configureReferenceAnnotationsMenu(menu, seqs);
     assertTrue(menu.isEnabled());
     String s = MessageManager.getString("label.add_annotations_for");
-    String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
+    String expected = "<html><style> p.ttip {width: 350; text-align: left; word-wrap: break-word;}</style><p class=\"ttip\">"
             + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
     assertEquals(expected, menu.getToolTipText());
   }
index 0b5dfdd..7f4f3a3 100644 (file)
@@ -248,14 +248,13 @@ public class SequenceAnnotationReportTest
     SequenceI seq = new Sequence("s1", "MAKLKRFQSSTLL");
     seq.setDescription("SeqDesc");
 
-    sar.createSequenceAnnotationReport(sb, seq, true, true, null);
-
     /*
      * positional features are ignored
      */
     seq.addSequenceFeature(new SequenceFeature("Domain", "Ferredoxin", 5,
             10, 1f, null));
-    assertEquals("<i><br>SeqDesc</i>", sb.toString());
+    sar.createSequenceAnnotationReport(sb, seq, true, true, null);
+    assertEquals("<i>SeqDesc</i>", sb.toString());
 
     /*
      * non-positional feature
@@ -264,7 +263,7 @@ public class SequenceAnnotationReportTest
             null));
     sb.setLength(0);
     sar.createSequenceAnnotationReport(sb, seq, true, true, null);
-    String expected = "<i><br>SeqDesc<br>Type1 ; Nonpos Score=1.0</i>";
+    String expected = "<i>SeqDesc<br>Type1 ; Nonpos Score=1.0</i>";
     assertEquals(expected, sb.toString());
 
     /*
@@ -272,7 +271,7 @@ public class SequenceAnnotationReportTest
      */
     sb.setLength(0);
     sar.createSequenceAnnotationReport(sb, seq, true, false, null);
-    assertEquals("<i><br>SeqDesc</i>", sb.toString());
+    assertEquals("<i>SeqDesc</i>", sb.toString());
 
     /*
      * add non-pos feature with score inside min-max range for feature type
@@ -289,7 +288,7 @@ public class SequenceAnnotationReportTest
 
     sb.setLength(0);
     sar.createSequenceAnnotationReport(sb, seq, true, true, fr);
-    expected = "<i><br>SeqDesc<br>Metal ; Desc<br>Type1 ; Nonpos</i>";
+    expected = "<i>SeqDesc<br>Metal ; Desc<br>Type1 ; Nonpos</i>";
     assertEquals(expected, sb.toString());
     
     /*
@@ -305,8 +304,8 @@ public class SequenceAnnotationReportTest
     assertEquals(expected, sb.toString()); // unchanged!
 
     /*
-     * 'clinical_significance' attribute only included when
-     * used for feature colouring
+     * 'clinical_significance' attribute is only included in description 
+     * when used for feature colouring
      */
     SequenceFeature sf2 = new SequenceFeature("Variant", "Havana", 0, 0,
             5f, null);
@@ -314,7 +313,7 @@ public class SequenceAnnotationReportTest
     seq.addSequenceFeature(sf2);
     sb.setLength(0);
     sar.createSequenceAnnotationReport(sb, seq, true, true, fr);
-    expected = "<i><br>SeqDesc<br>Metal ; Desc<br>Type1 ; Nonpos<br>Variant ; Havana</i>";
+    expected = "<i>SeqDesc<br>Metal ; Desc<br>Type1 ; Nonpos<br>Variant ; Havana</i>";
     assertEquals(expected, sb.toString());
 
     /*
@@ -335,13 +334,23 @@ public class SequenceAnnotationReportTest
     fc.setAttributeName("clinical_significance");
     fr.setColour("Variant", fc);
     sar.createSequenceAnnotationReport(sb, seq, true, true, fr);
-    expected = "<i><br>SeqDesc<br>UNIPROT P30419<br>PDB 3iu1<br>Metal ; Desc<br>"
+    expected = "<i>SeqDesc<br>UNIPROT P30419<br>PDB 3iu1<br>Metal ; Desc<br>"
             + "Type1 ; Nonpos<br>Variant ; Havana; clinical_significance=benign</i>";
     assertEquals(expected, sb.toString());
     // with showNonPositionalFeatures = false
     sb.setLength(0);
     sar.createSequenceAnnotationReport(sb, seq, true, false, fr);
-    expected = "<i><br>SeqDesc<br>UNIPROT P30419<br>PDB 3iu1</i>";
+    expected = "<i>SeqDesc<br>UNIPROT P30419<br>PDB 3iu1</i>";
+    assertEquals(expected, sb.toString());
+
+    /*
+     * long feature description is truncated with ellipsis
+     */
+    sb.setLength(0);
+    sf2.setDescription(
+            "This is a very long description which should be truncated");
+    sar.createSequenceAnnotationReport(sb, seq, false, true, fr);
+    expected = "<i>SeqDesc<br>Metal ; Desc<br>Type1 ; Nonpos<br>Variant ; This is a very long description which sh...; clinical_significance=benign</i>";
     assertEquals(expected, sb.toString());
 
     // see other tests for treatment of status and html