mirror of
https://github.com/Relintai/regression-test-project.git
synced 2024-11-12 10:25:30 +01:00
Use the time singleton directly.
This commit is contained in:
parent
74057f28a2
commit
8cddacf93c
@ -24,18 +24,7 @@ const alone_steps: Array = [
|
||||
"res://AutomaticBugs/FunctionExecutor.tscn", # Only need to run once
|
||||
]
|
||||
|
||||
var time_object: Object
|
||||
|
||||
|
||||
func _init():
|
||||
# Workaround for Time/OS breaking change - https://github.com/godotengine/godot/pull/54056
|
||||
if ClassDB.class_exists("_Time"):
|
||||
time_object = ClassDB.instance("_Time")
|
||||
elif ClassDB.class_exists("Time"):
|
||||
time_object = Time#ClassDB.instance("Time")
|
||||
else:
|
||||
time_object = ClassDB.instance("_OS")
|
||||
|
||||
start_time = Time.get_ticks_msec()
|
||||
|
||||
# In case when user doesn't provide time
|
||||
@ -50,7 +39,7 @@ func _init():
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var current_run_time: int = time_object.get_ticks_msec() - start_time
|
||||
var current_run_time: int = Time.get_ticks_msec() - start_time
|
||||
|
||||
# While loop instead simple if, because will allow to properly flush results under heavy operations(e.g. Thread sanitizer)
|
||||
while current_run_time > time_to_print_next_time:
|
||||
@ -62,5 +51,3 @@ func _process(delta: float) -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
time_object.free()
|
||||
|
4
Start.gd
4
Start.gd
@ -11,11 +11,11 @@ func _ready():
|
||||
Autoload.can_be_closed = false
|
||||
|
||||
for i in Autoload.alone_steps.size() + 1:
|
||||
array_with_time_to_change.append(Autoload.time_object.get_ticks_msec() + i * Autoload.time_for_each_step)
|
||||
array_with_time_to_change.append(Time.get_ticks_msec() + i * Autoload.time_for_each_step)
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if current_scene < Autoload.alone_steps.size() - 1 && Autoload.time_object.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
|
||||
if current_scene < Autoload.alone_steps.size() - 1 && Time.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
|
||||
current_scene += 1
|
||||
if current_scene == Autoload.alone_steps.size() - 1:
|
||||
Autoload.can_be_closed = true
|
||||
|
Loading…
Reference in New Issue
Block a user