Merge branch 'doc/JAL-4090_Release_2_11_3_0' into develop
[jalview.git] / test / jalview / gui / AnnotationLabelsTest2.java
index e8fa9f1..ad97e8b 100644 (file)
@@ -87,11 +87,11 @@ public class AnnotationLabelsTest2
     groups =
     { "Functional", "testTask1" },
     dataProvider = "openFilesWithIdWidthChanges")
     groups =
     { "Functional", "testTask1" },
     dataProvider = "openFilesWithIdWidthChanges")
-  public void testIdWidthChanges(String alignmentFilename, int idWidth1min,
-          int idWidth1max, int manualWidth, String structureFilename,
-          String paeFilename, boolean secondaryStructureView,
-          TFType temperatureFactorType, ViewerType viewerType,
-          int idWidth2min, int idWidth2max)
+  public void testIdWidthChanges(String alignmentFilename, boolean wrap,
+          int idWidth1min, int idWidth1max, int manualWidth,
+          String structureFilename, String paeFilename,
+          boolean secondaryStructureView, TFType temperatureFactorType,
+          ViewerType viewerType, int idWidth2min, int idWidth2max)
   {
     AlignFrame af = new FileLoader()
             .LoadFileWaitTillLoaded(alignmentFilename, DataSourceType.FILE);
   {
     AlignFrame af = new FileLoader()
             .LoadFileWaitTillLoaded(alignmentFilename, DataSourceType.FILE);
@@ -110,8 +110,19 @@ public class AnnotationLabelsTest2
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
-    assertTrue(idWidth < idWidth1max, "idWidth (" + idWidth
-            + ") is not less wide than" + idWidth1max);
+    assertTrue(idWidth < idWidth1max,
+            "idWidth (" + idWidth + ") is not narrower than" + idWidth1max);
+
+    // set wrap
+    if (wrap)
+    {
+      af.setWrapFormat(true, false);
+      idWidth = av.getIdWidth();
+      assertTrue(idWidth > idWidth1min, "After wrap idWidth (" + idWidth
+              + ") is not greater than " + idWidth1min);
+      assertTrue(idWidth < idWidth1max, "After wrap idWidth (" + idWidth
+              + ") is not narrower than" + idWidth1max);
+    }
 
     AlignmentI al = av.getAlignment();
     SequenceI s = al.getSequenceAt(0);
 
     AlignmentI al = av.getAlignment();
     SequenceI s = al.getSequenceAt(0);
@@ -134,18 +145,19 @@ public class AnnotationLabelsTest2
       e.printStackTrace();
     }
 
       e.printStackTrace();
     }
 
+    // idWidth = ap.getIdPanel().getWidth();
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth2min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth2min);
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth2min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth2min);
-    assertTrue(idWidth < idWidth2max, "idWidth (" + idWidth
-            + ") is not less wide than" + idWidth2max);
+    assertTrue(idWidth < idWidth2max,
+            "idWidth (" + idWidth + ") is not narrower than" + idWidth2max);
   }
 
   @Test(
     groups =
     { "Functional", "testTask1" },
     dataProvider = "openFilesWithIdWidthChanges")
   }
 
   @Test(
     groups =
     { "Functional", "testTask1" },
     dataProvider = "openFilesWithIdWidthChanges")
-  public void testIdWidthNoChanges(String alignmentFilename,
+  public void testIdWidthNoChanges(String alignmentFilename, boolean wrap,
           int idWidth1min, int idWidth1max, int manualWidth,
           String structureFilename, String paeFilename,
           boolean secondaryStructureView, TFType temperatureFactorType,
           int idWidth1min, int idWidth1max, int manualWidth,
           String structureFilename, String paeFilename,
           boolean secondaryStructureView, TFType temperatureFactorType,
@@ -168,8 +180,8 @@ public class AnnotationLabelsTest2
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
-    assertTrue(idWidth < idWidth1max, "idWidth (" + idWidth
-            + ") is not less wide than" + idWidth1max);
+    assertTrue(idWidth < idWidth1max,
+            "idWidth (" + idWidth + ") is not narrower than" + idWidth1max);
 
     AlignmentI al = av.getAlignment();
     SequenceI s = al.getSequenceAt(0);
 
     AlignmentI al = av.getAlignment();
     SequenceI s = al.getSequenceAt(0);
@@ -207,6 +219,7 @@ public class AnnotationLabelsTest2
   {
     /*
       String alignmentFilename,
   {
     /*
       String alignmentFilename,
+      boolean wrap,
       int idWidth1min,
       int idWidth1max,
       int manualWidth, // ignored by testIdWidthChanges()
       int idWidth1min,
       int idWidth1max,
       int manualWidth, // ignored by testIdWidthChanges()
@@ -222,14 +235,16 @@ public class AnnotationLabelsTest2
         //
         /*
          */
         //
         /*
          */
-        {
-            //
-            "./test/files/annotation_label_width/sample.a2m", 50, 70, 100,
+        { "./test/files/annotation_label_width/sample.a2m", false, 50, 70,
+            100,
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json",
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json",
-            true, TFType.PLDDT, null, 115, 130
-        //
-        },
+            true, TFType.PLDDT, null, 115, 130 },
+        { "./test/files/annotation_label_width/sample.a2m", true, 50, 70,
+            100,
+            "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
+            "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json",
+            true, TFType.PLDDT, null, 115, 130 },
         /*
          */
     };
         /*
          */
     };