From 5be88f560bbb0d8702d468bd15c96f3b8d86256c Mon Sep 17 00:00:00 2001 From: Christof Thalhofer Date: Fri, 23 Sep 2016 17:50:35 +0200 Subject: [PATCH] keyboard control --- .settings | 6 +++--- .src/TestRunner/FmRunner.class | 12 ++++++++++++ .src/TestRunner/FmRunner.form | 12 ++++++++++-- .src/TesteStartRunner.module | 3 ++- README.md | 6 +++--- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.settings b/.settings index 8705a1cdc..2982bc49c 100644 --- a/.settings +++ b/.settings @@ -313,11 +313,11 @@ Path="gb.deg.unit.gambas" [OpenFile] File[1]=".src/TestRunner/FmRunner.form" File[2]=".src/TestRunner/FmTrace.form" -File[3]=".src/TestRunner/FmRunner.class:63.89" +File[3]=".src/TestRunner/FmRunner.class:18.261" File[4]=".src/TestRunner/FmTrace.class:40.64" -Active=5 +Active=1 Count=17 -File[5]=".src/TesteStartRunner.module:24.6" +File[5]=".src/TesteStartRunner.module:18.6" File[6]=".src/TestMyself/_TestErrorsAndFailures.class:6.7" File[7]=".src/TestRunner/UnitTest.class:72.116" File[8]=".src/TestSuite/TestSuite.class:8.44" diff --git a/.src/TestRunner/FmRunner.class b/.src/TestRunner/FmRunner.class index 5113bd796..d889d803b 100644 --- a/.src/TestRunner/FmRunner.class +++ b/.src/TestRunner/FmRunner.class @@ -255,3 +255,15 @@ Public Sub Form_Open() $FH.SizeLoad() End + +Public Sub Form_KeyPress() + + If $FH.DetectControl(Key["r"]) Then + RunTests() + Endif + + If $FH.DetectEscape() Then + Me.Close + Endif + +End diff --git a/.src/TestRunner/FmRunner.form b/.src/TestRunner/FmRunner.form index c6a5145ca..33a714950 100644 --- a/.src/TestRunner/FmRunner.form +++ b/.src/TestRunner/FmRunner.form @@ -39,8 +39,16 @@ MoveScaled(2,50,100,4) Invert = True { BtRun Button - MoveScaled(82,0,16,4) - Text = ("Run Tests") + MoveScaled(76,0,22,4) + Text = ("Run Tests (Ctrl-r)") + } + { HBox1 HBox + MoveScaled(0,0,74,4) + Expand = True + { Label3 Label + MoveScaled(1,0,24,4) + Text = ("Press to close") + } } } } diff --git a/.src/TesteStartRunner.module b/.src/TesteStartRunner.module index 4d25e1a38..389579fcd 100644 --- a/.src/TesteStartRunner.module +++ b/.src/TesteStartRunner.module @@ -4,7 +4,8 @@ Public Sub Main() Dim r As New UnitTest - r.DoSelfTest = False + ' Do Selftest: + r.DoSelfTest = True 'r.Test() r.ShowTestForm() diff --git a/README.md b/README.md index dc7fea1bd..2296d2745 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The following example you find also in [this simple Gambas project](unittesthell ### Example TestContainer -You should create a class with a name starting with "_Test", for example "_TestHelloWorld", it contains one or more public testmethod(s). It has to inherit from ATestContainer and it has to be exported to ensure the unittest will recognize it. It is the so called TestContainer: +Start by creating a class with a name like "_Test", for example "_TestHelloWorld". This class contains one or more public testmethod(s). It has to inherit from ATestContainer and it has to be exported to ensure that Unittest will recognize it. The trailing underscore ensures that the Gambas interpreter hides these classnames, even when they are exported. But you can take every other name for it. This class is the so called TestContainer: ---- ' Gambas class file @@ -82,7 +82,7 @@ The simple way to execute the Unittest is, to create another Module, name it "Te ---- -If you did this all correctly and now Hit < F5 > on your keyboard, gambas will execute the startfunction in module Test, which works through the method(s) of our TestContainer and presents the test result in the console: +If you did this all correctly and now Hit < F5 > on your keyboard, gambas will execute the startfunction in module Test, which works through the method(s) of our TestContainer and presents the test result in the console: ----------------------- Test Results ----------------------- 1 Tests done @@ -96,7 +96,7 @@ If you did this all correctly and now Hit < F5 > on your keyboard, gambas will e ---- -Sooo ... and if you want to see the beautiful form, change the startclass (ah... startmodule) +Sooo ... and if you want to see the beautiful form, alter the startclass (ah... startmodule) ---- Public Sub Main()