mirror of
https://github.com/Relintai/regression-test-project.git
synced 2025-01-10 15:19:59 +01:00
Add support for Platform (#45)
This commit is contained in:
parent
4950c1e68d
commit
aa250456ed
@ -12,23 +12,29 @@ var time_to_show: int = 25 * 1000 # How long test works in miliseconds
|
||||
|
||||
var time_for_each_step : int = -1
|
||||
|
||||
var os
|
||||
|
||||
# Each scene runs alone
|
||||
const alone_steps : Array = [
|
||||
"res://Nodes/Nodes.tscn",
|
||||
"res://ReparentingDeleting/ReparentingDeleting.tscn",
|
||||
"res://Physics/2D/Physics2D.tscn",
|
||||
# "res://ReparentingDeleting/ReparentingDeleting.tscn", # Really slow in 4.0
|
||||
# "res://Physics/2D/Physics2D.tscn", # Too slow still
|
||||
"res://AutomaticBugs/FunctionExecutor.tscn", # Only Needs to be executed once, but this is workaround a little
|
||||
# "res://Physics/3D/Physics3D.tscn", # Loads very long but isn't necessarry so we skip it now
|
||||
]
|
||||
|
||||
func _init():
|
||||
start_time = OS.get_ticks_msec()
|
||||
if ClassDB.class_exists("_OS"):
|
||||
os = ClassDB.instance("_OS")
|
||||
else:
|
||||
os = ClassDB.instance("_Platform")
|
||||
|
||||
start_time = os.get_ticks_msec()
|
||||
|
||||
# In case when user doesn't provide time
|
||||
time_for_each_step = time_to_show / (alone_steps.size())
|
||||
|
||||
for argument in OS.get_cmdline_args():
|
||||
for argument in os.get_cmdline_args():
|
||||
if argument.is_valid_float(): # Ignore all non numeric arguments
|
||||
time_to_show = int(argument.to_float() * 1000)
|
||||
time_for_each_step = time_to_show / (alone_steps.size())
|
||||
@ -37,7 +43,7 @@ func _init():
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var current_run_time : int = OS.get_ticks_msec() - start_time
|
||||
var current_run_time : int = os.get_ticks_msec() - start_time
|
||||
|
||||
# While loop instead if, will allow to properly flush results under heavy operations(e.g. Thread sanitizer)
|
||||
while current_run_time > time_to_print_next_time:
|
||||
@ -47,3 +53,6 @@ func _process(delta: float) -> void:
|
||||
if current_run_time > time_to_show:
|
||||
print("######################## Ending test ########################")
|
||||
get_tree().quit()
|
||||
|
||||
func _exit_tree():
|
||||
os.free()
|
||||
|
@ -1,6 +1,6 @@
|
||||
extends Node
|
||||
|
||||
var TIME_TO_DELETE : float = 1.0
|
||||
var TIME_TO_DELETE : float = 100.0
|
||||
var time_to_delete : float = TIME_TO_DELETE
|
||||
|
||||
var disabled_classes : Array = ["NavigationAgent2D", "NavigationAgent3D","GPUParticlesCollisionHeightField",
|
||||
@ -41,15 +41,15 @@ func _ready() -> void:
|
||||
|
||||
# Move nodes a little and delete and readd them later
|
||||
func _process(delta: float) -> void:
|
||||
for i in get_children():
|
||||
if i is Control:
|
||||
i._set_size(Vector2(200 * randf() - 100, 200 * randf() - 100))
|
||||
if i is Node2D:
|
||||
i.set_position(Vector2(1000 * randf() - 500, 1000 * randf() - 500))
|
||||
if i is Node3D:
|
||||
if i.get_name() != "Camera":
|
||||
i.set_scale(Vector3(delta + 1, delta + 1, delta + 1))
|
||||
i.set_translation(Vector3(10 * randf(), 10 * randf(), 10 * randf()))
|
||||
# for i in get_children():
|
||||
# if i is Control:
|
||||
# i._set_size(Vector2(200 * randf() - 100, 200 * randf() - 100))
|
||||
# if i is Node2D:
|
||||
# i.set_position(Vector2(1000 * randf() - 500, 1000 * randf() - 500))
|
||||
# if i is Node3D:
|
||||
# if i.get_name() != "Camera":
|
||||
# i.set_scale(Vector3(delta + 1, delta + 1, delta + 1))
|
||||
# i.set_translation(Vector3(10 * randf(), 10 * randf(), 10 * randf()))
|
||||
|
||||
time_to_delete -= delta
|
||||
if time_to_delete < 0:
|
||||
|
5
Start.gd
5
Start.gd
@ -8,10 +8,10 @@ var array_with_time_to_change : Array = []
|
||||
|
||||
func _ready():
|
||||
for i in Autoload.alone_steps.size() + 1:
|
||||
array_with_time_to_change.append(OS.get_ticks_msec() + i * Autoload.time_for_each_step)
|
||||
array_with_time_to_change.append(Autoload.os.get_ticks_msec() + i * Autoload.time_for_each_step)
|
||||
|
||||
func _process(_delta):
|
||||
if current_scene < Autoload.alone_steps.size() - 1 && OS.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
|
||||
if current_scene < Autoload.alone_steps.size() - 1 && Autoload.os.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
|
||||
current_scene += 1
|
||||
|
||||
for child in get_children():
|
||||
@ -22,3 +22,4 @@ func _process(_delta):
|
||||
for _i in range(NUMBER_OF_INSTANCES):
|
||||
var scene : Node = load(Autoload.alone_steps[current_scene]).instance()
|
||||
add_child(scene)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user