@mflrevan/ucp 0.6.1 → 0.6.3
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/README.md +1 -1
- package/bridge/com.ucp.bridge/CHANGELOG.md +110 -0
- package/bridge/com.ucp.bridge/Editor/Bridge/BridgeServer.cs +61 -6
- package/bridge/com.ucp.bridge/Editor/Bridge/EditorStateSummary.cs +165 -0
- package/bridge/com.ucp.bridge/Editor/Bridge/EditorStateSummary.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Compatibility/UnityObjectCompat.cs +22 -5
- package/bridge/com.ucp.bridge/Editor/Controllers/EditorController.cs +1 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/HierarchyController.cs +10 -10
- package/bridge/com.ucp.bridge/Editor/Controllers/LogsController.cs +71 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/MaterialController.cs +2 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/ObjectLocator.cs +4 -4
- package/bridge/com.ucp.bridge/Editor/Controllers/ObjectReferenceResolver.cs +3 -3
- package/bridge/com.ucp.bridge/Editor/Controllers/PrefabController.cs +6 -6
- package/bridge/com.ucp.bridge/Editor/Controllers/PropertyController.cs +30 -14
- package/bridge/com.ucp.bridge/Editor/Controllers/RecordingController.cs +732 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/RecordingController.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/SceneChangeTracker.cs +3 -3
- package/bridge/com.ucp.bridge/Editor/Controllers/SceneController.cs +3 -3
- package/bridge/com.ucp.bridge/Editor/Controllers/SnapshotController.cs +5 -5
- package/bridge/com.ucp.bridge/Editor/Controllers/TestRunnerController.cs +11 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/TransformController.cs +1 -1
- package/bridge/com.ucp.bridge/Editor/Controllers/UiController.cs +70 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/UiController.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Controllers/ViewController.cs +1 -1
- package/bridge/com.ucp.bridge/Editor/Protocol/MiniJson.cs +1 -1
- package/bridge/com.ucp.bridge/Editor/Ui/UiHost.cs +468 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiHost.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiLintService.cs +554 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiLintService.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiOperationManager.cs +870 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiOperationManager.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioApplier.cs +496 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioApplier.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioLoader.cs +854 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioLoader.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioModels.cs +374 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiScenarioModels.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiVisualTreeInspector.cs +690 -0
- package/bridge/com.ucp.bridge/Editor/Ui/UiVisualTreeInspector.cs.meta +11 -0
- package/bridge/com.ucp.bridge/{Runtime.meta → Editor/Ui.meta} +1 -1
- package/bridge/com.ucp.bridge/Tests/Editor/ControllerSmokeTests.cs +191 -3
- package/bridge/com.ucp.bridge/Tests/Editor/SpatialVisualControllerTests.cs +2 -2
- package/bridge/com.ucp.bridge/Tests/Editor/UiControllerTests.cs +547 -0
- package/bridge/com.ucp.bridge/Tests/Editor/UiControllerTests.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Tests/Editor/UiLintServiceTests.cs +253 -0
- package/bridge/com.ucp.bridge/Tests/Editor/UiLintServiceTests.cs.meta +11 -0
- package/bridge/com.ucp.bridge/Tests/Editor/UiScenarioTests.cs +587 -0
- package/bridge/com.ucp.bridge/Tests/Editor/UiScenarioTests.cs.meta +11 -0
- package/bridge/com.ucp.bridge/package.json +1 -1
- package/package.json +1 -1
- package/bridge/com.ucp.bridge/Runtime/UCP.Bridge.Runtime.asmdef +0 -14
- package/bridge/com.ucp.bridge/Runtime/UCP.Bridge.Runtime.asmdef.meta +0 -7
|
@@ -12,7 +12,7 @@ namespace UCP.Bridge
|
|
|
12
12
|
{
|
|
13
13
|
private sealed class TrackedSceneChange
|
|
14
14
|
{
|
|
15
|
-
public
|
|
15
|
+
public long? InstanceId;
|
|
16
16
|
public string Name;
|
|
17
17
|
public HashSet<string> Components = new();
|
|
18
18
|
}
|
|
@@ -36,7 +36,7 @@ namespace UCP.Bridge
|
|
|
36
36
|
RecordSceneChange(gameObject.scene, gameObject.GetId(), gameObject.name, componentName);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
public static void RecordDeletedObject(Scene scene,
|
|
39
|
+
public static void RecordDeletedObject(Scene scene, long instanceId, string name, string componentName)
|
|
40
40
|
{
|
|
41
41
|
RecordSceneChange(scene, instanceId, name, componentName);
|
|
42
42
|
}
|
|
@@ -135,7 +135,7 @@ namespace UCP.Bridge
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
private static void RecordSceneChange(Scene scene,
|
|
138
|
+
private static void RecordSceneChange(Scene scene, long? instanceId, string name, string componentName)
|
|
139
139
|
{
|
|
140
140
|
if (!scene.IsValid() || !scene.isLoaded)
|
|
141
141
|
return;
|
|
@@ -138,7 +138,7 @@ namespace UCP.Bridge
|
|
|
138
138
|
if (parameters == null || !parameters.TryGetValue("instanceId", out var idObj))
|
|
139
139
|
throw new System.ArgumentException("Missing 'instanceId' parameter");
|
|
140
140
|
|
|
141
|
-
var instanceId = System.Convert.
|
|
141
|
+
var instanceId = System.Convert.ToInt64(idObj);
|
|
142
142
|
var target = FindGameObject(instanceId);
|
|
143
143
|
var bounds = CalculateFocusBounds(target);
|
|
144
144
|
var sceneView = SceneView.lastActiveSceneView ?? EditorWindow.GetWindow<SceneView>();
|
|
@@ -267,7 +267,7 @@ namespace UCP.Bridge
|
|
|
267
267
|
return bounds;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
private static GameObject FindGameObject(
|
|
270
|
+
private static GameObject FindGameObject(long instanceId)
|
|
271
271
|
{
|
|
272
272
|
var direct = UnityObjectCompat.ResolveByInstanceId<GameObject>(instanceId);
|
|
273
273
|
if (direct != null)
|
|
@@ -290,7 +290,7 @@ namespace UCP.Bridge
|
|
|
290
290
|
throw new System.ArgumentException($"GameObject not found: {instanceId}");
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
private static GameObject FindInHierarchy(GameObject gameObject,
|
|
293
|
+
private static GameObject FindInHierarchy(GameObject gameObject, long instanceId)
|
|
294
294
|
{
|
|
295
295
|
if (gameObject.GetId() == instanceId)
|
|
296
296
|
return gameObject;
|
|
@@ -156,7 +156,7 @@ namespace UCP.Bridge
|
|
|
156
156
|
if (p == null || !p.TryGetValue("instanceId", out var idObj))
|
|
157
157
|
throw new ArgumentException("Missing 'instanceId' parameter");
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
long instanceId = Convert.ToInt64(idObj);
|
|
160
160
|
int maxDepth = 1;
|
|
161
161
|
if (p.TryGetValue("depth", out var depthObj))
|
|
162
162
|
maxDepth = Math.Max(1, Convert.ToInt32(depthObj));
|
|
@@ -349,7 +349,7 @@ namespace UCP.Bridge
|
|
|
349
349
|
if (p == null || !p.TryGetValue("instanceId", out var idObj))
|
|
350
350
|
throw new System.ArgumentException("Missing 'instanceId' parameter");
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
long instanceId = System.Convert.ToInt64(idObj);
|
|
353
353
|
var go = FindByInstanceId(instanceId);
|
|
354
354
|
if (go == null)
|
|
355
355
|
throw new System.Exception($"GameObject not found: {instanceId}");
|
|
@@ -383,7 +383,7 @@ namespace UCP.Bridge
|
|
|
383
383
|
if (p == null || !p.TryGetValue("instanceId", out var idObj))
|
|
384
384
|
throw new System.ArgumentException("Missing 'instanceId' parameter");
|
|
385
385
|
|
|
386
|
-
|
|
386
|
+
long instanceId = System.Convert.ToInt64(idObj);
|
|
387
387
|
var go = FindByInstanceId(instanceId);
|
|
388
388
|
if (go == null)
|
|
389
389
|
throw new System.Exception($"GameObject not found: {instanceId}");
|
|
@@ -401,7 +401,7 @@ namespace UCP.Bridge
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
-
private static GameObject FindByInstanceId(
|
|
404
|
+
private static GameObject FindByInstanceId(long id)
|
|
405
405
|
{
|
|
406
406
|
var direct = UnityObjectCompat.ResolveByInstanceId<GameObject>(id);
|
|
407
407
|
if (direct != null)
|
|
@@ -424,7 +424,7 @@ namespace UCP.Bridge
|
|
|
424
424
|
return null;
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
private static GameObject FindInHierarchy(GameObject go,
|
|
427
|
+
private static GameObject FindInHierarchy(GameObject go, long instanceId)
|
|
428
428
|
{
|
|
429
429
|
if (go.GetId() == instanceId)
|
|
430
430
|
return go;
|
|
@@ -54,7 +54,10 @@ namespace UCP.Bridge
|
|
|
54
54
|
|
|
55
55
|
if (!string.IsNullOrEmpty(filter))
|
|
56
56
|
{
|
|
57
|
-
|
|
57
|
+
// groupNames is regex-matched against each test's full name, so a bare class or
|
|
58
|
+
// method name selects what a caller expects. testNames requires an exact
|
|
59
|
+
// fully-qualified match, which silently selected nothing for "ControllerSmokeTests".
|
|
60
|
+
executionSettings.filters[0].groupNames = new[] { filter };
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
var shouldWaitForPlayModeExit =
|
|
@@ -151,7 +154,7 @@ namespace UCP.Bridge
|
|
|
151
154
|
_failed = 0;
|
|
152
155
|
_skipped = 0;
|
|
153
156
|
CollectLeafResults(result);
|
|
154
|
-
var logSummary = LogsController.
|
|
157
|
+
var logSummary = LogsController.BuildTestGuardSummary(_logCursor);
|
|
155
158
|
var consoleWarnings = GetLevelCount(logSummary, "warning");
|
|
156
159
|
var consoleErrors = GetLevelCount(logSummary, "error") + GetLevelCount(logSummary, "exception");
|
|
157
160
|
|
|
@@ -208,6 +211,12 @@ namespace UCP.Bridge
|
|
|
208
211
|
return;
|
|
209
212
|
}
|
|
210
213
|
|
|
214
|
+
// A filter that matches nothing still yields a root suite -- childless, and named
|
|
215
|
+
// after the project. Counting it as a leaf reported "1 passed" for a run that
|
|
216
|
+
// executed no tests, so a typo'd filter looked like a green suite.
|
|
217
|
+
if (result.Test != null && result.Test.IsSuite)
|
|
218
|
+
return;
|
|
219
|
+
|
|
211
220
|
string status;
|
|
212
221
|
switch (result.TestStatus)
|
|
213
222
|
{
|
|
@@ -148,7 +148,7 @@ namespace UCP.Bridge
|
|
|
148
148
|
var list = new List<object>();
|
|
149
149
|
foreach (var idObj in ids)
|
|
150
150
|
{
|
|
151
|
-
var go = ObjectLocator.FindByInstanceId(Convert.
|
|
151
|
+
var go = ObjectLocator.FindByInstanceId(Convert.ToInt64(idObj));
|
|
152
152
|
if (go == null) continue;
|
|
153
153
|
list.Add(DescribeTransform(go));
|
|
154
154
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
|
|
4
|
+
namespace UCP.Bridge
|
|
5
|
+
{
|
|
6
|
+
/// <summary>Registers the UI Toolkit discovery, lint, and asynchronous harness methods.</summary>
|
|
7
|
+
public static class UiController
|
|
8
|
+
{
|
|
9
|
+
public static void Register(CommandRouter router)
|
|
10
|
+
{
|
|
11
|
+
#if UNITY_6000_0_OR_NEWER
|
|
12
|
+
router.Register("ui/list", HandleList);
|
|
13
|
+
router.Register("ui/lint", HandleLint);
|
|
14
|
+
router.Register("ui/inspect", parameters => Start("inspect", parameters));
|
|
15
|
+
router.Register("ui/screenshot", parameters => Start("screenshot", parameters));
|
|
16
|
+
router.Register("ui/check", parameters => Start("check", parameters));
|
|
17
|
+
router.Register("ui/status", HandleStatus);
|
|
18
|
+
#else
|
|
19
|
+
router.Register("ui/list", Unsupported);
|
|
20
|
+
router.Register("ui/lint", Unsupported);
|
|
21
|
+
router.Register("ui/inspect", Unsupported);
|
|
22
|
+
router.Register("ui/screenshot", Unsupported);
|
|
23
|
+
router.Register("ui/check", Unsupported);
|
|
24
|
+
router.Register("ui/status", Unsupported);
|
|
25
|
+
#endif
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#if UNITY_6000_0_OR_NEWER
|
|
29
|
+
private static object HandleList(string paramsJson)
|
|
30
|
+
{
|
|
31
|
+
return UiScenarioLoader.List(ParseParameters(paramsJson));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private static object HandleLint(string paramsJson)
|
|
35
|
+
{
|
|
36
|
+
return UiLintService.Run(ParseParameters(paramsJson));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private static object Start(string operation, string paramsJson)
|
|
40
|
+
{
|
|
41
|
+
return UiOperationManager.Start(operation, ParseParameters(paramsJson));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private static object HandleStatus(string paramsJson)
|
|
45
|
+
{
|
|
46
|
+
var parameters = ParseParameters(paramsJson);
|
|
47
|
+
var operationId = parameters.TryGetValue("operationId", out var value)
|
|
48
|
+
? value?.ToString()
|
|
49
|
+
: null;
|
|
50
|
+
return UiOperationManager.Status(operationId);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private static Dictionary<string, object> ParseParameters(string paramsJson)
|
|
54
|
+
{
|
|
55
|
+
if (string.IsNullOrWhiteSpace(paramsJson))
|
|
56
|
+
return new Dictionary<string, object>(StringComparer.Ordinal);
|
|
57
|
+
var value = MiniJson.Deserialize(paramsJson);
|
|
58
|
+
if (value is not Dictionary<string, object> parameters)
|
|
59
|
+
throw new ArgumentException("UI command parameters must be a JSON object");
|
|
60
|
+
return parameters;
|
|
61
|
+
}
|
|
62
|
+
#else
|
|
63
|
+
private static object Unsupported(string paramsJson)
|
|
64
|
+
{
|
|
65
|
+
throw new ArgumentException(
|
|
66
|
+
"The ucp ui command family requires Unity 6.0 or newer; this project uses an older Unity Editor");
|
|
67
|
+
}
|
|
68
|
+
#endif
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -51,7 +51,7 @@ namespace UCP.Bridge
|
|
|
51
51
|
Camera cam = null;
|
|
52
52
|
if (p != null && (p.TryGetValue("camera", out var camObj)) && camObj != null)
|
|
53
53
|
{
|
|
54
|
-
var go = ObjectLocator.FindByInstanceId(Convert.
|
|
54
|
+
var go = ObjectLocator.FindByInstanceId(Convert.ToInt64(camObj));
|
|
55
55
|
if (go != null) cam = go.GetComponent<Camera>();
|
|
56
56
|
if (cam == null) throw new ArgumentException($"No Camera component on object {camObj}");
|
|
57
57
|
}
|