-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest_Task.gd
More file actions
84 lines (78 loc) · 1.86 KB
/
Test_Task.gd
File metadata and controls
84 lines (78 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
extends MarginContainer
func _ready() -> void:
var test_set: Array[GDScript] = [
Cancel_Canceled,
Cancel_WithOperators,
Cancel_FromSignalName,
Cancel_FromSignal,
Cancel_FromFilteredSignalName,
Cancel_FromFilteredSignal,
Cancel_From,
Cancel_Timeout,
Cancel_Deferred,
Cancel_Merged,
Task_Completed,
Task_Canceled,
Task_Never,
Task_WithOperators,
Task_FromMethodName,
Task_FromMethod,
Task_FromBoundMethodName,
Task_FromBoundMethod,
Task_FromSignalName,
Task_FromSignal,
Task_FromFilteredSignalName,
Task_FromFilteredSignal,
Task_From,
Task_ThenMethodName,
Task_ThenMethod,
Task_ThenBoundMethodName,
Task_ThenBoundMethod,
Task_Then,
Task_All,
Task_AllSettled,
Task_Any,
Task_Race,
Task_Count,
Task_Index,
Task_Delay,
Task_Defer,
Task_DeferIdleFrame,
Task_DeferIdle,
Task_DeferPhysicsFrame,
Task_DeferPhysics,
Task_Unwrap,
Task_Load,
]
if false:
# These tests are experimental and will access the network.
# When testing, please change the above condition.
test_set.append_array([
Task_HTTPGet,
Task_HTTPHead,
Task_HTTPPost,
Task_HTTPPut,
Task_HTTPDelete,
Task_HTTPOptions,
Task_HTTPPatch,
])
for i: int in test_set.size():
var test_script := test_set[i]
var check: CheckBox = get_node("%" + test_script.get_global_name())
check.visible = true
var test_passed := 0
var test_failed := 0
for i: int in test_set.size():
var test_script := test_set[i]
var test: Test = test_script.new()
%Status.text = "%d/%d Running test..." % [i + 1, test_set.size()]
if await test.wait():
var check: CheckBox = get_node("%" + test_script.get_global_name())
check.button_pressed = true
test_passed += 1
else:
test_failed += 1
if test_failed == 0:
%Status.text = "All tests passed."
else:
%Status.text = "%d/%d tests passed." % [test_passed, test_passed + test_failed]