Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More panel settinggs #341

Merged
merged 8 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions .gut_editor_config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"background_color": "ff262626",
"background_color": "ff343434",
"config_file": "res://.gutconfig.json",
"dirs": [
"res://test/unit",
"res://test/integration"
"res://test/integration",
"res://test/panel_demo_scripts"
],
"disable_colors": false,
"double_strategy": "partial",
"font_color": "ffcccccc",
"font_color": "ffc1bfce",
"font_name": "CourierPrime",
"font_size": 30,
"font_size": 15,
"hide_orphans": false,
"ignore_pause": true,
"include_subdirs": false,
Expand All @@ -21,14 +22,18 @@
"post_run_script": "",
"pre_run_script": "",
"prefix": "test_",
"selected": "test_spy.gd",
"should_exit": true,
"selected": "test_totals_testing.gd",
"should_exit": false,
"should_exit_on_success": false,
"should_maximize": false,
"show_help": false,
"suffix": ".gd",
"tests": [

],
"unit_test_name": null
"unit_test_name": null,
"panel_options": {
"font_name": "CourierPrime",
"font_size": 30
}
}
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ func test_foo():
```
* In-Editor GUT Panel improvements
* Smart buttons to run tests based on cursor location.
* __Issue 215__ You can now use `extends GutTest` instead of `extends 'res://addons/gut/test.gd'` when creating test scripts. That's 45% less text!
* Added more settings (hook scripts, font color, background color, panel font settings, directory and file dialog buttons where appropriate, hide orphans, disable colors)
* Display counts for errors, warnings, orphans (only displayed when present).
* Added some `class_name` clauses to files:
* __Issue 215__ You can now use `extends GutTest` instead of `extends 'res://addons/gut/test.gd'` when creating test scripts. That's 45% less text!
* When making a hook script, you can use `extends GutHookScript` instead of using the path.
* __Issue 310__ The summary output now lists the number of passing/failing tests as well as passing/failing assert counts.

## Bug Fixes
Expand Down
33 changes: 25 additions & 8 deletions addons/gut/gui/GutBottomPanel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,26 @@ onready var _ctrls = {
shortcut_dialog = $BottomPanelShortcuts,
light = $layout/RSplit/CResults/ControlBar/Light,
results = {
passing = $layout/RSplit/CResults/ControlBar/lblPassingValue,
failing = $layout/RSplit/CResults/ControlBar/lblFailingValue,
pending = $layout/RSplit/CResults/ControlBar/lblPendingValue
passing = $layout/RSplit/CResults/ControlBar/Passing/value,
failing = $layout/RSplit/CResults/ControlBar/Failing/value,
pending = $layout/RSplit/CResults/ControlBar/Pending/value,
errors = $layout/RSplit/CResults/ControlBar/Errors/value,
warnings = $layout/RSplit/CResults/ControlBar/Warnings/value,
orphans = $layout/RSplit/CResults/ControlBar/Orphans/value
},
run_at_cursor = $layout/ControlBar/RunAtCursor
}


func _init():
_gut_config.load_options(RUNNER_JSON_PATH)
_gut_config.load_panel_options(RUNNER_JSON_PATH)


func _ready():
_gut_config_gui = GutConfigGui.new(_ctrls.settings)
_gut_config_gui.set_options(_gut_config.options)
_set_all_fonts_in_ftl(_ctrls.output, _gut_config.options.font_name)
_set_font_size_for_rtl(_ctrls.output, _gut_config.options.font_size)
_set_all_fonts_in_ftl(_ctrls.output, _gut_config.options.panel_options.font_name)
_set_font_size_for_rtl(_ctrls.output, _gut_config.options.panel_options.font_size)


func _process(delta):
Expand Down Expand Up @@ -136,8 +139,8 @@ func _run_tests():

write_file(RESULT_FILE, 'Run in progress')
_gut_config.options = _gut_config_gui.get_options(_gut_config.options)
_set_all_fonts_in_ftl(_ctrls.output, _gut_config.options.font_name)
_set_font_size_for_rtl(_ctrls.output, _gut_config.options.font_size)
_set_all_fonts_in_ftl(_ctrls.output, _gut_config.options.panel_options.font_name)
_set_font_size_for_rtl(_ctrls.output, _gut_config.options.panel_options.font_size)

var w_result = _gut_config.write_options(RUNNER_JSON_PATH)
if(w_result != OK):
Expand Down Expand Up @@ -235,8 +238,22 @@ func load_result_output():
return
var summary_json = results.result['test_scripts']['props']
_ctrls.results.passing.text = str(summary_json.passing)
_ctrls.results.passing.get_parent().visible = true

_ctrls.results.failing.text = str(summary_json.failures)
_ctrls.results.failing.get_parent().visible = true

_ctrls.results.pending.text = str(summary_json.pending)
_ctrls.results.pending.get_parent().visible = _ctrls.results.pending.text != '0'

_ctrls.results.errors.text = str(summary_json.errors)
_ctrls.results.errors.get_parent().visible = _ctrls.results.errors.text != '0'

_ctrls.results.warnings.text = str(summary_json.warnings)
_ctrls.results.warnings.get_parent().visible = _ctrls.results.warnings.text != '0'

_ctrls.results.orphans.text = str(summary_json.orphans)
_ctrls.results.orphans.get_parent().visible = _ctrls.results.orphans.text != '0' and !_gut_config.options.hide_orphans

if(summary_json.tests == 0):
_light_color = Color(1, 0, 0, .75)
Expand Down
150 changes: 131 additions & 19 deletions addons/gut/gui/GutBottomPanel.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -164,50 +164,162 @@ margin_right = 30.0
margin_bottom = 35.0
rect_min_size = Vector2( 30, 30 )

[node name="lblPassing" type="Label" parent="layout/RSplit/CResults/ControlBar"]
[node name="Passing" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 107.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Passing"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Passing"]
margin_left = 6.0
margin_top = 10.0
margin_right = 82.0
margin_right = 54.0
margin_bottom = 24.0
text = "Passing"

[node name="lblPassingValue" type="Label" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 86.0
[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Passing"]
margin_left = 58.0
margin_top = 10.0
margin_right = 101.0
margin_right = 73.0
margin_bottom = 24.0
text = "---"

[node name="lblFailing" type="Label" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 105.0
[node name="Failing" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 100.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Failing"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Failing"]
margin_left = 6.0
margin_top = 10.0
margin_right = 146.0
margin_right = 47.0
margin_bottom = 24.0
text = "Failing"

[node name="lblFailingValue" type="Label" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 150.0
[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Failing"]
margin_left = 51.0
margin_top = 10.0
margin_right = 165.0
margin_right = 66.0
margin_bottom = 24.0
text = "---"

[node name="lblPending" type="Label" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 169.0
[node name="Pending" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 110.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Pending"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Pending"]
margin_left = 6.0
margin_top = 10.0
margin_right = 220.0
margin_right = 57.0
margin_bottom = 24.0
text = "Pending"

[node name="lblPendingValue" type="Label" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 224.0
[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Pending"]
margin_left = 61.0
margin_top = 10.0
margin_right = 76.0
margin_bottom = 24.0
text = "---"

[node name="Orphans" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 110.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Orphans"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Orphans"]
margin_left = 6.0
margin_top = 10.0
margin_right = 57.0
margin_bottom = 24.0
text = "Orphans"

[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Orphans"]
margin_left = 61.0
margin_top = 10.0
margin_right = 239.0
margin_right = 76.0
margin_bottom = 24.0
text = "---"

[node name="Errors" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 96.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Errors"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Errors"]
margin_left = 6.0
margin_top = 10.0
margin_right = 43.0
margin_bottom = 24.0
hint_tooltip = "The number of GUT errors generated. This does not include engine errors."
text = "Errors"

[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Errors"]
margin_left = 47.0
margin_top = 10.0
margin_right = 62.0
margin_bottom = 24.0
text = "---"

[node name="Warnings" type="HBoxContainer" parent="layout/RSplit/CResults/ControlBar"]
visible = false
margin_left = 34.0
margin_right = 118.0
margin_bottom = 35.0

[node name="Sep" type="ColorRect" parent="layout/RSplit/CResults/ControlBar/Warnings"]
margin_right = 2.0
margin_bottom = 35.0
rect_min_size = Vector2( 2, 0 )

[node name="label" type="Label" parent="layout/RSplit/CResults/ControlBar/Warnings"]
margin_left = 6.0
margin_top = 10.0
margin_right = 65.0
margin_bottom = 24.0
text = "Warnings"
__meta__ = {
"_editor_description_": "The number of GUT Warnings generated. This does not include engine warnings."
}

[node name="value" type="Label" parent="layout/RSplit/CResults/ControlBar/Warnings"]
margin_left = 69.0
margin_top = 10.0
margin_right = 84.0
margin_bottom = 24.0
text = "---"

[node name="CenterContainer" type="CenterContainer" parent="layout/RSplit/CResults/ControlBar"]
margin_left = 243.0
margin_left = 34.0
margin_right = 488.0
margin_bottom = 35.0
size_flags_horizontal = 3
Expand Down Expand Up @@ -249,7 +361,7 @@ size_flags_vertical = 3

[node name="Settings" type="VBoxContainer" parent="layout/RSplit/sc"]
margin_right = 388.0
margin_bottom = 586.0
margin_bottom = 806.0
size_flags_horizontal = 3
size_flags_vertical = 3

Expand Down
7 changes: 7 additions & 0 deletions addons/gut/gui/Settings.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_scene format=2]

[node name="Settings" type="VBoxContainer"]
margin_right = 388.0
margin_bottom = 586.0
size_flags_horizontal = 3
size_flags_vertical = 3
Loading