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