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;
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
*
"<html>By Score (> 4.0)<br>" + simpleTooltip
+ "</br></html>");
}
+
+ String fsfile = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">",
+ fsfile2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<ns2:JalviewUserColours schemeName=\"Sequence Features\" xmlns:ns2=\"www.jalview.org/colours\">";
+
+ @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);
+ }
}