import java.util.Date;
import org.testng.Assert;
+import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow);
}
+ @AfterClass(alwaysRun = true)
+ public static void resetProps()
+ {
+ Cache.loadProperties("test/jalview/testProps.jvprops");
+ }
+
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = "Functional", dataProvider = "cmdLines")
@AfterClass(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" })
import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
+import java.lang.reflect.InvocationTargetException;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
import jalview.gui.StructureViewer;
import jalview.io.FileFormat;
import jalview.io.FileLoader;
-import java.lang.reflect.InvocationTargetException;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
@Test(singleThreaded = true)
public class JmolViewerTest
{
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" })
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@AfterMethod(alwaysRun = true)
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
/**
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
/**
doStuffInJalview(f);
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
checkUsedMemory(MAX_RESIDUAL_HEAP);
}
// reset mock response
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
// close desktop windows/frames
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
// reset debug delay
Jalview2XML.setDebugDelaySave(20);
}
// reset mock response
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
// close desktop windows/frames
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
// reset debug delay
Cache.setProperty("DEBUG_DELAY_SAVE", "false");
Jalview2XML.setDebugDelaySave(3);
Assert.assertTrue(end - start < 500,
"Quit-with-no-save-needed took too long (" + (end - start)
+ "ms)");
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 10)
Assert.assertEquals(response, QResponse.QUIT);
Assert.assertTrue(end - start > 2900,
"Quit-whilst-saving was too short (" + (end - start) + "ms)");
-
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 9)
// if not saved this would be CANCEL_QUIT
Assert.assertEquals(response, QResponse.QUIT);
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 9)
// if not saved this would be CANCEL_QUIT
Assert.assertEquals(response, QResponse.QUIT);
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 1)
QResponse response = QuitHandler.getQuitResponse(true);
Assert.assertEquals(response, QResponse.CANCEL_QUIT);
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 1)
QResponse response = QuitHandler.getQuitResponse(false);
Assert.assertEquals(response, QResponse.QUIT);
- Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, singleThreaded = true, priority = 11)
"Force-Quit-whilst-saving was too long (" + (end - start)
+ "ms)");
- Desktop.instance.closeAll_actionPerformed(null);
}
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = "Functional")
}
assertEquals(dna.length(), 51200);
AlignFrame alignFrame = new FileLoader()
- .LoadFileWaitTillLoaded("dna "+dna, DataSourceType.PASTE);
+ .LoadFileWaitTillLoaded("dna " + dna, DataSourceType.PASTE);
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
AlignViewport av = alignFrame.getViewport();
av.setScaleAboveWrapped(true);
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertTrue;
+import java.io.File;
+import java.util.List;
+
+import org.junit.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import jalview.bin.Cache;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.datamodel.features.SequenceFeatures;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.structure.StructureImportSettings;
import jalview.structure.StructureImportSettings.StructureParser;
-import java.io.File;
-import java.util.List;
-
-import org.junit.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
public class AnnotatedPDBFileInputTest
{
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
-
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" })
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-import jalview.analysis.CrossRef;
-import jalview.api.AlignmentViewPanel;
-import jalview.datamodel.AlignedCodonFrame;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentTest;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.CrossRefAction;
-import jalview.gui.Desktop;
-import jalview.gui.JvOptionPane;
-import jalview.gui.SequenceFetcher;
-import jalview.project.Jalview2XML;
-import jalview.util.DBRefUtils;
-
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import jalview.analysis.CrossRef;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignedCodonFrame;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentTest;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.CrossRefAction;
+import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
+import jalview.gui.SequenceFetcher;
+import jalview.project.Jalview2XML;
+import jalview.util.DBRefUtils;
import junit.extensions.PA;
@Test(singleThreaded = true)
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
// recover stored project
af = new FileLoader(false).LoadFileWaitTillLoaded(
savedProjects.get(first).toString(), DataSourceType.FILE);
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
pass3 = 0;
// recover stored project
File storedProject = savedProjects.get(nextxref);
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
// recover stored project
File storedProject = savedProjects.get(nextnextxref);
if (storedProject == null)
cra_views2.add(af2.getViewport().getAlignPanel());
cra_views2.add(((jalview.gui.AlignViewport) af2
.getViewport().getCodingComplement())
- .getAlignPanel());
+ .getAlignPanel());
}
else
// bottom view, then top
cra_views2.add(((jalview.gui.AlignViewport) af2
.getViewport().getCodingComplement())
- .getAlignPanel());
+ .getAlignPanel());
cra_views2.add(af2.getViewport().getAlignPanel());
}
Assert.assertEquals(cra_views2.size(), 2);
*/
package jalview.io;
+import java.util.Date;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeTest;
+
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.datamodel.AlignmentAnnotation;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
-import java.util.Date;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeTest;
-
public class Jalview2xmlBase
{
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@BeforeTest(alwaysRun = true)
import static org.testng.AssertJUnit.assertTrue;
-import jalview.datamodel.SequenceGroup;
-import jalview.gui.AlignFrame;
-import jalview.gui.JvOptionPane;
-
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.datamodel.SequenceGroup;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
+
/**
* tests which verify that properties and preferences are correctly interpreted
* when exporting/importing data
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
{
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
{
int origCount = Desktop.getAlignFrames() == null ? 0
: Desktop.getAlignFrames().length;
+ System.out
+ .println("###### Calling FileLoader().LoadFileWaitTillLoaded");
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull(af, "Didn't read in the example file correctly.");
}
PAEContactMatrix dummyMat = new PAEContactMatrix(sq, paevals);
String content = ContactMatrix.contactToFloatString(dummyMat);
- Assert.assertTrue(content.contains("\t1.")); // at least one element must be 1
- float[][] vals = ContactMatrix.fromFloatStringToContacts(content, sq.getLength(), sq.getLength());
- assertEquals(vals[3][4],paevals[3][4]);
-
+ Assert.assertTrue(content.contains("\t1.")); // at least one element must be
+ // 1
+ float[][] vals = ContactMatrix.fromFloatStringToContacts(content,
+ sq.getLength(), sq.getLength());
+ assertEquals(vals[3][4], paevals[3][4]);
+
AlignmentAnnotation paeCm = sq.addContactList(dummyMat);
al.addAnnotation(paeCm);
File tfile = File.createTempFile("testStoreAndRecoverPAEmatrix",
Assert.assertEquals(oldCM.getContactAt(j), newCM.getContactAt(j));
}
}
-
+
}
}
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import jalview.analysis.GeneticCodes;
import jalview.api.AlignViewportI;
import jalview.api.FeatureColourI;
import jalview.util.matcher.Condition;
import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.annotations.Test;
-
public class FeatureRendererTest
{
+ @BeforeMethod(alwaysRun = true)
+ public void closeAll()
+ {
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
+ }
@Test(groups = "Functional")
public void testFindAllFeatures()
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "-nonews", "--props", "test/jalview/testProps.jvprops" });
// codons for MCWHSE
String cdsSeq = ">cds\nATGtgtTGGcacTCAgaa";
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
+import java.awt.Color;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import jalview.api.AlignViewportI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.io.FileLoader;
import jalview.schemes.ClustalxColourScheme.ClustalColour;
-import java.awt.Color;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
public class ColourSchemesTest
{
/*
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
}
@Test(groups = "Functional")
{
// for some reason 'BeforeMethod' (which should be inherited from
// Jalview2XmlBase isn't always called)...
- Desktop.instance.closeAll_actionPerformed(null);
+ if (Desktop.instance != null)
+ Desktop.instance.closeAll_actionPerformed(null);
try
{
Thread.sleep(200);