38 lines
1.5 KiB
GDScript
38 lines
1.5 KiB
GDScript
extends SceneTree
|
|
|
|
## M90 shared flat-style gate: the two views must own zero StyleBoxFlat and
|
|
## call the shared ABGUIFactory.flat_style primitive instead.
|
|
|
|
const VIEWS := [
|
|
["guild", "res://entry/views/guild_page_view.gd"],
|
|
["readiness", "res://entry/views/readiness_page_view.gd"],
|
|
]
|
|
|
|
func _initialize() -> void:
|
|
var failures: Array[String] = []
|
|
var fixture_bg := Color("#123456")
|
|
var fixture_border := Color("#654321")
|
|
var style := ABGUIFactory.flat_style(fixture_bg, fixture_border, 3, 9)
|
|
if style.bg_color != fixture_bg or style.border_color != fixture_border:
|
|
failures.append("shared factory colors mismatch")
|
|
if style.border_width_top != 3 or style.border_width_bottom != 3:
|
|
failures.append("shared factory border width mismatch")
|
|
if style.corner_radius_top_left != 9 or style.corner_radius_bottom_right != 9:
|
|
failures.append("shared factory corner radius mismatch")
|
|
var counts := []
|
|
for pair in VIEWS:
|
|
var text := FileAccess.get_file_as_string(pair[1])
|
|
var count := text.count("StyleBoxFlat")
|
|
counts.append("%s=%d" % [pair[0], count])
|
|
if count != 0:
|
|
failures.append("%s private StyleBoxFlat=%d" % [pair[0], count])
|
|
if not text.contains("ABGUIFactory.flat_style("):
|
|
failures.append("%s does not call ABGUIFactory.flat_style" % pair[0])
|
|
if failures.is_empty():
|
|
print("ABG_M90_SHARED_STYLE_OK views_runtime=tests=2 private_stylebox=0 counts=%s shared=ABGUIFactory.flat_style" % ",".join(counts))
|
|
quit(0)
|
|
else:
|
|
for failure in failures:
|
|
printerr("ABG_M90_SHARED_STYLE_FAIL " + failure)
|
|
quit(1)
|