Made shell invisible in tests. added shell style access
Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
d49a2474e0
commit
8d51733590
@ -85,8 +85,8 @@ public final class SWTConsoleShell extends Shell {
|
||||
/** Create the shell.
|
||||
*
|
||||
* @param display the display */
|
||||
public SWTConsoleShell(final Display display) {
|
||||
super(display, SWT.SHELL_TRIM);
|
||||
public SWTConsoleShell(final Display display, final int style) {
|
||||
super(display, style);
|
||||
setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
|
||||
createContents();
|
||||
|
@ -103,7 +103,7 @@ public final class SWTConsoleView extends Composite implements ConsoleDelayIO {
|
||||
|
||||
@Override
|
||||
protected void forwardLine(final String m) {
|
||||
appendConsoleOutput(m);
|
||||
appendConsoleOutput(System.lineSeparator() + m);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -149,12 +149,12 @@ public final class SWTConsoleView extends Composite implements ConsoleDelayIO {
|
||||
}
|
||||
|
||||
/** @param next the next message */
|
||||
private void appendConsoleOutput(final String next) {
|
||||
public void appendConsoleOutput(final String next) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@SuppressWarnings("synthetic-access")
|
||||
@Override
|
||||
public void run() {
|
||||
consoleOutput.append(System.lineSeparator() + next);
|
||||
consoleOutput.append(next);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -99,7 +100,7 @@ public class SWTConsoleShellTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
final SWTConsoleShell shell = new SWTConsoleShell(DISPLAY);
|
||||
final SWTConsoleShell shell = new SWTConsoleShell(DISPLAY, SWT.SHELL_TRIM);
|
||||
final SWTConsole swtConsole = shell.getManager();
|
||||
try {
|
||||
final ConsoleApplication appl = new ConsoleApplication(swtConsole, swtConsole,
|
||||
@ -138,6 +139,7 @@ public class SWTConsoleShellTest {
|
||||
});
|
||||
// shell.pack();
|
||||
shell.open();
|
||||
shell.setVisible(false);
|
||||
final Thread applThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -159,7 +161,7 @@ public class SWTConsoleShellTest {
|
||||
@Override
|
||||
public void run() {
|
||||
swtConsole.setText("test"); //$NON-NLS-1$
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
}
|
||||
});
|
||||
try {
|
||||
@ -198,7 +200,7 @@ public class SWTConsoleShellTest {
|
||||
|
||||
@Test
|
||||
public void testConsoleClose() {
|
||||
final SWTConsoleShell shell = new SWTConsoleShell(DISPLAY);
|
||||
final SWTConsoleShell shell = new SWTConsoleShell(DISPLAY, SWT.SHELL_TRIM);
|
||||
final SWTConsole swtConsole = shell.getManager();
|
||||
swtConsole.close();
|
||||
swtConsole.setPrompt(":");
|
||||
@ -267,6 +269,7 @@ public class SWTConsoleShellTest {
|
||||
});
|
||||
// shell.pack();
|
||||
shell.open();
|
||||
shell.setVisible(false);
|
||||
final Thread applThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -288,7 +291,7 @@ public class SWTConsoleShellTest {
|
||||
@Override
|
||||
public void run() {
|
||||
swtConsole.setText("test"); //$NON-NLS-1$
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
}
|
||||
});
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@ -297,28 +300,28 @@ public class SWTConsoleShellTest {
|
||||
swtConsole.setText("ok"); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
swtConsole.setText("long"); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
swtConsole.setText("test"); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
swtConsole.setText("test"); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
swtConsole.validateCommand();
|
||||
swtConsole.validateInput();
|
||||
try {
|
||||
Thread.sleep(TWO_SECONDS);
|
||||
} catch (final InterruptedException e) {
|
||||
|
@ -147,6 +147,7 @@ public class SWTConsoleViewTest {
|
||||
});
|
||||
// shell.pack();
|
||||
shell.open();
|
||||
shell.setVisible(false);
|
||||
final Thread applThread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user