X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FJalviewExportPropertiesTests.java;fp=test%2Fjalview%2Fio%2FJalviewExportPropertiesTests.java;h=faf4ef9764ac9d4ce0692b4a651b5ba038eca558;hb=af187b8931d3bd074b5d1ab4e10f19c58f78575e;hp=0000000000000000000000000000000000000000;hpb=4b95c0503857df0ec5a7d6a9f5e85220fc7d307b;p=jalview.git diff --git a/test/jalview/io/JalviewExportPropertiesTests.java b/test/jalview/io/JalviewExportPropertiesTests.java new file mode 100644 index 0000000..faf4ef9 --- /dev/null +++ b/test/jalview/io/JalviewExportPropertiesTests.java @@ -0,0 +1,84 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package jalview.io; + +import static org.testng.AssertJUnit.assertTrue; + +import jalview.datamodel.SequenceGroup; +import jalview.gui.AlignFrame; + +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * tests which verify that properties and preferences are correctly interpreted + * when exporting/importing data + * + * @author jprocter + * + */ +public class JalviewExportPropertiesTests +{ + + /** + * @throws java.lang.Exception + */ + @BeforeClass(alwaysRun = true) + public static void setUpBeforeClass() throws Exception + { + jalview.bin.Jalview.main(new String[] + { "-props", "test/jalview/io/testProps.jvprops" }); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception + { + jalview.gui.Desktop.instance.closeAll_actionPerformed(null); + + } + @Test(groups ={ "Functional" }) + public void testImportExportPeriodGaps() throws Exception + { + jalview.bin.Cache.setProperty("GAP_SYMBOL", "."); + assertTrue("Couldn't set gap character to '.'", + ".".equals("" + jalview.bin.Cache.getProperty("GAP_SYMBOL"))); + AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( + "examples/uniref50.fa", FormatAdapter.FILE); + assertTrue("Didn't read in the example file correctly.", af != null); + assertTrue("Didn't set the gap character correctly", af.getViewport() + .getAlignment().getSequenceAt(0).getCharAt(5) == '.'); + + SequenceGroup sg = new SequenceGroup(); + sg.addSequence(af.getViewport().getAlignment().getSequenceAt(0),false); + sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1),false); + sg.setStartRes(1); + sg.setEndRes(7); + af.getViewport().setSelectionGroup(sg); + String fseqs = new FormatAdapter(af.alignPanel).formatSequences( + "FASTA", af.alignPanel, true); + assertTrue("Couldn't find '.' in the exported region\n" + fseqs, + fseqs.indexOf(".") > -1); + } +}