gdharness 1.2.38 → 1.2.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1339 -1102
- package/build/godot/addons/gdharness_runtime/runtime_autoload.gd +7 -4
- package/build/godot/addons/gdharness_runtime/runtime_capture.gd +10 -0
- package/build/godot/addons/gdharness_runtime/runtime_changes.gd +8 -4
- package/build/godot/addons/gdharness_runtime/runtime_input.gd +15 -2
- package/build/godot/addons/gdharness_runtime/runtime_items.gd +175 -0
- package/build/godot/addons/gdharness_runtime/runtime_items.gd.uid +1 -0
- package/build/godot/addons/gdharness_runtime/runtime_paths.gd +43 -10
- package/build/godot/addons/gdharness_runtime/runtime_targets.gd +50 -14
- package/build/godot/addons/gdharness_runtime/runtime_values.gd +5 -0
- package/build/godot/addons/gdharness_runtime/runtime_waits.gd +2 -2
- package/build/godot/addons/gdharness_runtime/runtime_words.gd +48 -18
- package/build/index.js +4893 -4653
- package/build/keeper.js +1 -0
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ static func said_by(node: Node) -> String:
|
|
|
23
23
|
var label: Label = node as Label
|
|
24
24
|
if label != null:
|
|
25
25
|
return _label_says(label)
|
|
26
|
-
if
|
|
26
|
+
if draws_a_list(node):
|
|
27
27
|
return "\n".join(lines_said_by(node))
|
|
28
28
|
var own: String = _text_of(node)
|
|
29
29
|
# A control showing a picture rather than words is named for a player who cannot see it, and that
|
|
@@ -41,37 +41,54 @@ static func said_by(node: Node) -> String:
|
|
|
41
41
|
## every label on it and none of those, and a wait for a tab's title or a list item was never met.
|
|
42
42
|
static func lines_said_by(node: Node) -> Array[String]:
|
|
43
43
|
var lines: Array[String] = []
|
|
44
|
+
if not draws_a_list(node):
|
|
45
|
+
_keep(_text_of(node), lines)
|
|
46
|
+
return lines
|
|
47
|
+
var tree: Tree = node as Tree
|
|
48
|
+
if tree != null and tree.column_titles_visible:
|
|
49
|
+
var titles: Array[String] = []
|
|
50
|
+
for column: int in tree.columns:
|
|
51
|
+
_keep(node.atr(tree.get_column_title(column)), titles)
|
|
52
|
+
_keep(" ".join(titles), lines)
|
|
53
|
+
for entry: Dictionary in items_of(node):
|
|
54
|
+
lines.append(str(entry["says"]))
|
|
55
|
+
return lines
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Each item [param node] draws as one of a list, as {"says", "item"}: a tab, a menu title, a list
|
|
59
|
+
## entry or a menu item by its index, and a tree row by its TreeItem. Empty for a node drawing none.
|
|
60
|
+
## Held apart rather than joined, so a click on a tab's title presses that tab: the bar's middle is
|
|
61
|
+
## whichever tab happens to sit there.
|
|
62
|
+
static func items_of(node: Node) -> Array[Dictionary]:
|
|
63
|
+
var items: Array[Dictionary] = []
|
|
44
64
|
if node is TabBar:
|
|
45
65
|
var bar: TabBar = node
|
|
46
66
|
for tab: int in bar.tab_count:
|
|
47
67
|
if not bar.is_tab_hidden(tab):
|
|
48
|
-
|
|
68
|
+
_keep_item(node.atr(bar.get_tab_title(tab)), tab, items)
|
|
49
69
|
elif node is MenuBar:
|
|
50
70
|
var menus: MenuBar = node
|
|
51
71
|
for menu: int in menus.get_menu_count():
|
|
52
72
|
if not menus.is_menu_hidden(menu):
|
|
53
|
-
|
|
73
|
+
_keep_item(node.atr(menus.get_menu_title(menu)), menu, items)
|
|
54
74
|
elif node is ItemList:
|
|
55
75
|
var list: ItemList = node
|
|
56
76
|
for item: int in list.item_count:
|
|
57
|
-
|
|
77
|
+
_keep_item(
|
|
78
|
+
_as_drawn(node, list.get_item_text(item), list.get_item_auto_translate_mode(item)),
|
|
79
|
+
item,
|
|
80
|
+
items
|
|
81
|
+
)
|
|
58
82
|
elif node is PopupMenu:
|
|
59
83
|
# A separator too, by its title: the popup draws a titled one as a heading over the items
|
|
60
84
|
# below it, and one without a title says nothing and is dropped as an empty line.
|
|
61
85
|
var menu: PopupMenu = node
|
|
62
86
|
for item: int in menu.item_count:
|
|
63
|
-
|
|
87
|
+
_keep_item(item_says(menu, item), item, items)
|
|
64
88
|
elif node is Tree:
|
|
65
89
|
var tree: Tree = node
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for column: int in tree.columns:
|
|
69
|
-
_keep(node.atr(tree.get_column_title(column)), titles)
|
|
70
|
-
_keep(" ".join(titles), lines)
|
|
71
|
-
_tree_rows(tree, tree.get_root(), tree.hide_root, lines)
|
|
72
|
-
else:
|
|
73
|
-
_keep(_text_of(node), lines)
|
|
74
|
-
return lines
|
|
90
|
+
_tree_rows(tree, tree.get_root(), tree.hide_root, items)
|
|
91
|
+
return items
|
|
75
92
|
|
|
76
93
|
|
|
77
94
|
## What item [param index] of [param menu] shows: the translation where the item has one. A menu is
|
|
@@ -86,7 +103,9 @@ static func masked(field: LineEdit) -> String:
|
|
|
86
103
|
return field.secret_character.repeat(field.text.length())
|
|
87
104
|
|
|
88
105
|
|
|
89
|
-
|
|
106
|
+
## Whether [param node] draws a list of items rather than holding words in a `text`; see
|
|
107
|
+
## [method items_of].
|
|
108
|
+
static func draws_a_list(node: Node) -> bool:
|
|
90
109
|
return node is TabBar or node is MenuBar or node is ItemList or node is PopupMenu or node is Tree
|
|
91
110
|
|
|
92
111
|
|
|
@@ -96,6 +115,12 @@ static func _keep(line: String, into: Array[String]) -> void:
|
|
|
96
115
|
into.append(trimmed)
|
|
97
116
|
|
|
98
117
|
|
|
118
|
+
static func _keep_item(line: String, item: Variant, into: Array[Dictionary]) -> void:
|
|
119
|
+
var trimmed: String = line.strip_edges()
|
|
120
|
+
if not trimmed.is_empty():
|
|
121
|
+
into.append({"says": trimmed, "item": item})
|
|
122
|
+
|
|
123
|
+
|
|
99
124
|
## [param words] as [param node] draws them, which for a game with translations is the translation
|
|
100
125
|
## rather than the key it holds: a control set to `UI_HIRE` shows "Hire", and a wait for "Hire" was
|
|
101
126
|
## never met. [param mode] is an item's own setting, which the engine reads before the node's.
|
|
@@ -113,14 +138,14 @@ static func _as_drawn(
|
|
|
113
138
|
## The rows of a tree from [param item] down, a row being its columns' text side by side, and
|
|
114
139
|
## nothing under a collapsed row or a hidden one, since neither is drawn. A hidden root is only the
|
|
115
140
|
## place its children hang from.
|
|
116
|
-
static func _tree_rows(tree: Tree, item: TreeItem, skip: bool, into: Array[
|
|
141
|
+
static func _tree_rows(tree: Tree, item: TreeItem, skip: bool, into: Array[Dictionary]) -> void:
|
|
117
142
|
if item == null or not item.visible:
|
|
118
143
|
return
|
|
119
144
|
if not skip:
|
|
120
145
|
var cells: Array[String] = []
|
|
121
146
|
for column: int in tree.columns:
|
|
122
|
-
_keep(
|
|
123
|
-
|
|
147
|
+
_keep(cell_says(tree, item, column), cells)
|
|
148
|
+
_keep_item(" ".join(cells), item, into)
|
|
124
149
|
if item.collapsed:
|
|
125
150
|
return
|
|
126
151
|
var child: TreeItem = item.get_first_child()
|
|
@@ -129,6 +154,11 @@ static func _tree_rows(tree: Tree, item: TreeItem, skip: bool, into: Array[Strin
|
|
|
129
154
|
child = child.get_next()
|
|
130
155
|
|
|
131
156
|
|
|
157
|
+
## What [param column] of the row [param item] of [param tree] shows.
|
|
158
|
+
static func cell_says(tree: Tree, item: TreeItem, column: int) -> String:
|
|
159
|
+
return _as_drawn(tree, item.get_text(column), item.get_auto_translate_mode(column))
|
|
160
|
+
|
|
161
|
+
|
|
132
162
|
## What a node with a `text` says, as it is drawn.
|
|
133
163
|
static func _text_of(node: Node) -> String:
|
|
134
164
|
var label: Label = node as Label
|