Skip to content

Commit dcbc810

Browse files
authored
Merge pull request #3 from idbrii/gut-930
Upgrade gut to v9.3.0, include `.import` files, update .gitignore
2 parents 6310632 + ac8f7fa commit dcbc810

File tree

116 files changed

+7587
-1447
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+7587
-1447
lines changed

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
# Godot 4+ specific ignores
2+
.godot/
13

24
# Godot-specific ignores
35
.import/
4-
*.import
56
export.cfg
6-
*.TMP
7+
export_presets.cfg
8+
9+
# Imported translations (automatically generated from CSV files)
10+
*.translation
711

812
# Mono-specific ignores
913
.mono/
14+
data_*/
15+
mono_crash.*.json
1016

1117
# Other
1218
demo.txt

.gut_editor_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
"font_name": "CourierPrime",
3838
"font_size": 30
3939
}
40-
}
40+
}

addons/gut/GutScene.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,6 @@ func use_compact_mode(should=true):
125125
func set_opacity(val):
126126
_normal_gui.modulate.a = val
127127
_compact_gui.modulate.a = val
128+
129+
func set_title(text):
130+
_set_both_titles(text)

addons/gut/UserFileViewer.tscn

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ script = ExtResource("1")
99
[node name="FileDialog" type="FileDialog" parent="."]
1010
access = 1
1111
show_hidden_files = true
12+
__meta__ = {
13+
"_edit_use_anchors_": false
14+
}
1215

1316
[node name="TextDisplay" type="ColorRect" parent="."]
14-
anchors_preset = 15
1517
anchor_right = 1.0
1618
anchor_bottom = 1.0
1719
offset_left = 8.0
@@ -20,7 +22,6 @@ offset_bottom = -65.0
2022
color = Color(0.2, 0.188235, 0.188235, 1)
2123

2224
[node name="RichTextLabel" type="RichTextLabel" parent="TextDisplay"]
23-
layout_mode = 0
2425
anchor_right = 1.0
2526
anchor_bottom = 1.0
2627
focus_mode = 2
@@ -32,7 +33,6 @@ Versions of the Lorem ipsum text have been used in typesetting at least since th
3233
selection_enabled = true
3334

3435
[node name="OpenFile" type="Button" parent="."]
35-
anchors_preset = 3
3636
anchor_left = 1.0
3737
anchor_top = 1.0
3838
anchor_right = 1.0
@@ -44,7 +44,6 @@ offset_bottom = -30.0
4444
text = "Open File"
4545

4646
[node name="Home" type="Button" parent="."]
47-
anchors_preset = 3
4847
anchor_left = 1.0
4948
anchor_top = 1.0
5049
anchor_right = 1.0
@@ -56,7 +55,6 @@ offset_bottom = -30.0
5655
text = "Home"
5756

5857
[node name="Copy" type="Button" parent="."]
59-
anchors_preset = 2
6058
anchor_top = 1.0
6159
anchor_bottom = 1.0
6260
offset_left = 160.0
@@ -66,7 +64,6 @@ offset_bottom = -30.0
6664
text = "Copy"
6765

6866
[node name="End" type="Button" parent="."]
69-
anchors_preset = 3
7067
anchor_left = 1.0
7168
anchor_top = 1.0
7269
anchor_right = 1.0
@@ -78,7 +75,6 @@ offset_bottom = -30.0
7875
text = "End"
7976

8077
[node name="Close" type="Button" parent="."]
81-
anchors_preset = 2
8278
anchor_top = 1.0
8379
anchor_bottom = 1.0
8480
offset_left = 10.0

addons/gut/autofree.gd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,3 @@ func free_all():
5555
if(is_instance_valid(_to_queue_free[i])):
5656
_to_queue_free[i].queue_free()
5757
_to_queue_free.clear()
58-
59-

addons/gut/awaiter.gd

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
extends Node
2+
3+
signal timeout
4+
signal wait_started
5+
6+
var _wait_time := 0.0
7+
var _wait_frames := 0
8+
var _signal_to_wait_on = null
9+
10+
var _predicate_function_waiting_to_be_true = null
11+
var _predicate_time_between := 0.0
12+
var _predicate_time_between_elpased := 0.0
13+
14+
var _did_last_wait_timeout = false
15+
var did_last_wait_timeout = false :
16+
get: return _did_last_wait_timeout
17+
set(val): push_error("Cannot set did_last_wait_timeout")
18+
19+
var _elapsed_time := 0.0
20+
var _elapsed_frames := 0
21+
22+
23+
func _physics_process(delta):
24+
if(_wait_time != 0.0):
25+
_elapsed_time += delta
26+
if(_elapsed_time >= _wait_time):
27+
_end_wait()
28+
29+
if(_wait_frames != 0):
30+
_elapsed_frames += 1
31+
if(_elapsed_frames >= _wait_frames):
32+
_end_wait()
33+
34+
if(_predicate_function_waiting_to_be_true != null):
35+
_predicate_time_between_elpased += delta
36+
if(_predicate_time_between_elpased >= _predicate_time_between):
37+
_predicate_time_between_elpased = 0.0
38+
var result = _predicate_function_waiting_to_be_true.call()
39+
if(typeof(result) == TYPE_BOOL and result):
40+
_end_wait()
41+
42+
43+
func _end_wait():
44+
# Check for time before checking for frames so that the extra frames added
45+
# when waiting on a signal do not cause a false negative for timing out.
46+
if(_wait_time > 0):
47+
_did_last_wait_timeout = _elapsed_time >= _wait_time
48+
elif(_wait_frames > 0):
49+
_did_last_wait_timeout = _elapsed_frames >= _wait_frames
50+
51+
if(_signal_to_wait_on != null and _signal_to_wait_on.is_connected(_signal_callback)):
52+
_signal_to_wait_on.disconnect(_signal_callback)
53+
54+
_wait_time = 0.0
55+
_wait_frames = 0
56+
_signal_to_wait_on = null
57+
_predicate_function_waiting_to_be_true = null
58+
_elapsed_time = 0.0
59+
_elapsed_frames = 0
60+
timeout.emit()
61+
62+
63+
const ARG_NOT_SET = '_*_argument_*_is_*_not_set_*_'
64+
func _signal_callback(
65+
_arg1=ARG_NOT_SET, _arg2=ARG_NOT_SET, _arg3=ARG_NOT_SET,
66+
_arg4=ARG_NOT_SET, _arg5=ARG_NOT_SET, _arg6=ARG_NOT_SET,
67+
_arg7=ARG_NOT_SET, _arg8=ARG_NOT_SET, _arg9=ARG_NOT_SET):
68+
69+
_signal_to_wait_on.disconnect(_signal_callback)
70+
# DO NOT _end_wait here. For other parts of the test to get the signal that
71+
# was waited on, we have to wait for a couple more frames. For example, the
72+
# signal_watcher doesn't get the signal in time if we don't do this.
73+
_wait_frames = 2
74+
75+
func wait_seconds(x):
76+
_did_last_wait_timeout = false
77+
_wait_time = x
78+
wait_started.emit()
79+
80+
81+
func wait_frames(x):
82+
_did_last_wait_timeout = false
83+
_wait_frames = x
84+
wait_started.emit()
85+
86+
87+
func wait_for_signal(the_signal, max_time):
88+
_did_last_wait_timeout = false
89+
the_signal.connect(_signal_callback)
90+
_signal_to_wait_on = the_signal
91+
_wait_time = max_time
92+
wait_started.emit()
93+
94+
95+
func wait_until(predicate_function: Callable, max_time, time_between_calls:=0.0):
96+
_predicate_time_between = time_between_calls
97+
_predicate_function_waiting_to_be_true = predicate_function
98+
_predicate_time_between_elpased = 0.0
99+
_did_last_wait_timeout = false
100+
_wait_time = max_time
101+
wait_started.emit()
102+
103+
104+
func is_waiting():
105+
return _wait_time != 0.0 || _wait_frames != 0

0 commit comments

Comments
 (0)