extends SceneTree var failures: int = 0 var checks: int = 0 func _initialize() -> void: call_deferred("run") func check(value: bool, message: String) -> void: checks += 1 if not value: failures += 1 push_error(message) func run() -> void: var actions = load("res://ui/actions/actions.tscn").instantiate() root.add_child(actions) var values: Array = [0.1, 0.01, 0.001, 1.0, 10.0] var labels: Array = [] for value in values: labels.append(actions._format_action_value(value)) check(labels == ["0.10", "0.010", "0.0010", "1", "10"], "Fractional action amounts retain precision") check(labels[0] != labels[1] and labels[1] != labels[2], "Adjacent fractional amounts are distinguishable") actions.set_actions("test", 123.0) check(actions.action_values[0] == 1.0 and actions.action_values[1] == 10.0, "Distribution preserves distinct requests") check(actions.action_labels[0].text != actions.action_labels[1].text, "Rendered adjacent buttons are distinct") actions.queue_free() print("Action values: %d checks, %d failures" % [checks, failures]) quit(0 if failures == 0 else 1)