Skip to content

Commit

Permalink
Godot 4.0 adaption (#378)
Browse files Browse the repository at this point in the history

* Another attempt at porting to Godot 4

* additional addon fixes

* additional fixes

* fix removal of rect_min_size with custom_minimum_size

* address more issues

* fix remaining setget methods

* 🐛 remove NativeScript

* 🐛 additional gdscript fixes

* 💥 delete native script

Co-authored-by: Butch Wesley <[email protected]>
Co-authored-by: Divided by Zer0 <[email protected]>
Co-authored-by: strank <[email protected]>
Co-authored-by: Johannes Ebner <[email protected]>
Co-authored-by: hilfazer <[email protected]>
Co-authored-by: Aaron Franke <[email protected]>
  • Loading branch information
7 people authored Aug 7, 2022
1 parent 3e36028 commit 06e14a3
Show file tree
Hide file tree
Showing 188 changed files with 10,813 additions and 2,178 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

# Exclude all top-level files and directories
# (except addons) from zip downloads.
# This makes installing Gut through the AssetLib
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Godot 4+ specific ignores
.godot/

# Godot-specific ignores
.import/
Expand All @@ -18,3 +20,7 @@ mono_crash.*.json
.DS_Store
exported_tests.cfg
.vscode/

# GUT-specific ignores
.gut_editor_config.json
.gut_editor_shortcuts.cfg
17 changes: 17 additions & 0 deletions .gut_editor_shortcuts.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[main]

run_all=Object(ShortCut,"resource_local_to_scene":false,"resource_name":"","shortcut":Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":false,"pressed":false,"scancode":49,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
,"script":null)

run_current_script=Object(ShortCut,"resource_local_to_scene":false,"resource_name":"","shortcut":Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":false,"pressed":false,"scancode":50,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
,"script":null)

run_current_inner=Object(ShortCut,"resource_local_to_scene":false,"resource_name":"","shortcut":Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":false,"pressed":false,"scancode":51,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
,"script":null)

run_current_test=Object(ShortCut,"resource_local_to_scene":false,"resource_name":"","shortcut":Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":false,"pressed":false,"scancode":52,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
,"script":null)

panel_button=Object(ShortCut,"resource_local_to_scene":false,"resource_name":"","shortcut":Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":false,"pressed":false,"scancode":48,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
,"script":null)

12 changes: 8 additions & 4 deletions .gutconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"dirs":["res://test/unit/", "res://test/integration/"],
"should_maximize":true,
"dirs":["res://test/unit/", "res://test/unit/test_bugs/", "res://test/integration/"],
"should_maximize":false,
"should_exit":true,
"ignore_pause":true,
"log_level":1,
"log_level":3,
"opacity":100,
"double_strategy":"partial",
"include_subdirs":true,
"inner_class":"",
"disable_colors":false
"disable_colors":false,
"post_run_script":"res://test/post_run_export_json.gd",

"compact_mode":true,
"gut_on_top":true
}
8 changes: 8 additions & 0 deletions BigFont.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_resource type="FontFile" load_steps=2 format=2]

[sub_resource type="FontFile" id=9]
font_path = "res://addons/gut/fonts/LobsterTwo-BoldItalic.ttf"

[resource]
size = 40
font_data = SubResource( 9 )
6 changes: 6 additions & 0 deletions BigFontTheme.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]

[ext_resource path="res://BigFont.tres" type="FontFile" id=1]

[resource]
default_font = ExtResource( 1 )
79 changes: 77 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,88 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).


# 7.X.X

## Features
* __Issue 354__ Doubles and partial doubles can now be instanced with parameters
* You can now specify parameters when instancing a double/partial double:<br/>
`var dbl = double(MyClass).new(1, 2, 'c')`
* You can now spy on `_init` to verify parameter values:<br/>
`assert_called(my_inst, '_init', [1, 2, 'c'])`
* You can now stub default parameter values for `_init`:<br/>
`stub(MyClass, '_init').param_defaults([1, 2, 'c'])`
* __Issue 363__ GUT In-Editor Panel Improvements
* New, super fancy, Tree Panel that shows your failing/pending/risky tests. Click an element in the tree, go to that line in the file AND that line in the output.
* You can toggle the visibility of Settings, Output, and Tree panels.
* You can search the output.
* Some nice editor icons to make things look slick.

#### Misc
* Yield messages are now disabled on log level 0.
* Tests that do not assert are included in the summary as "risky".
* Test totals in various places have been adjusted to display a passing count and total count.

## Bug Fixes
* __Issue 288__ First `yield` in a test does not cause a .4 second delay.
* __Issue 368__ Doubling `WebSocketClient` and anything with a `PoolStringArray` default value.

# 7.3.0

## Features
#### Mocking Input
* 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.
* Added `InputFactory` static class to `addons/gut/test.gd` to simplify creating `InputEvent*` events for use in tests. See [Input Factory](https://github.com/bitwes/Gut/wiki/Input-Factory).
* Added `InputSender` class for mocking input and scripting input sequences. See [Mock Input](https://github.com/bitwes/Gut/wiki/Mock-Input).
```
func test_fireball_input():
var player = Fighter.new()
var sender = InputSender.new(player)
sender.action_down("down").hold_for(.1)\
.action_down("down_forward").hold_for(.1)\
.action_down("forward").key_down("FP")
yield(sender, 'idle')
assert_true(player.is_throwing_fireball())
```

#### Misc
* __Issue 121__ Child tests are now added to the root scene instead of to the GUT Runner. The new "On Top" setting and "Compact Mode" can be used to manage the visibility of objects added during tests and seeing test results.
* Introduced new setting which causes GUT to always be on top. There is an "On Top" setting added to the GUT Panel. This option can also be specified in gutconfig (`"gut_on_top":true`).
* Compact Mode added to the panel, gutconfig and command line. This minimizes the size of the GUT runner and puts it in the corner. Unlike Baby...we all can put GUT in the corner.
* In-Editor GUT Panel improvements
* Smart buttons to run tests based on cursor location.
* 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).
* __Issue 310__ The summary output now lists the number of passing/failing tests as well as passing/failing assert counts.

# x.x.x

## Bug Fixes
* __Issue 283__ The Gut Scene now has a theme with a font which prevents higher level font changes from applying to the Gut Scene.
* __Issue 294__ GUT ignores the `res://addons/gut` directory if you accidently include it as a test directory.

# 7.2.0

## Features
* Run GUT straight from the Editor, no scene needed! This is my first stab at making an Editor GUI for GUT. It's not perfect yet so please me know what works and what doesn't. More info in the [Quick Start](https://github.com/bitwes/Gut/wiki/Quick-Start) wiki page.
* __Issue 207__ Added ability to export test results in the JUnit XML format.
* Added "Junit Xml File" setting to the Gut control to specify the file. "Junit Xml Timestamp" will include an epoch timestamp in the filename.
* `-gjunit_xml_file` and `-gjunit_xml_timestamp` are supported on the command line.
* `junit_xml_file` and `junit_xml_timestamp` are supported in the `.gutconfig.json` file.
* Added `yield_frames`. It works similar to `yield_for` except it will yield for N frames instead of N seconds.
* __Issue #266__ Introduced `stub(...).param_count(x)` which allow you to specify the number of paramters a method has. Useful when working with vararg methods or NativeScripts. This addresses #246 and #252. See the Stubbing page in the wiki for more information.
* __Issue #263__ Introduced `stub(...).param_defaults([])` which allows you to specify the default values that a method should get. See the Stubbing page in the wiki for more information.
* __Issue #248__ Added `get_call_count` which allows you to get the number of times a method was called.

## Bug Fixes
* __Issue 268__ Add message when `assert_signal_emitted_with_parameters` is passed bad parameters.
* __Issue 258__ `yield_to` now supports signals with up to 9 parameters. This is the same limit supported by `watch_signals`.

* __Issue 304__ `assert_is` no longer errors when asserting objects of type `Reference`.
* __Issue 257__ Gut only uses NativeScript when NativeScript exists in the build.
* __Issue 290__ consts defined in test-scripts that start with 'Test' are further validated before being treated as Inner-Test-Classes.
* __Issue 239__ @db0 fixed `assert_almost_eq` and `assert_almost_ne` to work with Vectors properly.


# 7.1.0
Expand Down
79 changes: 41 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
# Gut 7.1.0
GUT (Godot Unit Test) is a utility for writing tests for your Godot Engine game. It allows you to write tests for your gdscript in gdscript.


# Features
* Godot 3.2.x compatible, includes all releases from 3.2.0 through 3.2.2. [6.8.3](https://github.com/bitwes/Gut/releases/tag/v6.8.3) is 3.1 compatible
* [Simple install](https://github.com/bitwes/Gut/wiki/Install) via the Asset Library.
* A plethora of [asserts and utility methods](https://github.com/bitwes/Gut/wiki/Asserts-and-Methods) to help make your tests simple and concise.
* Support for [Inner Test Classes](https://github.com/bitwes/Gut/wiki/Inner-Test-Classes) to give your tests some extra context and maintainability.
* Doubling: [Full](https://github.com/bitwes/Gut/wiki/Doubles) and [Partial](https://github.com/bitwes/Gut/wiki/Partial-Doubles), [Stubbing](https://github.com/bitwes/Gut/wiki/Stubbing), [Spies](https://github.com/bitwes/Gut/wiki/Spies)
* Command Line Interface [(CLI)](https://github.com/bitwes/Gut/wiki/Command-Line)
* [Parameterized Tests](https://github.com/bitwes/Gut/wiki/ParameterizedTests)
* [Export tests](https://github.com/bitwes/Gut/wiki/Exporting-Tests) with your project and run them on any platform Godot supports.

More info can be found in the [wiki](https://github.com/bitwes/Gut/wiki).


# Getting Started
* [Install](https://github.com/bitwes/Gut/wiki/Install)
* [Quick Start](https://github.com/bitwes/Gut/wiki/Quick-Start)
* [Creating Tests](https://github.com/bitwes/Gut/wiki/Creating-Tests)
* [Asserts and Methods](https://github.com/bitwes/Gut/wiki/Asserts-and-Methods)


# VSCode Extension
Run your tests directly from the VSCode Editor. Search VSCode extensions for "gut-extension". The plugin has commands to run your entire test suite, a single test script or a single test.
* [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=bitwes.gut-extension)
* [Github repo](https://github.com/bitwes/gut-extension)
* [Quick tutorial on setup and use](https://youtu.be/pqcA8A52CMs)


# License
Gut is provided under the MIT license. License is in `addons/gut/LICENSE.md`


## [Tutorials](https://github.com/bitwes/Gut/wiki/Tutorials)
* [Here's a short setup tutorial provided by Rainware](https://www.youtube.com/watch?v=vBbqlfmcAlc)
* [TDD and P O N G Series](https://www.youtube.com/channel/UCkGO6guRt_5fOh3oDHbfg9w/playlists)
# Gut 7.3.0
GUT (Godot Unit Test) is a unit testing framework for the [Godot Engine](https://godotengine.org/). It allows you to write tests for your gdscript in gdscript.

### Donate/Shameless Plug
If you would like to help support GUT check out my game [Country or State](https://www.youtube.com/watch?v=iCAROKgN9xw&t=4s) on [Android](https://play.google.com/store/apps/details?id=com.butchwesley.country_or_state&hl=en_US&gl=US) and [iOS](https://apps.apple.com/us/app/country-or-state/id1504122706). Then, purchase the full version even if you don't like it. Thanks!

# Features
* Godot 3.2.x, 3.3.x, 3.4.x compatible.
* [Simple install](https://github.com/bitwes/Gut/wiki/Install) via the Asset Library.
* A plethora of [asserts and utility methods](https://github.com/bitwes/Gut/wiki/Asserts-and-Methods) to help make your tests simple and concise.
* Support for [Inner Test Classes](https://github.com/bitwes/Gut/wiki/Inner-Test-Classes) to give your tests some extra context and maintainability.
* Doubling: [Full](https://github.com/bitwes/Gut/wiki/Doubles) and [Partial](https://github.com/bitwes/Gut/wiki/Partial-Doubles), [Stubbing](https://github.com/bitwes/Gut/wiki/Stubbing), [Spies](https://github.com/bitwes/Gut/wiki/Spies)
* Command Line Interface [(CLI)](https://github.com/bitwes/Gut/wiki/Command-Line)
* [Parameterized Tests](https://github.com/bitwes/Gut/wiki/ParameterizedTests)
* [Export results](https://github.com/bitwes/Gut/wiki/Export-Test-Results) in standard JUnit XML format.
* [Distribute your tests](https://github.com/bitwes/Gut/wiki/Running-On-Devices) with your project and run them on any platform Godot supports.

More info can be found in the [wiki](https://github.com/bitwes/Gut/wiki).


# Getting Started
* [Install](https://github.com/bitwes/Gut/wiki/Install)
* [Quick Start](https://github.com/bitwes/Gut/wiki/Quick-Start)
* [Creating Tests](https://github.com/bitwes/Gut/wiki/Creating-Tests)
* [Asserts and Methods](https://github.com/bitwes/Gut/wiki/Asserts-and-Methods)


# VSCode Extension
Run your tests directly from the VSCode Editor. Search VSCode extensions for "gut-extension". The plugin has commands to run your entire test suite, a single test script or a single test.
* [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=bitwes.gut-extension)
* [Github repo](https://github.com/bitwes/gut-extension)
* [Quick tutorial on setup and use](https://youtu.be/pqcA8A52CMs)


# License
Gut is provided under the MIT license. License is in `addons/gut/LICENSE.md`


## [Tutorials](https://github.com/bitwes/Gut/wiki/Tutorials)
* [TDD and P O N G Series](https://www.youtube.com/channel/UCkGO6guRt_5fOh3oDHbfg9w/playlists)
* Wiki list of tutorials https://github.com/bitwes/Gut/wiki/Tutorials
Loading

0 comments on commit 06e14a3

Please sign in to comment.