--- a/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/AllTests.java Mon May 03 12:27:20 2010 +0300
+++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/AllTests.java Fri May 14 15:47:24 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description:
+* Description:
*
*/
package com.nokia.openlcdui.mt;
@@ -33,202 +33,238 @@
* A simple main application for conveniently executing all of the eSWT tests
* with text JUnit UI runner.
*/
-public class AllTests extends TestSuite implements InstallerMain {
+public class AllTests extends TestSuite implements InstallerMain
+{
- static boolean runningMain = false;
- static boolean resultPrinter = true;
- static Vector disabledTests = SWTTestCase.getDisabledTests();
+ static boolean runningMain = false;
+ static boolean resultPrinter = true;
+ static Vector disabledTests = SWTTestCase.getDisabledTests();
+
+ boolean started;
+
+ boolean enableUIRobotTests = false;
- boolean started;
-
- boolean enableUIRobotTests = false;
-
- public void installerMain(String[] args) {
- if (!started) {
- started = true;
-
- Thread uiThread = new Thread(new Runnable() {
- public void run() {
- runMainUI();
- }});
-
- uiThread.start();
- try {
- uiThread.join();
- } catch (InterruptedException e) {
- e.printStackTrace();
+ public void installerMain(String[] args)
+ {
+ if(!started)
+ {
+ started = true;
+
+ Thread uiThread = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ runMainUI();
}
+ });
+
+ uiThread.start();
+ try
+ {
+ uiThread.join();
}
- }
-
- public static void runMainUI() {
- resultPrinter = false;
- java.io.PrintStream stream = null;
- final com.nokia.mj.impl.utils.OmjTestRunner runner;
- try {
- Test suite = suite();
- runner = new com.nokia.mj.impl.utils.OmjTestRunner(suite);
-
- class eSWTPrinter extends ResultPrinter {
- public eSWTPrinter() {
- super(System.out);
- }
- public void startTest(Test test) {
- System.out.println(test.toString());
- }
- //public void addFailure(Test t, junit.framework.AssertionFailedError e) {}
- //public void addError(Test t, Throwable e) {}
- public void endTest(Test test) {
- runner.endTest(test);
- super.endTest(test);
- }
- public void printDefect(TestFailure testfailure, int i)
- {
- printDefectHeader(testfailure, i);
- super.printDefect(testfailure, i);
- }
- //protected void printErrors(TestResult result) {}
- };
- runner.setPrinter(new eSWTPrinter());
- TestResult result = runner.doRun(suite);
-
- /* Test results will be written to:
- * - fileconn.dir.photos\results (c:\data\images\results) on S60,
- * - JAVA_BIN_ROOT/results on Linux
- */
- runner.writeResultFile(result);
-
- } catch (Exception e) {
- e.printStackTrace(System.out);
-
- } finally {
- if (stream != null) stream.close();
- }
- }
-
- public static void main(String[] args) {
- runningMain = true;
-
- Thread uiThread = new Thread(new Runnable() {
- public void run() {
- runMainUI();
- }});
-
- uiThread.start();
- try {
- uiThread.join();
- } catch (InterruptedException e) {
+ catch(InterruptedException e)
+ {
e.printStackTrace();
}
-
- // Exit forcefully when running outside of MIDP environment, this causes
- // also OpenLCDUI thread to close.
- System.exit(0);
+ }
+ }
+
+ public static void runMainUI()
+ {
+ resultPrinter = false;
+ java.io.PrintStream stream = null;
+ final com.nokia.mj.impl.utils.OmjTestRunner runner;
+ try
+ {
+ Test suite = suite();
+ runner = new com.nokia.mj.impl.utils.OmjTestRunner(suite);
+
+ class eSWTPrinter extends ResultPrinter
+ {
+ public eSWTPrinter()
+ {
+ super(System.out);
+ }
+ public void startTest(Test test)
+ {
+ System.out.println(test.toString());
+ }
+ //public void addFailure(Test t, junit.framework.AssertionFailedError e) {}
+ //public void addError(Test t, Throwable e) {}
+ public void endTest(Test test)
+ {
+ runner.endTest(test);
+ super.endTest(test);
+ }
+ public void printDefect(TestFailure testfailure, int i)
+ {
+ printDefectHeader(testfailure, i);
+ super.printDefect(testfailure, i);
+ }
+ //protected void printErrors(TestResult result) {}
+ };
+ runner.setPrinter(new eSWTPrinter());
+ TestResult result = runner.doRun(suite);
+
+ /* Test results will be written to:
+ * - fileconn.dir.photos\results (c:\data\images\results) on S60,
+ * - JAVA_BIN_ROOT/results on Linux
+ */
+ runner.writeResultFile(result);
+
}
-
- public static junit.framework.Test suite() {
- return new AllTests();
+ catch(Exception e)
+ {
+ e.printStackTrace(System.out);
+
+ }
+ finally
+ {
+ if(stream != null) stream.close();
}
-
- public void init() {
-
+ }
+
+ public static void main(String[] args)
+ {
+ runningMain = true;
+
+ Thread uiThread = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ runMainUI();
+ }
+ });
+
+ uiThread.start();
+ try
+ {
+ uiThread.join();
}
-
- public AllTests() {
- init();
+ catch(InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+
+ // Exit forcefully when running outside of MIDP environment, this causes
+ // also OpenLCDUI thread to close.
+ System.exit(0);
+ }
+
+ public static junit.framework.Test suite()
+ {
+ return new AllTests();
+ }
+
+ public void init()
+ {
+
+ }
+
+ public AllTests()
+ {
+ init();
- addTest(com.nokia.openlcdui.mt.alert.AlertTest.suite());
- addTest(com.nokia.openlcdui.mt.canvas.CanvasTest.suite());
- addTest(com.nokia.openlcdui.mt.choicegroup.ChoiceGroupTest.suite());
- addTest(com.nokia.openlcdui.mt.command.CommandTest.suite());
- addTest(com.nokia.openlcdui.mt.command.ItemCommandTest.suite());
- addTest(com.nokia.openlcdui.mt.datefield.DateFieldTest.suite());
- addTest(com.nokia.openlcdui.mt.display.DisplayTest.suite());
- addTest(com.nokia.openlcdui.mt.displayable.DisplayableTest.suite());
- addTest(com.nokia.openlcdui.mt.font.FontTest.suite());
- addTest(com.nokia.openlcdui.mt.form.FormTest.suite());
- addTest(com.nokia.openlcdui.mt.fullcanvas.FullCanvasTest.suite());
- addTest(com.nokia.openlcdui.mt.game.CollisionDetectionTest.suite());
- addTest(com.nokia.openlcdui.mt.game.GameCanvasTest.suite());
- addTest(com.nokia.openlcdui.mt.game.LayerManagerTest.suite());
- addTest(com.nokia.openlcdui.mt.game.LayerTest.suite());
- addTest(com.nokia.openlcdui.mt.game.SpriteTest.suite());
- addTest(com.nokia.openlcdui.mt.game.TiledLayerTest.suite());
- addTest(com.nokia.openlcdui.mt.gauge.GaugeTest.suite());
- addTest(com.nokia.openlcdui.mt.graphics.DirectGraphicsTest.suite());
- addTest(com.nokia.openlcdui.mt.graphics.GraphicsTest.suite());
- addTest(com.nokia.openlcdui.mt.image.ImageTest.suite());
- addTest(com.nokia.openlcdui.mt.imageitem.ImageItemTest.suite());
- addTest(com.nokia.openlcdui.mt.item.ItemTest.suite());
- addTest(com.nokia.openlcdui.mt.list.ListTest.suite());
- addTest(com.nokia.openlcdui.mt.spacer.SpacerTest.suite());
- addTest(com.nokia.openlcdui.mt.stringitem.StringItemTest.suite());
- addTest(com.nokia.openlcdui.mt.textbox.TextBoxTest.suite());
- addTest(com.nokia.openlcdui.mt.textfield.TextFieldTest.suite());
- addTest(com.nokia.openlcdui.mt.ticker.TickerTest.suite());
- addTest(com.nokia.openlcdui.mt.devicecontrol.DeviceControlTest.suite());
- if (enableUIRobotTests) {
- addTest(com.nokia.openlcdui.mt_uirobot.alert.AlertUITest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.choicegroup.ChoiceGroupCommandTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.choicegroup.ChoiceGroupPopupTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.command.DynamicUpdateTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.command.ItemCommandUIRobotTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.customitem.CustomItemTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.datefield.DateFieldUIRobotTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.display.FlashAndVibrateTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.display.SetCurrentItemTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.displayable.AddCommandTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.displayable.SendBackgroundTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.displayable.SizeChangedTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.form.FormItemTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.gauge.GaugeCommandsTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.imageitem.ImageItemHyperLinkTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.item.ItemUITest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.list.ListUITest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.spacer.SpacerTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.stringitem.HyperLinkTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.stringitem.StringItemUIRobotTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.textbox.TestUITextBox.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.textbox.TextBoxInputModeUITest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.textfield.FormChangeFocusCheckTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.textfield.TextFieldCommandTest.suite());
- addTest(com.nokia.openlcdui.mt_uirobot.textfield.TextFieldSetInitialInputModeTest.suite());
- }
-
+ addTest(com.nokia.openlcdui.mt.alert.AlertTest.suite());
+ addTest(com.nokia.openlcdui.mt.canvas.CanvasTest.suite());
+ addTest(com.nokia.openlcdui.mt.choicegroup.ChoiceGroupTest.suite());
+ addTest(com.nokia.openlcdui.mt.command.CommandTest.suite());
+ addTest(com.nokia.openlcdui.mt.command.ItemCommandTest.suite());
+ addTest(com.nokia.openlcdui.mt.datefield.DateFieldTest.suite());
+ addTest(com.nokia.openlcdui.mt.display.DisplayTest.suite());
+ addTest(com.nokia.openlcdui.mt.displayable.DisplayableTest.suite());
+ addTest(com.nokia.openlcdui.mt.font.FontTest.suite());
+ addTest(com.nokia.openlcdui.mt.form.FormTest.suite());
+ addTest(com.nokia.openlcdui.mt.fullcanvas.FullCanvasTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.CollisionDetectionTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.GameCanvasTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.LayerManagerTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.LayerTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.SpriteTest.suite());
+ addTest(com.nokia.openlcdui.mt.game.TiledLayerTest.suite());
+ addTest(com.nokia.openlcdui.mt.gauge.GaugeTest.suite());
+ addTest(com.nokia.openlcdui.mt.graphics.DirectGraphicsTest.suite());
+ addTest(com.nokia.openlcdui.mt.graphics.GraphicsTest.suite());
+ addTest(com.nokia.openlcdui.mt.image.ImageTest.suite());
+ addTest(com.nokia.openlcdui.mt.imageitem.ImageItemTest.suite());
+ addTest(com.nokia.openlcdui.mt.item.ItemTest.suite());
+ addTest(com.nokia.openlcdui.mt.list.ListTest.suite());
+ addTest(com.nokia.openlcdui.mt.spacer.SpacerTest.suite());
+ addTest(com.nokia.openlcdui.mt.stringitem.StringItemTest.suite());
+ addTest(com.nokia.openlcdui.mt.textbox.TextBoxTest.suite());
+ addTest(com.nokia.openlcdui.mt.textfield.TextFieldTest.suite());
+ addTest(com.nokia.openlcdui.mt.ticker.TickerTest.suite());
+ addTest(com.nokia.openlcdui.mt.devicecontrol.DeviceControlTest.suite());
+ if(enableUIRobotTests)
+ {
+ addTest(com.nokia.openlcdui.mt_uirobot.alert.AlertUITest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.choicegroup.ChoiceGroupCommandTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.choicegroup.ChoiceGroupPopupTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.command.DynamicUpdateTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.command.ItemCommandUIRobotTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.customitem.CustomItemTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.datefield.DateFieldUIRobotTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.display.FlashAndVibrateTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.display.SetCurrentItemTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.displayable.AddCommandTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.displayable.SendBackgroundTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.displayable.SizeChangedTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.form.FormItemTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.gauge.GaugeCommandsTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.imageitem.ImageItemHyperLinkTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.item.ItemUITest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.list.ListUITest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.spacer.SpacerTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.stringitem.HyperLinkTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.stringitem.StringItemUIRobotTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.textbox.TestUITextBox.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.textbox.TextBoxInputModeUITest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.textfield.FormChangeFocusCheckTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.textfield.TextFieldCommandTest.suite());
+ addTest(com.nokia.openlcdui.mt_uirobot.textfield.TextFieldSetInitialInputModeTest.suite());
+ }
- // If tests are executed by some runner as a suite then it won't clean up the UI
- // before it let's the thread to terminate. This is executed as the last test
- // to clean up in the UI thread before it exits.
- /*if(!runningMain) {
- addTest(new TestCase() {
- protected void runTest() throws Throwable {
- Display display = Display.getCurrent();
- if(display != null) display.dispose();
- }
- public String getName() {
- return "CleanUpQtBeforeGUIThreadExits";
+
+ // If tests are executed by some runner as a suite then it won't clean up the UI
+ // before it let's the thread to terminate. This is executed as the last test
+ // to clean up in the UI thread before it exits.
+ /*if(!runningMain) {
+ addTest(new TestCase() {
+ protected void runTest() throws Throwable {
+ Display display = Display.getCurrent();
+ if(display != null) display.dispose();
+ }
+ public String getName() {
+ return "CleanUpQtBeforeGUIThreadExits";
+ }
+ });
+ }*/
+ // If some tests were disabled then generate a warning about them.
+ if(disabledTests != null)
+ {
+ addTest(new TestCase()
+ {
+ protected void runTest() throws Throwable
+ {
+ if(!disabledTests.isEmpty())
+ {
+ String list = new String();
+ list += "Warning: There are " + disabledTests.size() + " disabled tests that were marked as passing: \r\n";
+ for(int i = 0; i < disabledTests.size(); ++i)
+ {
+ list += disabledTests.elementAt(i);
+ list += "\r\n";
+ }
+ throw new Exception(list);
}
- });
- }*/
- // If some tests were disabled then generate a warning about them.
- if(disabledTests != null) {
- addTest(new TestCase() {
- protected void runTest() throws Throwable {
- if(!disabledTests.isEmpty()) {
- String list = new String();
- list += "Warning: There are " + disabledTests.size() + " disabled tests that were marked as passing: \r\n";
- for(int i = 0; i < disabledTests.size(); ++i) {
- list += disabledTests.elementAt(i);
- list += "\r\n";
- }
- throw new Exception(list);
- }
- }
- public String getName() {
- return "DisabledTestsCheck";
- }
- });
- }
- }
+ }
+ public String getName()
+ {
+ return "DisabledTestsCheck";
+ }
+ });
+ }
+ }
}