mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
abstract test case for SWT GUI stuff, maybe will be useful in the future
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@311 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
ed02a4e675
commit
750d5486ca
49
test/net/azib/ipscan/gui/SWTTestCase.java
Normal file
49
test/net/azib/ipscan/gui/SWTTestCase.java
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* This file is a part of Angry IP Scanner source code,
|
||||
* see http://www.azib.net/ for more information.
|
||||
* Licensed under GPLv2.
|
||||
*/
|
||||
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
* SWTTestCase - base class for SWT tests
|
||||
*
|
||||
* @author Anton Keks
|
||||
*/
|
||||
public abstract class SWTTestCase {
|
||||
protected static final Display display = Display.getDefault();
|
||||
|
||||
protected Shell shell;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
newShell();
|
||||
}
|
||||
|
||||
protected void newShell() {
|
||||
disposeShell();
|
||||
shell = new Shell(display);
|
||||
}
|
||||
|
||||
private void disposeShell() {
|
||||
if (shell != null) {
|
||||
shell.dispose();
|
||||
shell = null;
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
display.syncExec(new Runnable() {
|
||||
public void run() {
|
||||
disposeShell();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user