@mflrevan/ucp 0.3.3 → 0.4.1
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 +3 -3
- package/package.json +8 -2
- package/bridge/com.ucp.bridge/CHANGELOG.md +0 -112
- package/bridge/com.ucp.bridge/CHANGELOG.md.meta +0 -7
- package/bridge/com.ucp.bridge/Editor/Bridge/BridgeServer.cs +0 -576
- package/bridge/com.ucp.bridge/Editor/Bridge/BridgeServer.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Bridge.meta +0 -8
- package/bridge/com.ucp.bridge/Editor/Controllers/AssetController.cs +0 -530
- package/bridge/com.ucp.bridge/Editor/Controllers/AssetController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/BuildController.cs +0 -230
- package/bridge/com.ucp.bridge/Editor/Controllers/BuildController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/CompilationController.cs +0 -26
- package/bridge/com.ucp.bridge/Editor/Controllers/CompilationController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/EditorController.cs +0 -18
- package/bridge/com.ucp.bridge/Editor/Controllers/EditorController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/EditorSettingsController.cs +0 -438
- package/bridge/com.ucp.bridge/Editor/Controllers/EditorSettingsController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/FileController.cs +0 -130
- package/bridge/com.ucp.bridge/Editor/Controllers/FileController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/HierarchyController.cs +0 -319
- package/bridge/com.ucp.bridge/Editor/Controllers/HierarchyController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/LogsController.cs +0 -288
- package/bridge/com.ucp.bridge/Editor/Controllers/LogsController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/MaterialController.cs +0 -295
- package/bridge/com.ucp.bridge/Editor/Controllers/MaterialController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/ObjectReferenceResolver.cs +0 -93
- package/bridge/com.ucp.bridge/Editor/Controllers/ObjectReferenceResolver.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/PlayModeController.cs +0 -84
- package/bridge/com.ucp.bridge/Editor/Controllers/PlayModeController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/PrefabController.cs +0 -242
- package/bridge/com.ucp.bridge/Editor/Controllers/PrefabController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/PropertyController.cs +0 -533
- package/bridge/com.ucp.bridge/Editor/Controllers/PropertyController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/SceneController.cs +0 -111
- package/bridge/com.ucp.bridge/Editor/Controllers/SceneController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/ScreenshotController.cs +0 -125
- package/bridge/com.ucp.bridge/Editor/Controllers/ScreenshotController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/ScriptController.cs +0 -104
- package/bridge/com.ucp.bridge/Editor/Controllers/ScriptController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/SnapshotController.cs +0 -227
- package/bridge/com.ucp.bridge/Editor/Controllers/SnapshotController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/TestRunnerController.cs +0 -240
- package/bridge/com.ucp.bridge/Editor/Controllers/TestRunnerController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers/VcsController.cs +0 -611
- package/bridge/com.ucp.bridge/Editor/Controllers/VcsController.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Controllers.meta +0 -8
- package/bridge/com.ucp.bridge/Editor/Protocol/CommandRouter.cs +0 -53
- package/bridge/com.ucp.bridge/Editor/Protocol/CommandRouter.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Protocol/MessageTypes.cs +0 -80
- package/bridge/com.ucp.bridge/Editor/Protocol/MessageTypes.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Protocol/MiniJson.cs +0 -358
- package/bridge/com.ucp.bridge/Editor/Protocol/MiniJson.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Protocol.meta +0 -8
- package/bridge/com.ucp.bridge/Editor/Scripts/IUCPScript.cs +0 -37
- package/bridge/com.ucp.bridge/Editor/Scripts/IUCPScript.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Editor/Scripts.meta +0 -8
- package/bridge/com.ucp.bridge/Editor/UCP.Bridge.Editor.asmdef +0 -16
- package/bridge/com.ucp.bridge/Editor/UCP.Bridge.Editor.asmdef.meta +0 -7
- package/bridge/com.ucp.bridge/Editor.meta +0 -8
- 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
- package/bridge/com.ucp.bridge/Runtime.meta +0 -8
- package/bridge/com.ucp.bridge/Tests/Editor/ControllerSmokeTests.cs +0 -591
- package/bridge/com.ucp.bridge/Tests/Editor/ControllerSmokeTests.cs.meta +0 -2
- package/bridge/com.ucp.bridge/Tests/Editor/UCP.Bridge.Editor.Tests.asmdef +0 -12
- package/bridge/com.ucp.bridge/Tests/Editor/UCP.Bridge.Editor.Tests.asmdef.meta +0 -7
- package/bridge/com.ucp.bridge/Tests/Editor.meta +0 -8
- package/bridge/com.ucp.bridge/Tests.meta +0 -8
- package/bridge/com.ucp.bridge/package.json +0 -27
- package/bridge/com.ucp.bridge/package.json.meta +0 -7
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Collections.Generic;
|
|
3
|
-
using System.Reflection;
|
|
4
|
-
using UnityEditor;
|
|
5
|
-
using UnityEditor.TestTools.TestRunner.Api;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace UCP.Bridge
|
|
9
|
-
{
|
|
10
|
-
public static class TestRunnerController
|
|
11
|
-
{
|
|
12
|
-
private static TestRunnerApi s_api;
|
|
13
|
-
private static TestResultCollector s_collector;
|
|
14
|
-
|
|
15
|
-
public static void Register(CommandRouter router)
|
|
16
|
-
{
|
|
17
|
-
router.Register("tests/run", HandleRunTests);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
private static object HandleRunTests(string paramsJson)
|
|
21
|
-
{
|
|
22
|
-
var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
|
|
23
|
-
var mode = "edit";
|
|
24
|
-
string filter = null;
|
|
25
|
-
|
|
26
|
-
if (p != null)
|
|
27
|
-
{
|
|
28
|
-
if (p.TryGetValue("mode", out var m)) mode = m?.ToString() ?? "edit";
|
|
29
|
-
if (p.TryGetValue("filter", out var f)) filter = f?.ToString();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var testMode = mode.ToLowerInvariant() switch
|
|
33
|
-
{
|
|
34
|
-
"play" => TestMode.PlayMode,
|
|
35
|
-
"playmode" => TestMode.PlayMode,
|
|
36
|
-
_ => TestMode.EditMode
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
if (s_api == null)
|
|
40
|
-
s_api = ScriptableObject.CreateInstance<TestRunnerApi>();
|
|
41
|
-
|
|
42
|
-
if (s_collector != null)
|
|
43
|
-
s_api.UnregisterCallbacks(s_collector);
|
|
44
|
-
|
|
45
|
-
s_collector = new TestResultCollector();
|
|
46
|
-
s_api.RegisterCallbacks(s_collector);
|
|
47
|
-
|
|
48
|
-
var executionSettings = new ExecutionSettings
|
|
49
|
-
{
|
|
50
|
-
filters = new[] { new Filter { testMode = testMode } }
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
if (!string.IsNullOrEmpty(filter))
|
|
54
|
-
{
|
|
55
|
-
executionSettings.filters[0].testNames = new[] { filter };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var shouldWaitForPlayModeExit =
|
|
59
|
-
testMode == TestMode.EditMode &&
|
|
60
|
-
(EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode);
|
|
61
|
-
|
|
62
|
-
if (shouldWaitForPlayModeExit)
|
|
63
|
-
{
|
|
64
|
-
if (EditorApplication.isPlaying)
|
|
65
|
-
EditorApplication.isPlaying = false;
|
|
66
|
-
|
|
67
|
-
ExecuteWhenReady(executionSettings, testMode, EditorApplication.timeSinceStartup + 30.0);
|
|
68
|
-
}
|
|
69
|
-
else
|
|
70
|
-
{
|
|
71
|
-
s_api.Execute(executionSettings);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Tests run asynchronously in Unity. We return immediately with a pending status.
|
|
75
|
-
// Results will be sent as notifications when complete.
|
|
76
|
-
return new Dictionary<string, object>
|
|
77
|
-
{
|
|
78
|
-
["status"] = "started",
|
|
79
|
-
["mode"] = mode,
|
|
80
|
-
["message"] = shouldWaitForPlayModeExit
|
|
81
|
-
? "Edit-mode tests queued. Waiting for Unity to exit play mode before starting."
|
|
82
|
-
: "Tests started. Results will arrive as notifications."
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private static void ExecuteWhenReady(ExecutionSettings settings, TestMode mode, double deadline)
|
|
87
|
-
{
|
|
88
|
-
EditorApplication.delayCall += () =>
|
|
89
|
-
{
|
|
90
|
-
var stillInPlayMode = EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode;
|
|
91
|
-
if (mode == TestMode.EditMode && stillInPlayMode)
|
|
92
|
-
{
|
|
93
|
-
if (EditorApplication.timeSinceStartup > deadline)
|
|
94
|
-
{
|
|
95
|
-
BridgeServer.BroadcastNotification("tests/result", new Dictionary<string, object>
|
|
96
|
-
{
|
|
97
|
-
["summary"] = new Dictionary<string, object>
|
|
98
|
-
{
|
|
99
|
-
["total"] = 1,
|
|
100
|
-
["passed"] = 0,
|
|
101
|
-
["failed"] = 1,
|
|
102
|
-
["skipped"] = 0,
|
|
103
|
-
["duration"] = 0.0
|
|
104
|
-
},
|
|
105
|
-
["tests"] = new List<object>
|
|
106
|
-
{
|
|
107
|
-
new Dictionary<string, object>
|
|
108
|
-
{
|
|
109
|
-
["name"] = "UCP.Bridge.Tests.PlayModeExitGuard",
|
|
110
|
-
["status"] = "failed",
|
|
111
|
-
["duration"] = 0.0,
|
|
112
|
-
["message"] = "Timed out waiting for Unity to exit play mode before running edit-mode tests."
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
if (s_api != null && s_collector != null)
|
|
118
|
-
s_api.UnregisterCallbacks(s_collector);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
ExecuteWhenReady(settings, mode, deadline);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
s_api.Execute(settings);
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private class TestResultCollector : ICallbacks
|
|
131
|
-
{
|
|
132
|
-
private readonly List<object> _results = new();
|
|
133
|
-
private int _passed, _failed, _skipped;
|
|
134
|
-
private double _startTime;
|
|
135
|
-
|
|
136
|
-
public TestResultCollector()
|
|
137
|
-
{
|
|
138
|
-
_startTime = EditorApplication.timeSinceStartup;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public void RunStarted(ITestAdaptor testsToRun) { }
|
|
142
|
-
|
|
143
|
-
public void RunFinished(ITestResultAdaptor result)
|
|
144
|
-
{
|
|
145
|
-
_results.Clear();
|
|
146
|
-
_passed = 0;
|
|
147
|
-
_failed = 0;
|
|
148
|
-
_skipped = 0;
|
|
149
|
-
CollectLeafResults(result);
|
|
150
|
-
|
|
151
|
-
var duration = EditorApplication.timeSinceStartup - _startTime;
|
|
152
|
-
|
|
153
|
-
var summary = new Dictionary<string, object>
|
|
154
|
-
{
|
|
155
|
-
["total"] = _passed + _failed + _skipped,
|
|
156
|
-
["passed"] = _passed,
|
|
157
|
-
["failed"] = _failed,
|
|
158
|
-
["skipped"] = _skipped,
|
|
159
|
-
["duration"] = (double)duration
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
BridgeServer.BroadcastNotification("tests/result", new Dictionary<string, object>
|
|
163
|
-
{
|
|
164
|
-
["summary"] = summary,
|
|
165
|
-
["tests"] = _results
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
if (s_api != null)
|
|
169
|
-
s_api.UnregisterCallbacks(this);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public void TestStarted(ITestAdaptor test) { }
|
|
173
|
-
|
|
174
|
-
public void TestFinished(ITestResultAdaptor result) { }
|
|
175
|
-
|
|
176
|
-
private void CollectLeafResults(ITestResultAdaptor result)
|
|
177
|
-
{
|
|
178
|
-
if (result == null)
|
|
179
|
-
return;
|
|
180
|
-
|
|
181
|
-
if (result.HasChildren)
|
|
182
|
-
{
|
|
183
|
-
foreach (var child in result.Children)
|
|
184
|
-
CollectLeafResults(child);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
string status;
|
|
189
|
-
switch (result.TestStatus)
|
|
190
|
-
{
|
|
191
|
-
case TestStatus.Passed:
|
|
192
|
-
status = "passed";
|
|
193
|
-
_passed++;
|
|
194
|
-
break;
|
|
195
|
-
case TestStatus.Failed:
|
|
196
|
-
status = "failed";
|
|
197
|
-
_failed++;
|
|
198
|
-
break;
|
|
199
|
-
case TestStatus.Skipped:
|
|
200
|
-
status = "skipped";
|
|
201
|
-
_skipped++;
|
|
202
|
-
break;
|
|
203
|
-
default:
|
|
204
|
-
status = "unknown";
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
var entry = new Dictionary<string, object>
|
|
209
|
-
{
|
|
210
|
-
["name"] = ResolveTestName(result),
|
|
211
|
-
["status"] = status,
|
|
212
|
-
["duration"] = result.Duration
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
if (!string.IsNullOrEmpty(result.Message))
|
|
216
|
-
entry["message"] = result.Message;
|
|
217
|
-
if (!string.IsNullOrEmpty(result.StackTrace))
|
|
218
|
-
entry["stackTrace"] = result.StackTrace;
|
|
219
|
-
|
|
220
|
-
_results.Add(entry);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
private static string ResolveTestName(ITestResultAdaptor result)
|
|
224
|
-
{
|
|
225
|
-
if (!string.IsNullOrEmpty(result.FullName))
|
|
226
|
-
return result.FullName;
|
|
227
|
-
|
|
228
|
-
if (result.Test != null)
|
|
229
|
-
{
|
|
230
|
-
if (!string.IsNullOrEmpty(result.Test.FullName))
|
|
231
|
-
return result.Test.FullName;
|
|
232
|
-
if (!string.IsNullOrEmpty(result.Test.Name))
|
|
233
|
-
return result.Test.Name;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return result.Name;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|