gdharness 1.3.9 → 1.3.11

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.
Files changed (73) hide show
  1. package/build/cli.js +4740 -3212
  2. package/build/godot/addons/gdharness_editor/animation_reads.gd +115 -4
  3. package/build/godot/addons/gdharness_editor/declared_values.gd +272 -0
  4. package/build/godot/addons/gdharness_editor/file_reads.gd +102 -18
  5. package/build/godot/addons/gdharness_editor/headless_check.gd +49 -2
  6. package/build/godot/addons/gdharness_editor/property_paths.gd +89 -16
  7. package/build/godot/addons/gdharness_editor/property_values.gd +180 -121
  8. package/build/godot/addons/gdharness_editor/reading.gd +51 -1
  9. package/build/godot/addons/gdharness_editor/scene_file.gd +77 -140
  10. package/build/godot/addons/gdharness_editor/scene_uids.gd +107 -0
  11. package/build/godot/addons/gdharness_editor/scene_uids.gd.uid +1 -0
  12. package/build/godot/addons/gdharness_editor/serialisation.gd +11 -22
  13. package/build/godot/addons/gdharness_editor/setting_reads.gd +121 -0
  14. package/build/godot/addons/gdharness_editor/setting_reads.gd.uid +1 -0
  15. package/build/godot/addons/gdharness_editor/tool_executor.gd +28 -5
  16. package/build/godot/addons/gdharness_editor/tools/animation_states.gd +39 -20
  17. package/build/godot/addons/gdharness_editor/tools/animation_tools.gd +49 -362
  18. package/build/godot/addons/gdharness_editor/tools/animation_tracks.gd +464 -0
  19. package/build/godot/addons/gdharness_editor/tools/animation_tracks.gd.uid +1 -0
  20. package/build/godot/addons/gdharness_editor/tools/class_tools.gd +37 -0
  21. package/build/godot/addons/gdharness_editor/tools/navigation_bake.gd +221 -0
  22. package/build/godot/addons/gdharness_editor/tools/navigation_bake.gd.uid +1 -0
  23. package/build/godot/addons/gdharness_editor/tools/resource_tools.gd +147 -492
  24. package/build/godot/addons/gdharness_editor/tools/scene_groups.gd +16 -0
  25. package/build/godot/addons/gdharness_editor/tools/scene_kin.gd +4 -3
  26. package/build/godot/addons/gdharness_editor/tools/scene_paths.gd +2 -1
  27. package/build/godot/addons/gdharness_editor/tools/scene_tools.gd +79 -5
  28. package/build/godot/addons/gdharness_editor/tools/settings_tools.gd +7 -30
  29. package/build/godot/addons/gdharness_editor/tools/signal_tools.gd +183 -37
  30. package/build/godot/addons/gdharness_editor/tools/tileset_tools.gd +485 -0
  31. package/build/godot/addons/gdharness_editor/tools/tileset_tools.gd.uid +1 -0
  32. package/build/godot/addons/gdharness_editor/value_shapes.gd +128 -1
  33. package/build/godot/addons/gdharness_runtime/declared_values.gd +272 -0
  34. package/build/godot/addons/gdharness_runtime/reading.gd +51 -1
  35. package/build/godot/addons/gdharness_runtime/runtime_autoload.gd +35 -3
  36. package/build/godot/addons/gdharness_runtime/runtime_changes.gd +185 -30
  37. package/build/godot/addons/gdharness_runtime/runtime_input.gd +86 -79
  38. package/build/godot/addons/gdharness_runtime/runtime_mouse.gd +17 -0
  39. package/build/godot/addons/gdharness_runtime/runtime_pad.gd +13 -4
  40. package/build/godot/addons/gdharness_runtime/runtime_paths.gd +309 -22
  41. package/build/godot/addons/gdharness_runtime/runtime_queries.gd +163 -20
  42. package/build/godot/addons/gdharness_runtime/runtime_screen.gd +49 -3
  43. package/build/godot/addons/gdharness_runtime/runtime_targets.gd +5 -2
  44. package/build/godot/addons/gdharness_runtime/runtime_values.gd +146 -5
  45. package/build/godot/addons/gdharness_runtime/runtime_waits.gd +279 -11
  46. package/build/godot/addons/gdharness_runtime/runtime_words.gd +27 -0
  47. package/build/godot/addons/gdharness_runtime/serialisation.gd +11 -22
  48. package/build/godot/addons/gdharness_runtime/value_shapes.gd +128 -1
  49. package/build/godot/operations/animation_reads.gd +115 -4
  50. package/build/godot/operations/audio_buses.gd +93 -7
  51. package/build/godot/operations/classdb_queries.gd +119 -7
  52. package/build/godot/operations/declared_values.gd +272 -0
  53. package/build/godot/operations/dependencies.gd +154 -41
  54. package/build/godot/operations/editor_tools.gd +22 -14
  55. package/build/godot/operations/export_presets.gd +602 -4
  56. package/build/godot/operations/file_reads.gd +102 -18
  57. package/build/godot/operations/gdscript_authoring.gd +11 -1
  58. package/build/godot/operations/godot_operations.gd +16 -2
  59. package/build/godot/operations/import_pipeline.gd +20 -221
  60. package/build/godot/operations/input_actions.gd +108 -47
  61. package/build/godot/operations/project_config.gd +83 -69
  62. package/build/godot/operations/project_diagnostics.gd +4 -0
  63. package/build/godot/operations/project_validation.gd +266 -0
  64. package/build/godot/operations/property_paths.gd +89 -16
  65. package/build/godot/operations/property_values.gd +180 -121
  66. package/build/godot/operations/reading.gd +51 -1
  67. package/build/godot/operations/scene_connections.gd +222 -0
  68. package/build/godot/operations/serialisation.gd +11 -22
  69. package/build/godot/operations/setting_reads.gd +121 -0
  70. package/build/godot/operations/value_shapes.gd +128 -1
  71. package/build/godot/tests/listed.gd +73 -13
  72. package/build/keeper.js +1371 -706
  73. package/package.json +1 -1
@@ -10,11 +10,21 @@ extends SceneTree
10
10
  ## its own and reaches gdUnit4 through the project's global classes. Besides the file of suites it
11
11
  ## finds each case by its id in a dictionary ([GdhIndexedSession]), can compile the suites together
12
12
  ## before gdUnit4 loads them ([constant TOGETHER]), can turn off the reports the caller does
13
- ## not read ([constant REPORTS_OFF]), and writes the errors each suite declares it expects
14
- ## ([constant EXPECTED_OUT]).
13
+ ## not read ([constant REPORTS_OFF]), and writes the errors and warnings each suite declares it
14
+ ## prints ([constant EXPECTED_OUT]).
15
15
 
16
16
  const LISTED: String = "--suites-in"
17
17
  const SKIPPING: String = "--skipping-in"
18
+ ## The file of the parameterised cases dealt by their rows, one a line and tab-separated:
19
+ ## `res://suite.gd:test_case`, then `only` and the rows this engine runs, or `besides` and the rows
20
+ ## it leaves to the others, for the engine that takes every row dealt nowhere else. Apart from
21
+ ## [constant SKIPPING], since gdUnit4 reads `suite:case:row` there as the case and leaves out every
22
+ ## row of it.
23
+ const ROWS: String = "--rows-in"
24
+ ## Printed before each row an engine leaves out, as `res://suite.gd > test_case:row`, -1 for a case
25
+ ## that is not parameterised. gdUnit4 prints nothing for a case it skips, and the caller needs every
26
+ ## row an engine found to tell one that no engine ran.
27
+ const LEFT_OUT: String = "gdharness left out"
18
28
  ## The flags turning off a report, with the gdUnit4 hook that writes it. A gate reads what a run
19
29
  ## prints, and each report finds every case it hears of in the session to write them all out as the
20
30
  ## run ends; project_test reads the JUnit one and turns off only the HTML one.
@@ -27,11 +37,15 @@ const REPORTS_OFF: Dictionary[String, String] = {
27
37
  ## does not compile named. project_test does not: its answer is about the scripts its run reached,
28
38
  ## and the compile names every broken script of the game, then once more as the one script it made.
29
39
  const TOGETHER: String = "--compile-together"
30
- ## The file to write the errors every suite declares it expects into, as JSON keyed by suite path and
31
- ## then case name.
32
- const EXPECTED_OUT: String = "--expected-errors-out"
33
- ## The constant a suite declares its expected errors in: case name to the exact texts it prints.
34
- const EXPECTED: String = "GDHARNESS_EXPECTED_ERRORS"
40
+ ## The file to write what every suite declares it prints into, as JSON: each key of
41
+ ## [constant EXPECTED] holding the declarations keyed by suite path and then case name.
42
+ const EXPECTED_OUT: String = "--expected-out"
43
+ ## The constants a suite declares what it prints on purpose in, case name to the exact texts: its
44
+ ## engine errors, and its engine warnings.
45
+ const EXPECTED: Dictionary[String, String] = {
46
+ "errors": "GDHARNESS_EXPECTED_ERRORS",
47
+ "warnings": "GDHARNESS_EXPECTED_WARNINGS",
48
+ }
35
49
  ## The tool name gdUnit4 reads its options after.
36
50
  const TOOL: String = "GdUnitCmdTool.gd"
37
51
  ## How long a windowless engine sleeps after each frame. The engine's own default is the
@@ -50,10 +64,23 @@ class GdhRunner:
50
64
  extends GdUnitTestCIRunner
51
65
 
52
66
  var own_path: String = ""
67
+ ## The cases dealt by their rows, by `res://suite.gd:test_case`.
68
+ var row_shares: Dictionary[String, GdhRowShare] = {}
53
69
 
54
70
  func get_cmdline_args() -> PackedStringArray:
55
71
  return options_of(OS.get_cmdline_args(), own_path)
56
72
 
73
+ ## gdUnit4 asks this of every case it finds, a parameterised case once a row, each row carrying
74
+ ## its index.
75
+ func is_skipped(test: GdUnitTestCase) -> bool:
76
+ if super(test):
77
+ return true
78
+ var share: GdhRowShare = row_shares.get("%s:%s" % [test.suite_resource_path, test.test_name], null)
79
+ if share == null or not share.leaves_out(test.attribute_index):
80
+ return false
81
+ print("%s %s > %s:%d" % [LEFT_OUT, test.suite_resource_path, test.test_name, test.attribute_index])
82
+ return true
83
+
57
84
  ## The session gdUnit4 has just made, swapped for a [GdhIndexedSession] of the same cases as it
58
85
  ## is announced: everything that reads the session, the hooks, the cases and the console printing
59
86
  ## every case, is handed it after this.
@@ -83,6 +110,19 @@ class GdhRunner:
83
110
  return forward.to_lower() if OS.get_name() == "Windows" else forward
84
111
 
85
112
 
113
+ ## The rows of one parameterised case an engine runs: those named, or every row but those.
114
+ class GdhRowShare:
115
+ extends RefCounted
116
+
117
+ var only: bool = true
118
+ var rows: PackedInt32Array = []
119
+
120
+ ## Whether the engine leaves out [param row], which is -1 for a case that is not parameterised
121
+ ## and so runs only in the engine taking the rows besides.
122
+ func leaves_out(row: int) -> bool:
123
+ return rows.has(row) != only
124
+
125
+
86
126
  ## gdUnit4's session finding a case by its id in a dictionary, where its own walks every case of the
87
127
  ## session, `GdUnitTestSession.find_test_by_id`: the console asks it twice a case and each report
88
128
  ## twice more, so a run's time in it grew with the square of its cases (17.9 s of processor time
@@ -128,6 +168,7 @@ func _initialize() -> void:
128
168
  _runner.own_path = get_script().resource_path
129
169
  _runner.add_test_suites(suites)
130
170
  _runner.skip_test_suites(listed(asked, SKIPPING))
171
+ _runner.row_shares = row_shares_of(listed(asked, ROWS))
131
172
  root.add_child(_runner)
132
173
 
133
174
 
@@ -209,6 +250,22 @@ static func listed(args: PackedStringArray, flag: String) -> PackedStringArray:
209
250
  return named
210
251
 
211
252
 
253
+ ## The row shares [param lines] of a [constant ROWS] file give, by case.
254
+ static func row_shares_of(lines: PackedStringArray) -> Dictionary[String, GdhRowShare]:
255
+ var shares: Dictionary[String, GdhRowShare] = {}
256
+ for line: String in lines:
257
+ var parts: PackedStringArray = line.split("\t")
258
+ if parts.size() < 2:
259
+ continue
260
+ var share: GdhRowShare = GdhRowShare.new()
261
+ share.only = parts[1] == "only"
262
+ for row: String in parts.slice(2):
263
+ if row.is_valid_int():
264
+ var _added: bool = share.rows.append(row.to_int())
265
+ shares[parts[0]] = share
266
+ return shares
267
+
268
+
212
269
  ## The argument after [param flag] in [param args], or "" when there is none.
213
270
  static func argument_after(args: PackedStringArray, flag: String) -> String:
214
271
  var at: int = args.find(flag)
@@ -217,18 +274,18 @@ static func argument_after(args: PackedStringArray, flag: String) -> String:
217
274
  return args[at + 1]
218
275
 
219
276
 
220
- ## The errors each of [param suites] declares it expects, by suite path and then case name, read off
221
- ## the compiled suite's constants so a declaration is whatever the engine made of it. A directory
277
+ ## What each of [param suites] declares in [param constant], by suite path and then case name, read
278
+ ## off the compiled suite's constants so a declaration is whatever the engine made of it. A directory
222
279
  ## listed is walked for its scripts, as gdUnit4 walks it for suites. Only a script whose source names
223
280
  ## the constant is loaded: gdUnit4 stops on a suite that does not load only when its own load is the
224
281
  ## one that fails, so a broken suite loaded here first let the rest of its directory run.
225
- static func expected_by_suite(suites: PackedStringArray) -> Dictionary:
282
+ static func expected_by_suite(suites: PackedStringArray, constant: String) -> Dictionary:
226
283
  var expected: Dictionary = {}
227
284
  for path: String in scripts_in(suites):
228
- if not FileAccess.file_exists(path) or not FileAccess.get_file_as_string(path).contains(EXPECTED):
285
+ if not FileAccess.file_exists(path) or not FileAccess.get_file_as_string(path).contains(constant):
229
286
  continue
230
287
  var suite: Script = load(path)
231
- var declared: Variant = suite.get_script_constant_map().get(EXPECTED)
288
+ var declared: Variant = suite.get_script_constant_map().get(constant)
232
289
  if declared is Dictionary:
233
290
  expected[path] = declared
234
291
  return expected
@@ -259,5 +316,8 @@ static func write_expected(path: String, suites: PackedStringArray) -> void:
259
316
  if file == null:
260
317
  push_error("Could not write the expected errors to %s: %s" % [path, FileAccess.get_open_error()])
261
318
  return
262
- var _stored: bool = file.store_string(JSON.stringify(expected_by_suite(suites)))
319
+ var expected: Dictionary = {}
320
+ for kind: String in EXPECTED:
321
+ expected[kind] = expected_by_suite(suites, EXPECTED[kind])
322
+ var _stored: bool = file.store_string(JSON.stringify(expected))
263
323
  file.close()