|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
javax.microedition.lcdui.game.GameCanvas
momeunit.runner.TestScreen
public class TestScreen
Canvas used by MIDletTestRunner. Displays progress bar and statistics of
tests run at the top part of screen. Displays list of tests that fails or
completed with errors at middle part of screen and detailed message of
failure of selected test at bottom part of screen. See
package description
for more details about UI usage.
Field Summary |
---|
Fields inherited from class javax.microedition.lcdui.game.GameCanvas |
---|
DOWN_PRESSED, FIRE_PRESSED, GAME_A_PRESSED, GAME_B_PRESSED, GAME_C_PRESSED, GAME_D_PRESSED, LEFT_PRESSED, RIGHT_PRESSED, UP_PRESSED |
Fields inherited from class javax.microedition.lcdui.Canvas |
---|
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
---|---|
TestScreen(String name)
Instantiates TestScreen with given title and test cases number. |
|
TestScreen(String name,
boolean printStdErr,
boolean printStackTrace)
Instantiates TestScreen with given title and print behaviour flags. |
|
TestScreen(String name,
int testCasesNumber)
Instantiates TestScreen with given title and test cases number. |
|
TestScreen(String name,
int testCasesNumber,
boolean printStdErr,
boolean printStackTrace)
Instantiates TestScreen with given title, test cases number and print behaviour flags. |
Method Summary | |
---|---|
void |
addError(Test test,
Throwable t)
Informs this listener that an error has occurred. |
void |
addFailure(Test test,
AssertionFailedError t)
Informs this listener that a failure has occurred. |
void |
clearResult(int testCasesNumber)
Prepares TestScreen to a new tests execution. |
void |
endTest(Test test)
Informs this listener about the end of test. |
boolean |
getFailureListType()
Return if problem encountered while executing selected test is a failure or an error. |
String |
getLastTestName()
Returns name of last started test. |
static String |
getMessage(Throwable ex)
Returns descriptive message based on exception thrown. |
Throwable |
getSelectedError()
Returns error thrown while executing selected test. |
TestResult |
getTestResult()
Returns the TestResult contained in TestScreen. |
boolean |
isPrintStackTrace()
Checks if test failure and error stack-trace should be printed to standard error output. |
boolean |
isPrintToStdErr()
Checks if test failure and error events should be printed to standard error output. |
protected void |
keyPressed(int key)
|
void |
setBgColor(int color)
Sets background color. |
void |
setErrorColor(int color)
Sets color of progress bar when some tests completed with errors ans color of error statistics. |
void |
setFailureColor(int color)
Sets color of progress bar when some tests fails and there are no errors ans color of failure statistics. |
void |
setFailureListType(boolean failureListType)
Sets type of tests list to display. |
void |
setFgColor(int color)
Sets foreground color. |
void |
setFont(Font font)
Sets font of TestScreen. |
void |
setOkColor(int color)
Sets color of progress bar when tests completed successfully. |
void |
setPrintStackTrace(boolean printStackTrace)
Sets whether test failure and error stack-trace should be printed to standard error output. |
void |
setPrintToStdErr(boolean printToStdErr)
Sets whether test failure and error events should be printed to standard error output. |
void |
setSelBgColor(int color)
Sets background color of selected item. |
void |
setSelFgColor(int color)
Sets foreground color of selected item. |
void |
setStatisticsFont(Font font)
Sets font of statistics of TestScreen. |
void |
startTest(Test test)
Informs this listener that a test has started. |
Methods inherited from class javax.microedition.lcdui.game.GameCanvas |
---|
flushGraphics, flushGraphics, getGraphics, getKeyStates, paint |
Methods inherited from class javax.microedition.lcdui.Canvas |
---|
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode, showNotify, sizeChanged |
Methods inherited from class javax.microedition.lcdui.Displayable |
---|
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestScreen(String name)
name
- title of TestScreen.public TestScreen(String name, int testCasesNumber)
name
- title of TestScreen.testCasesNumber
- number of test cases.public TestScreen(String name, int testCasesNumber, boolean printStdErr, boolean printStackTrace)
printStdErr
is true
TestScreen will print test failures and errors to standard error output
together with stack-trace if printStackTrace
flag is
true
.
name
- title of TestScreen.testCasesNumber
- number of test cases.printStdErr
- print to standard error flag.printStackTrace
- print stack-trace flag.public TestScreen(String name, boolean printStdErr, boolean printStackTrace)
printStdErr
is true
TestScreen will print
test failures and errors to standard error output together with stack-trace
if printStackTrace
flag is true
.
name
- title of TestScreen.printStdErr
- print to standard error flag.printStackTrace
- print stack-trace flag.Method Detail |
---|
public void setFont(Font font)
font
- the font to set
NullPointerException
- if font is null
.public void setStatisticsFont(Font font)
font
- the font of statistics to set
NullPointerException
- if font is null
.public void setBgColor(int color)
color
- color to be set.public void setSelBgColor(int color)
color
- color to be set.public void setSelFgColor(int color)
color
- color to be set.public void setErrorColor(int color)
color
- color to be set.public void setFailureColor(int color)
color
- color to be set.public void setFgColor(int color)
color
- color to be set.public void setOkColor(int color)
color
- color to be set.public boolean isPrintToStdErr()
true
if test failure and error events should be
printed to standard error output, false
otherwise.public void setPrintToStdErr(boolean printToStdErr)
printToStdErr
- true
if test failure and error events should be
printed to standard error output.public TestResult getTestResult()
public boolean isPrintStackTrace()
true
if test failure and error stack-trace should be
printed to standard error output, false
otherwise.public void setPrintStackTrace(boolean printStackTrace)
printStackTrace
- true
if test failure and error stack-trace should
be printed to standard error output.public void clearResult(int testCasesNumber)
testCasesNumber
- number of test cases.public boolean getFailureListType()
true
if problem encountered while executing selected
test is a failure false
otherwise.public void setFailureListType(boolean failureListType)
failureListType
- if true
shows list of tests that fails if there are
some, list of error tests if there are some otherwise.public Throwable getSelectedError()
public static String getMessage(Throwable ex)
ex
- exception thrown.
public void addError(Test test, Throwable t)
TestListener
addError
in interface TestListener
test
- test that threw an exception.t
- Throwable thrown while executing test.public void addFailure(Test test, AssertionFailedError t)
TestListener
addFailure
in interface TestListener
test
- test that failed.t
- AssertionFailedError
that describes failure.public void endTest(Test test)
TestListener
endTest
in interface TestListener
test
- ended test.public void startTest(Test test)
TestListener
startTest
in interface TestListener
test
- started test.public String getLastTestName()
protected void keyPressed(int key)
keyPressed
in class Canvas
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |