keyboard control

This commit is contained in:
Christof Thalhofer 2016-09-23 17:50:35 +02:00
parent 63b199dd70
commit 5be88f560b
5 changed files with 30 additions and 9 deletions

View file

@ -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"

View file

@ -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

View file

@ -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 <Esc> to close")
}
}
}
}

View file

@ -4,7 +4,8 @@ Public Sub Main()
Dim r As New UnitTest
r.DoSelfTest = False
' Do Selftest:
r.DoSelfTest = True
'r.Test()
r.ShowTestForm()

View file

@ -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()