From 2350ea66072d77b929d89e5ba42599c0e8d3ea53 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 1 Nov 2019 14:56:05 +0000 Subject: [PATCH] JAL-3468 unit tests updated for changes --- test/jalview/gui/JvSwingUtilsTest.java | 2 +- test/jalview/gui/PopupMenuTest.java | 4 +-- test/jalview/io/SequenceAnnotationReportTest.java | 31 +++++++++++++-------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/test/jalview/gui/JvSwingUtilsTest.java b/test/jalview/gui/JvSwingUtilsTest.java index 5e65cc2..22d8a9d 100644 --- a/test/jalview/gui/JvSwingUtilsTest.java +++ b/test/jalview/gui/JvSwingUtilsTest.java @@ -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 = "

" + String expected = "

" + tip + "

"; assertEquals("" + expected + "", JvSwingUtils.wrapTooltip(true, tip)); diff --git a/test/jalview/gui/PopupMenuTest.java b/test/jalview/gui/PopupMenuTest.java index bf961d8..acef0a1 100644 --- a/test/jalview/gui/PopupMenuTest.java +++ b/test/jalview/gui/PopupMenuTest.java @@ -198,7 +198,7 @@ public class PopupMenuTest testee.configureReferenceAnnotationsMenu(menu, seqs); assertTrue(menu.isEnabled()); String s = MessageManager.getString("label.add_annotations_for"); - String expected = "

" + String expected = "

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

"; 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 = "

" + String expected = "

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

"; assertEquals(expected, menu.getToolTipText()); } diff --git a/test/jalview/io/SequenceAnnotationReportTest.java b/test/jalview/io/SequenceAnnotationReportTest.java index 0b5dfdd..7f4f3a3 100644 --- a/test/jalview/io/SequenceAnnotationReportTest.java +++ b/test/jalview/io/SequenceAnnotationReportTest.java @@ -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("
SeqDesc
", sb.toString()); + sar.createSequenceAnnotationReport(sb, seq, true, true, null); + assertEquals("SeqDesc", 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 = "
SeqDesc
Type1 ; Nonpos Score=1.0
"; + String expected = "SeqDesc
Type1 ; Nonpos Score=1.0
"; assertEquals(expected, sb.toString()); /* @@ -272,7 +271,7 @@ public class SequenceAnnotationReportTest */ sb.setLength(0); sar.createSequenceAnnotationReport(sb, seq, true, false, null); - assertEquals("
SeqDesc
", sb.toString()); + assertEquals("SeqDesc", 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 = "
SeqDesc
Metal ; Desc
Type1 ; Nonpos
"; + expected = "SeqDesc
Metal ; Desc
Type1 ; Nonpos
"; 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 = "
SeqDesc
Metal ; Desc
Type1 ; Nonpos
Variant ; Havana
"; + expected = "SeqDesc
Metal ; Desc
Type1 ; Nonpos
Variant ; Havana
"; 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 = "
SeqDesc
UNIPROT P30419
PDB 3iu1
Metal ; Desc
" + expected = "SeqDesc
UNIPROT P30419
PDB 3iu1
Metal ; Desc
" + "Type1 ; Nonpos
Variant ; Havana; clinical_significance=benign
"; assertEquals(expected, sb.toString()); // with showNonPositionalFeatures = false sb.setLength(0); sar.createSequenceAnnotationReport(sb, seq, true, false, fr); - expected = "
SeqDesc
UNIPROT P30419
PDB 3iu1
"; + expected = "SeqDesc
UNIPROT P30419
PDB 3iu1
"; + 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 = "SeqDesc
Metal ; Desc
Type1 ; Nonpos
Variant ; This is a very long description which sh...; clinical_significance=benign
"; assertEquals(expected, sb.toString()); // see other tests for treatment of status and html -- 1.7.10.2