import jalview.datamodel.features.SequenceFeatures;
import jalview.gui.JvOptionPane;
+import java.nio.charset.Charset;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.spi.LocaleServiceProvider;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
assertEquals(10, sf.getBegin());
assertEquals(11, sf.getEnd());
}
+ private SequenceI mkDs(SequenceI as)
+ {
+ SequenceI ds = as.createDatasetSequence();
+ ds.setSequence(ds.getSequenceAsString().toUpperCase(Locale.ROOT));
+ return ds;
+ }
+ /**
+ * Test that mimics 'remove all gapped columns' action. This generates a
+ * series Delete Gap edits that each act on all sequences that share a gapped
+ * column region.
+ */
+ @Test(groups = { "Functional" })
+ public void testLeftRight_Justify_and_preserves_gaps()
+ {
+ EditCommand command = new EditCommand();
+ String original1 = "--ABc--DEF";
+ String original2 = "-G-Hi--J";
+ String original3 = "-M-No--PQ";
+
+ /*
+ * Set up the sequence array for operations
+ */
+ SequenceI seq1 = new Sequence("sq1", original1);
+ SequenceI ds1 = mkDs(seq1);
+ /*
+ * and check we are preserving data - if the calls below fail, something has broken the Jalview dataset derivation process
+ */
+ assertEquals("ABCDEF", seq1.getDatasetSequence().getSequenceAsString());
+ assertEquals(original1,seq1.getSequenceAsString());
+ SequenceI seq2 = new Sequence("sq2",original2);
+ SequenceI ds2 = mkDs(seq2);
+ SequenceI seq3 = new Sequence("sq3", original3);
+ SequenceI ds3 = mkDs(seq3);
+ List<SequenceI> sqs = Arrays.asList( seq1, seq2, seq3 );
+ Alignment al = new Alignment(sqs.toArray(new SequenceI[0]));
+ EditCommand lefj = new JustifyLeftOrRightCommand("Left J", true, sqs, 1, 7, al);
+ String exp = "-ABcD---EF";
+ assertEquals(exp.toUpperCase(Locale.ROOT),seq1.getSequenceAsString());
+ // check case
+ assertEquals(exp,seq1.getSequenceAsString());
+ }
}