X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FFeatureSettingsTest.java;h=12c4c6cc9fa287c7cf3f46ca754d366254d714b0;hb=f81f45cd35b2ae7401265b9e826fba2d96451315;hp=f0b3aef5b0717d83ba6db569b41df1ab5b2da9b8;hpb=e9a1c2c372f4bbf6cf658de3dba73ef326b20c20;p=jalview.git diff --git a/test/jalview/gui/FeatureSettingsTest.java b/test/jalview/gui/FeatureSettingsTest.java index f0b3aef..12c4c6c 100644 --- a/test/jalview/gui/FeatureSettingsTest.java +++ b/test/jalview/gui/FeatureSettingsTest.java @@ -29,16 +29,23 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import jalview.api.FeatureColourI; +import jalview.bin.Cache; +import jalview.bin.Jalview; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.datamodel.features.FeatureMatcher; import jalview.datamodel.features.FeatureMatcherSet; import jalview.datamodel.features.FeatureMatcherSetI; import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatI; import jalview.io.FileLoader; +import jalview.io.IdentifyFile; import jalview.schemes.FeatureColour; import jalview.schemes.FeatureColourTest; import jalview.util.matcher.Condition; @@ -46,6 +53,23 @@ import jalview.viewmodel.seqfeatures.FeatureRendererModel; public class FeatureSettingsTest { + @BeforeClass(alwaysRun = true) + public static void setUpBeforeClass() throws Exception + { + /* + * use read-only test properties file + */ + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Jalview.main(new String[] { "--nonews" }); + } + + @AfterMethod(alwaysRun = true) + public void tearDown() + { + if (Desktop.instance != null) + Desktop.instance.closeAll_actionPerformed(null); + } + /** * Test a roundtrip of save and reload of feature colours and filters as XML * @@ -257,4 +281,19 @@ public class FeatureSettingsTest "By Score (> 4.0)
" + simpleTooltip + "
"); } + + String fsfile = "", + fsfile2 = "\n"; + + @Test(groups = "Functional") + public void testIdentifyFeatureSettingsFile() throws Exception + { + FileFormatI type = new IdentifyFile().identify(fsfile, + DataSourceType.PASTE); + assertTrue(FileFormat.FeatureSettings == type, + "Feature settings file was identified as " + type); + type = new IdentifyFile().identify(fsfile2, DataSourceType.PASTE); + assertTrue(FileFormat.FeatureSettings == type, + "Feature settings file with newline was identified as " + type); + } }