Commit bed5d518 authored by Benoît Minisini's avatar Benoît Minisini

Finish the redesign of the test suites configuration dialog.

[DEVELOPMENT ENVIRONMENT]
* NEW: Finish the redesign of the test suites configuration dialog.
* NEW: The test suite selected in the configuration dialog is now used for running the tests.
parent 5e5bf82f
......@@ -222,7 +222,7 @@
msgid ""
msgstr ""
"Project-Id-Version: gambas3 3.14.90\n"
"PO-Revision-Date: 2020-05-24 06:47 UTC\n"
"PO-Revision-Date: 2020-05-24 22:18 UTC\n"
"Last-Translator: Benoît Minisini <[email protected]>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
......@@ -974,7 +974,7 @@ msgstr "ici"
msgid "IDE extensions"
msgstr "Extension de l'EDI"
#: CProjectList.class:552 CVersionControlGit.class:398 CWaitingAnimation.class:63 FArguments.form:46 FColorChooser.form:68 FComponentChooser.form:97 FConflict.class:197 FConnectionEditor.class:470 FCrash.form:97 FCreateFile.form:204 FDebugExpr.form:46 FDebugInfo.form:408 FExportData.class:126 FFarmConfig.form:38 FFarmLogin.form:126 FFarmRegister.form:141 FFarmRequest.form:43 FFieldChooser.form:144 FFileProperty.class:160 FFontChooser.form:40 FGotoLine.form:23 FHelpBrowser.form:73 FImageOffsetSelection.form:33 FImageQuality.form:30 FImageResize.form:49 FImageRotate.form:32 FLayout.form:50 FList.form:128 FMain.class:258 FMakeInstall.class:361 FMenu.form:414 FNewConnection.form:318 FNewTable.form:86 FNewTranslation.form:21 FOption.class:820 FPasteSpecial.form:86 FPasteTable.form:105 FProjectChooser.form:73 FProjectProperty.form:968 FProjectVersion.class:211 FProxy.form:57 FPublish.class:273 FReportBorderChooser.form:48 FReportBoxShadowChooser.form:27 FReportBrushChooser.form:36 FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28 FSaveProjectAs.form:81 FSearch.class:942 FSelectComponent.form:39 FSelectExtraFile.form:43 FSelectIcon.form:89 FSelectLibrary.form:66 FSnippet.form:57 FSoftwareFarm.class:559 FTableChooser.form:68 FTestSuite2.class:327 FText.form:40 FTranslate.class:677 FVersionControl.form:98 FWebFontChooser.form:129 Project.module:568 VersionControl.module:398
#: CProjectList.class:552 CVersionControlGit.class:398 CWaitingAnimation.class:63 FArguments.form:46 FColorChooser.form:68 FComponentChooser.form:97 FConflict.class:197 FConnectionEditor.class:470 FCrash.form:97 FCreateFile.form:204 FDebugExpr.form:46 FDebugInfo.form:408 FExportData.class:126 FFarmConfig.form:38 FFarmLogin.form:126 FFarmRegister.form:141 FFarmRequest.form:43 FFieldChooser.form:144 FFileProperty.class:160 FFontChooser.form:40 FGotoLine.form:23 FHelpBrowser.form:73 FImageOffsetSelection.form:33 FImageQuality.form:30 FImageResize.form:49 FImageRotate.form:32 FLayout.form:50 FList.form:128 FMain.class:258 FMakeInstall.class:361 FMenu.form:414 FNewConnection.form:318 FNewTable.form:86 FNewTranslation.form:21 FOption.class:820 FPasteSpecial.form:86 FPasteTable.form:105 FProjectChooser.form:73 FProjectProperty.form:968 FProjectVersion.class:211 FProxy.form:57 FPublish.class:273 FReportBorderChooser.form:48 FReportBoxShadowChooser.form:27 FReportBrushChooser.form:36 FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28 FSaveProjectAs.form:81 FSearch.class:942 FSelectComponent.form:39 FSelectExtraFile.form:43 FSelectIcon.form:89 FSelectLibrary.form:66 FSnippet.form:57 FSoftwareFarm.class:559 FTableChooser.form:68 FTestSuite.class:328 FText.form:40 FTranslate.class:677 FVersionControl.form:98 FWebFontChooser.form:129 Project.module:568 VersionControl.module:398
msgid "Cancel"
msgstr "Annuler"
......@@ -1446,7 +1446,7 @@ msgstr "Enregistrer"
msgid "Solve"
msgstr "Résoudre"
#: FConflict.form:166 FConflictEditor.form:306 FDebugInfo.form:415 FEditor.form:346 FFileProperty.form:94 FForm.form:438 FImageEditor.form:392 FMain.form:410 FPatch.form:88 FProjectVersion.form:322 FSystemInfo.form:67 FTestSuite2.form:159 FTextEditor.form:342 FTips.form:83 FTranslate.form:411
#: FConflict.form:166 FConflictEditor.form:306 FDebugInfo.form:415 FEditor.form:346 FFileProperty.form:94 FForm.form:438 FImageEditor.form:392 FMain.form:410 FPatch.form:88 FProjectVersion.form:322 FSystemInfo.form:67 FTestSuite.form:172 FTextEditor.form:342 FTips.form:83 FTranslate.form:411
msgid "Close"
msgstr "Fermer"
......@@ -1765,7 +1765,7 @@ msgstr "Nouvelle table"
msgid "Delete table"
msgstr "Supprimer la table"
#: FConnectionEditor.form:134 FDebugInfo.form:192 FMain.form:1228 FMakeInstall.form:762 FOption.form:1544 FProjectProperty.form:597 FPublish.form:268 FSoftwareFarm.form:426 FTestSuite2.class:327
#: FConnectionEditor.form:134 FDebugInfo.form:192 FMain.form:1228 FMakeInstall.form:762 FOption.form:1544 FProjectProperty.form:597 FPublish.form:268 FSoftwareFarm.form:426 FTestSuite.class:328
msgid "Remove"
msgstr "Supprimer"
......@@ -3017,7 +3017,7 @@ msgstr "Transparence"
msgid "Preview"
msgstr "Aperçu"
#: FImageProperty.form:702 FProjectProperty.form:956 FTestSuite2.form:153
#: FImageProperty.form:702 FProjectProperty.form:956 FTestSuite.form:166
msgid "Reset"
msgstr "Réinitialiser"
......@@ -3447,7 +3447,7 @@ msgstr "Démarrer avec"
msgid "Test"
msgstr "Tester"
#: FMain.form:609 FTestSuite2.form:31
#: FMain.form:609 FTestSuite.form:32
msgid "Test suites"
msgstr "Suites de tests"
......@@ -4397,7 +4397,7 @@ msgstr "Impossible de décompresser la documentation."
msgid "Unable to install documentation."
msgstr "Impossible d'installer la documentation."
#: FOption.class:1636 FTestSuite2.class:32
#: FOption.class:1636 FTestSuite.class:32
msgid "Default"
msgstr "Par défault"
......@@ -5657,19 +5657,43 @@ msgstr "Veuillez recopier ces informations dans tous vos rapports de bugs."
msgid "Choose a table"
msgstr "Choisissez une table"
#: FTestSuite2.class:163
#: FTestSuite.class:164
msgid "Test suite #&1"
msgstr "Suite de tests n°&1"
#: FTestSuite2.class:193
#: FTestSuite.class:194
msgid "This test suite already exists."
msgstr "Cette suite de tests existe déjà."
#: FTestSuite2.class:327
#: FTestSuite.class:328
msgid "Do you really want to remove this test suite?"
msgstr "Désirez-vous vraiment supprimer cette suite de tests ?"
#: FTestSuite2.form:132
#: FTestSuite.form:60
msgid "New test suite"
msgstr "Nouvelle série de tests"
#: FTestSuite.form:67
msgid "Duplicate test suite"
msgstr "Dupliquer la série de tests"
#: FTestSuite.form:74
msgid "Rename test suite"
msgstr "Renommer la série de tests"
#: FTestSuite.form:81
msgid "Delete test suite"
msgstr "Supprimer la série de tests"
#: FTestSuite.form:114
msgid "Select all tests"
msgstr "Sélectionner tous les tests"
#: FTestSuite.form:121
msgid "Unselect all tests"
msgstr "Déselectionner tous les tests"
#: FTestSuite.form:145
msgid "Test with"
msgstr "Tester avec"
......
......@@ -837,6 +837,32 @@ Private Sub MakeBreakpoint(sBreakpoint As String, bOn As Boolean) As String
End
Private Sub GetTestSuite() As String
Dim hSettings As Settings
Dim iSuite As Integer
Dim sSuite As Variant
Dim aTest As String[]
Dim I As Integer
hSettings = New Settings(Project.Dir &/ ".test")
iSuite = hSettings["/TestSuites/TestWith", 0]
If iSuite = 0 Then
sSuite = hSettings["/TestSuites/Default"]
Else
sSuite = hSettings["/TestSuites/" & CStr(iSuite) &/ "Tests"]
Endif
If Not sSuite Then
aTest = Project.Tree.GetTestModules()
For I = 0 To aTest.Max
aTest[I] = File.BaseName(aTest[I])
Next
sSuite = aTest.Join()
Endif
Return sSuite
End
Private Sub Start(sCmd As String)
......@@ -920,7 +946,7 @@ Private Sub Start(sCmd As String)
If $bTest Then
aExec = [System.Path &/ "bin/gbx" & System.Version, "-g", "-f", $sFifo, "-T", "*", File.Dir(SConv(Project.Path))]
aExec = [System.Path &/ "bin/gbx" & System.Version, "-g", "-f", $sFifo, "-T", GetTestSuite(), File.Dir(SConv(Project.Path))]
$hProcess = FDebugInfo.GetTestTerminal().Exec(aExec)
$hProcess.Term.Echo = True
......
This diff is collapsed.
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,148,98)
Text = ("Choose Tests to be run with F4")
MoveScaled(0,0,92,66)
Text = ("Test suites")
Arrangement = Arrange.Vertical
Spacing = True
Margin = True
{ splSelectTests HSplit
MoveScaled(1,1,116,62)
{ HBox2 HBox
MoveScaled(2,4,83,42)
Expand = True
{ panTestSuites VBox
MoveScaled(2,6,31,41)
{ lblSuites Label
MoveScaled(1,1,24,4)
Text = ("Test Suites")
}
{ lvwTestSuites ListView
MoveScaled(1,7,29,22)
ToolTip = ("Hit Del to delete a test suite.")
{ Panel1 VBox
MoveScaled(2,2,37.875,37.875)
Expand = True
{ lvwSuite ListView
MoveScaled(4,3,27,23)
Expand = True
Sorted = True
Editable = True
Border = False
}
{ Separator4 Separator
MoveScaled(10,28,13,0)
}
{ HBox1 HBox
MoveScaled(1,35,29,4)
{ btnDeleteTestSuite Button
MoveScaled(0,0,13,4)
NoTabFocus = True
ToolTip = ("Delete test suite (Del)")
{ Panel2 HBox
MoveScaled(5,29,25,4)
{ btnNew ToolButton
MoveScaled(0,0,4,4)
ToolTip = ("New test suite")
AutoResize = True
Text = ("Delete")
Picture = Picture["icon:/small/add"]
}
{ btnRenameTestSuite Button
MoveScaled(14,0,14,4)
NoTabFocus = True
{ btnCopy ToolButton
MoveScaled(4,0,4,4)
ToolTip = ("Duplicate test suite")
AutoResize = True
Picture = Picture["icon:/small/copy"]
}
{ btnRename ToolButton
MoveScaled(8,0,4,4)
ToolTip = ("Rename test suite")
AutoResize = True
Text = ("Rename")
Picture = Picture["icon:/small/edit"]
}
{ btnDelete ToolButton
MoveScaled(12,0,4,4)
ToolTip = ("Delete test suite")
AutoResize = True
Picture = Picture["icon:/small/remove"]
}
}
}
{ panSelectTests VBox
MoveScaled(43,11,56,31)
{ Separator1 Separator
MoveScaled(41,14,0,10)
}
{ Panel5 VBox
MoveScaled(44,2,27.875,37.875)
Expand = True
{ lblSelect Label
MoveScaled(2,0,24,4)
Text = ("Select tests")
}
{ tvwTests TreeView
MoveScaled(2,10,46,16)
NoTabFocus = True
{ tvwSuite TreeView
MoveScaled(0,0,27,20)
Expand = True
Mode = Select.Multiple
Sorted = True
Border = False
ShowCheck = True
}
{ Separator2 Separator
MoveScaled(7,22,16,0)
}
{ Panel6 HBox
MoveScaled(2,26,17,4)
{ btnSelectAll ToolButton
MoveScaled(0,0,4,4)
ToolTip = ("Select all tests")
AutoResize = True
Picture = Picture["icon:/small/select-all"]
}
{ btnUnselectAll ToolButton
MoveScaled(4,0,4,4)
ToolTip = ("Unselect all tests")
AutoResize = True
Picture = Picture["icon:/small/unselect"]
}
}
}
}
{ panSelectedTests VBox
MoveScaled(1,64,116,21)
Spacing = True
{ lblSelected Label
MoveScaled(0,0,35,4)
Text = ("Selected tests (current testsuite)")
}
{ txtSelected TextArea
MoveScaled(0,4,112,11)
NoTabFocus = True
{ Separator3 Separator
MoveScaled(41,48,10,0)
}
{ HBox3 HBox
MoveScaled(3,52,84,6)
Margin = True
{ Panel3 HBox
MoveScaled(1,1,31,4)
Expand = True
ReadOnly = True
Wrap = True
Spacing = True
{ Label1 Label
MoveScaled(0,0,9,4)
AutoResize = True
Text = ("Test with")
}
{ cmbTestWith ComboBox
MoveScaled(10,0,20,4)
Expand = True
ReadOnly = True
}
}
{ panSave HBox
MoveScaled(1,16,109,4)
{ Panel4 HBox
MoveScaled(35,1,44,4)
Expand = True
Spacing = True
Invert = True
{ btnSave Button
MoveScaled(76,0,16,4)
Text = ("Save")
{ Spring1 Spring
MoveScaled(2,1,5,1)
}
{ txtNameTestSuite TextBox
MoveScaled(51,0,24,4)
{ btnReset Button
MoveScaled(8,0,16,4)
Text = ("Reset")
Picture = Picture["icon:/small/undo"]
}
{ lblStoreas Label
MoveScaled(7,0,43,4)
Text = ("Store this testsuite as:")
Alignment = Align.Right
{ btnClose Button
MoveScaled(25,0,16,4)
Text = ("Close")
Picture = Picture["icon:/small/close"]
}
}
}
......
' Gambas class file
Private $cSuites As New Collection
Private $bNoSelect As Boolean
Public Sub btnClose_Click()
SaveSuites
Me.Close
End
Public Sub Form_Open()
LoadTests
LoadSuites
End
Private Sub LoadTestWith()
Dim sText As String
Dim sKey As String
sText = cmbTestWith.Text
cmbTestWith.Clear
lvwSuite.MoveFirst
While lvwSuite.Available
sKey = lvwSuite.Item.Key
If sKey = "$" Then
cmbTestWith.Add(("Default"))
Else
cmbTestWith.Add(sKey)
Endif
lvwSuite.MoveNext
Wend
Try cmbTestWith.Text = sText
If cmbTestWith.Index < 0 Then cmbTestWith.Index = 0
End
Private Sub LoadSuites()
Dim hSettings As Settings
Dim iCount As Integer
Dim I As Integer
Dim sKey As String
Dim sName As String
hSettings = New Settings(Project.Dir &/ ".test")
iCount = hSettings["/TestSuites/Count", 0]
lvwSuite.Clear
With lvwSuite.Add("$", "")
.RichText = "<i>" & ("Default") & "</i>"
.Editable = False
End With
$cSuites.Clear
cmbTestWith.Add(("Default"))
$cSuites["$"] = SuiteToSelection(hSettings["/TestSuites/Default"])
For I = 1 To iCount
sKey = "/TestSuites/Suite" & CStr(I)
sName = hSettings[sKey &/ "Name"]
lvwSuite.Add(sName, sName)
cmbTestWith.Add(sName)
$cSuites[sName] = SuiteToSelection(hSettings[sKey &/ "Tests"])
Next
lvwSuite["$"].Selected = True
LoadTestWith
cmbTestWith.Text = hSettings["/TestSuites/TestWith", ("Default")]
End
Private Sub LoadTests()
Dim sClass As String
Dim sPath As String
Dim cSymbol As Collection
Dim hSymbol As CSymbolInfo
Dim sName As String
tvwSuite.Clear
For Each sPath In Project.Tree.GetTestModules()
sClass = File.BaseName(sPath)
tvwSuite.Add(sClass, sClass, Picture["icon:/small/directory"])
cSymbol = Project.Documentation.GetClassSymbols(sClass)
If Not cSymbol Then Continue
For Each hSymbol In cSymbol
If Not hSymbol.IsFunction Or If hSymbol.NotPublic Or If hSymbol.IsHidden Then Continue
sName = hSymbol.Name
tvwSuite.Add(sClass & "." & sName, sName, Picture["$symbol:s-method"], sClass)
Next
Next
End
Public Sub lvwSuite_Select()
If $cSuites.Exist(lvwSuite.Key) Then
tvwSuite.Selection = $cSuites[lvwSuite.Key]
Else
tvwSuite.UnselectAll
Endif
End
Private Sub SuiteToSelection(sSuite As String) As String[]
Dim aSelection As New String[]
Dim sTest As String
Dim iPos As Integer
Dim aMethod As String[]
Dim sMethod As String
If Not sSuite Then Return
For Each sTest In Split(sSuite)
iPos = InStr(sTest, ".")
If iPos Then
aMethod = Split(Mid$(sTest, iPos + 1), ";")
sTest = Left(sTest, iPos - 1)
aSelection.Add(sTest)
For Each sMethod In aMethod
aSelection.Add(sTest & "." & sMethod)
Next
Else
aSelection.Add(sTest)
Endif
Next
Return aSelection
End
Public Sub btnNew_Click()
Dim I As Integer
Dim sName As String
Do
Inc I
sName = Subst(("Test suite #&1"), I)
If Not lvwSuite.Exist(sName) Then Break
Loop
lvwSuite.Add(sName, sName).Selected = True
lvwSuite.Key = sName
LoadTestWith
btnRename_Click
End
Public Sub btnRename_Click()
Try lvwSuite.Current.Rename()
End
Public Sub lvwSuite_Rename()
Dim sNewName As String
Dim sOldName As String
sNewName = lvwSuite.Item.Text
sOldName = lvwSuite.Item.Key
If sNewName = sOldName Then Return
If lvwSuite.Exist(sNewName) Then
Balloon.Warning(("This test suite already exists."), lvwSuite, lvwSuite.Current.X + Desktop.Scale, lvwSuite.Current.Y)
Stop Event
Return
Endif
$cSuites[sNewName] = $cSuites[sOldName]
$cSuites.Remove(sOldName)
lvwSuite.Remove(sOldName)
lvwSuite.Add(sNewName, sNewName).Selected = True
LoadTestWith
End
Public Sub btnReset_Click()
LoadSuites
End
Public Sub tvwSuite_Select()
Dim bSelect As Boolean
If $bNoSelect Then Return
If Not tvwSuite.Key Then Return
$bNoSelect = True
If tvwSuite.Current.ParentKey Then
If tvwSuite.Current.Selected Then
tvwSuite[tvwSuite.Current.ParentKey].Selected = True
Endif
Else If tvwSuite.Current.Children Then
bSelect = tvwSuite.Current.Selected
'tvwSuite.Current.Expanded = True
tvwSuite.MoveTo(tvwSuite.Key)
tvwSuite.MoveChild()
While tvwSuite.Available
tvwSuite.Item.Selected = bSelect
tvwSuite.MoveNext()
Wend
Endif
$bNoSelect = False
$cSuites[lvwSuite.Key] = tvwSuite.Selection
End
Private Sub SelectionToSuite(aSel As String[]) As String
Dim aSelection As New String[]
Dim iPos As Integer
Dim sMethod As String
Dim sLastClass As String
Dim sSuite As String
Dim bMethod As Boolean
Dim sKey As String
Dim sClass As String
If Not aSel Then Return
For Each sKey In aSel.Sort(gb.Natural)
iPos = InStr(sKey, ".")
If iPos Then
sMethod = Mid$(sKey, iPos + 1)
sClass = Left(sKey, iPos - 1)
Else
sClass = sKey
sMethod = ""
Endif
If sClass <> sLastClass Then
If sSuite Then sSuite &= ","
sSuite &= sClass
sLastClass = sClass
bMethod = False
Endif
If sMethod Then
sSuite &= If(bMethod, ";", ".") & sMethod
bMethod = True
Endif
Next
Return sSuite
Return aSelection
End
Private Sub SaveSuites()
Dim sKey As String
Dim hSettings As Settings
Dim iCount As Integer
Dim sSlot As String
hSettings = New Settings(Project.Dir &/ ".test")
hSettings.Clear("/TestSuites")
lvwSuite.MoveFirst
While lvwSuite.Available
sKey = lvwSuite.Item.Key
If sKey = "$" Then
hSettings["/TestSuites/Default"] = SelectionToSuite($cSuites[sKey])
Else
Inc iCount
sSlot = "/TestSuites/Suite" & CStr(iCount)
hSettings[sSlot &/ "Name"] = sKey
hSettings[sSlot &/ "Tests"] = SelectionToSuite($cSuites[sKey])
Endif
lvwSuite.MoveNext
Wend
hSettings["/TestSuites/Count"] = iCount
hSettings["/TestSuites/TestWith"] = cmbTestWith.Text
hSettings.Save
End