ue-mcp 1.4.13 → 1.4.14-beta.2
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 +5 -5
- package/dist/bridge/bridge-timeouts.js +4 -0
- package/dist/bridge/bridge-timeouts.js.map +1 -1
- package/dist/cli/cli-commands.js +1 -0
- package/dist/cli/cli-commands.js.map +1 -1
- package/dist/cli/doctor.js +2 -1
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/projects-cli.d.ts +3 -0
- package/dist/cli/projects-cli.js +72 -0
- package/dist/cli/projects-cli.js.map +1 -0
- package/dist/config/user-state.d.ts +10 -0
- package/dist/config/user-state.js +21 -0
- package/dist/config/user-state.js.map +1 -1
- package/dist/core/env.d.ts +2 -0
- package/dist/core/env.js +2 -0
- package/dist/core/env.js.map +1 -1
- package/dist/core/types.d.ts +27 -0
- package/dist/daemon/daemon.js +44 -5
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/extension-api.d.ts +8 -5
- package/dist/daemon-api.d.ts +2 -1
- package/dist/daemon-api.js +1 -0
- package/dist/daemon-api.js.map +1 -1
- package/dist/dispatch/offline.js +1 -0
- package/dist/dispatch/offline.js.map +1 -1
- package/dist/editor/dialog-guard.d.ts +12 -2
- package/dist/editor/dialog-guard.js +68 -2
- package/dist/editor/dialog-guard.js.map +1 -1
- package/dist/editor/editor-control.js +1 -1
- package/dist/editor/editor-control.js.map +1 -1
- package/dist/flow/write-methods.js +1 -1
- package/dist/flow/write-methods.js.map +1 -1
- package/dist/machine/projects.d.ts +85 -0
- package/dist/machine/projects.js +286 -0
- package/dist/machine/projects.js.map +1 -0
- package/dist/pie/script-events.d.ts +4 -1
- package/dist/pie/script-events.js.map +1 -1
- package/dist/surface/context/instructions.js +20 -0
- package/dist/surface/context/instructions.js.map +1 -1
- package/dist/tool-counts.json +12 -12
- package/dist/tools/asset.js +2 -1
- package/dist/tools/asset.js.map +1 -1
- package/dist/tools/editor.js +1 -1
- package/dist/tools/editor.js.map +1 -1
- package/dist/tools/epic/effects.js +11 -0
- package/dist/tools/epic/effects.js.map +1 -1
- package/dist/tools/epic/fab.generated.d.ts +6 -0
- package/dist/tools/epic/fab.generated.js +67 -0
- package/dist/tools/epic/fab.generated.js.map +1 -0
- package/dist/tools/epic/index.d.ts +2 -0
- package/dist/tools/epic/index.js +2 -0
- package/dist/tools/epic/index.js.map +1 -1
- package/dist/tools/epic/toolset-routes.js +2 -0
- package/dist/tools/epic/toolset-routes.js.map +1 -1
- package/dist/tools/epic.js +4 -4
- package/dist/tools/epic.js.map +1 -1
- package/dist/tools/fab-epic.d.ts +23 -0
- package/dist/tools/fab-epic.js +109 -0
- package/dist/tools/fab-epic.js.map +1 -0
- package/dist/tools/fab.js +27 -18
- package/dist/tools/fab.js.map +1 -1
- package/dist/tools/level.js +9 -2
- package/dist/tools/level.js.map +1 -1
- package/dist/tools/material.js +1 -1
- package/dist/tools/material.js.map +1 -1
- package/dist/tools/pie.js +1 -1
- package/dist/tools/pie.js.map +1 -1
- package/dist/tools/specs/asset.generated.js +92 -3
- package/dist/tools/specs/asset.generated.js.map +1 -1
- package/dist/tools/specs/fab.generated.js +143 -3
- package/dist/tools/specs/fab.generated.js.map +1 -1
- package/dist/tools/specs/level.generated.js +183 -9
- package/dist/tools/specs/level.generated.js.map +1 -1
- package/dist/tools/specs/pie.generated.js +28 -8
- package/dist/tools/specs/pie.generated.js.map +1 -1
- package/dist/tools/specs/widget.generated.js +8 -1
- package/dist/tools/specs/widget.generated.js.map +1 -1
- package/dist/ue-mcp.default.yml +522 -76
- package/package.json +2 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.cpp +26 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.cpp +24 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.h +7 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Mesh.cpp +483 -10
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.cpp +345 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_AIAssistant.cpp +34 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.cpp +766 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.h +26 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.cpp +159 -55
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.h +23 -12
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.cpp +306 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.h +55 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.cpp +34 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.h +9 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.cpp +12 -8
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp +3 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Refresh.cpp +479 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_ReplaceActors.cpp +2 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_WorldPartition.cpp +824 -12
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Material/MaterialHandlers.cpp +95 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.cpp +13 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/MCPPIETestScript.h +8 -3
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers.cpp +2 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Record.cpp +6 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Replay.cpp +1 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Script.cpp +2 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.cpp +52 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.h +16 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.cpp +65 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.h +15 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.cpp +146 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.h +53 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.cpp +351 -14
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.h +55 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptValidation.cpp +8 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.cpp +59 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.h +15 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.cpp +567 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.h +173 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/SMCPPIEStudioPanel.cpp +41 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers.cpp +92 -32
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabDownloadTests.cpp +140 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabEndToEndTests.cpp +365 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabLibraryTests.cpp +52 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PCGGraphAuthoringTests.cpp +5 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEReplayInputLockTests.cpp +77 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptTests.cpp +256 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptValidationTests.cpp +18 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEUIPointerTests.cpp +246 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/UE_MCP_Bridge.cpp +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/UE_MCP_Bridge.Build.cs +85 -13
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIEActionTrigger.cpp +48 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIERemoteControl.cpp +93 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIEActionTrigger.h +52 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIERemoteControl.h +54 -0
- package/plugin/ue_mcp_bridge/UE_MCP_Bridge.uplugin +2 -2
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
#if WITH_DEV_AUTOMATION_TESTS
|
|
2
|
+
#include "CoreMinimal.h"
|
|
3
|
+
#include "Runtime/Launch/Resources/Version.h"
|
|
4
|
+
#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 8
|
|
5
|
+
|
|
6
|
+
#include "Handlers/Fab/FabDownloads.h"
|
|
7
|
+
#include "Handlers/Fab/FabHandlers.h"
|
|
8
|
+
#include "Handlers/Fab/FabLibrary.h"
|
|
9
|
+
#include "HandlerRegistry.h"
|
|
10
|
+
#include "AssetRegistry/AssetRegistryModule.h"
|
|
11
|
+
#include "GenericPlatform/GenericPlatformHttp.h"
|
|
12
|
+
#include "HAL/FileManager.h"
|
|
13
|
+
#include "HAL/PlatformProcess.h"
|
|
14
|
+
#include "HAL/PlatformTime.h"
|
|
15
|
+
#include "HttpManager.h"
|
|
16
|
+
#include "HttpModule.h"
|
|
17
|
+
#include "HttpPath.h"
|
|
18
|
+
#include "Misc/ScopeExit.h"
|
|
19
|
+
#include "HttpServerModule.h"
|
|
20
|
+
#include "HttpServerRequest.h"
|
|
21
|
+
#include "HttpServerResponse.h"
|
|
22
|
+
#include "IHttpRouter.h"
|
|
23
|
+
#include "Misc/AutomationTest.h"
|
|
24
|
+
#include "Misc/FileHelper.h"
|
|
25
|
+
#include "Misc/Paths.h"
|
|
26
|
+
#include "Modules/ModuleManager.h"
|
|
27
|
+
#include "Serialization/JsonReader.h"
|
|
28
|
+
#include "Serialization/JsonSerializer.h"
|
|
29
|
+
|
|
30
|
+
// The whole owned-content flow a user runs, against a local server standing in
|
|
31
|
+
// for fab.com and its CDN: sign-in check, a two-page library sync published to
|
|
32
|
+
// the Fab Content Browser table, finding the owned item, resolving its signed
|
|
33
|
+
// distribution URL and downloading it with BuildPatchServices, installing it into the
|
|
34
|
+
// project and removing it again. The pack is a real engine package, so the
|
|
35
|
+
// install is checked in the Asset Registry, not only on disk. Needs the Fab
|
|
36
|
+
// plugin (its table is where the sync publishes); without it the same calls
|
|
37
|
+
// must refuse with PLUGIN_NOT_AVAILABLE.
|
|
38
|
+
namespace MCPFabEndToEnd
|
|
39
|
+
{
|
|
40
|
+
struct FState
|
|
41
|
+
{
|
|
42
|
+
FMCPHandlerRegistry Registry;
|
|
43
|
+
FString Root, Cloud, Output, Folder, PackagePath, Destination;
|
|
44
|
+
FString ListingId = TEXT("7b1f0c4e-2d3a-4c5b-9e8f-0a1b2c3d4e5f");
|
|
45
|
+
FString AssetId = TEXT("0123456789abcdef0123456789abcdef");
|
|
46
|
+
FString Namespace = TEXT("89efe5924d3d467c839449ab6ab52e7f");
|
|
47
|
+
FString Account = TEXT("fedcba9876543210fedcba9876543210");
|
|
48
|
+
FString Token = TEXT("e2e-token");
|
|
49
|
+
FString Cursor = TEXT("c+1/2=");
|
|
50
|
+
FString JobId;
|
|
51
|
+
uint32 Port = 0;
|
|
52
|
+
TArray<FHttpRouteHandle> Routes;
|
|
53
|
+
TSharedPtr<IHttpRouter> Router;
|
|
54
|
+
int32 LibraryRequests = 0, AuthorizedDistribution = 0, SignedManifests = 0, Chunks = 0;
|
|
55
|
+
double Deadline = 0.0;
|
|
56
|
+
|
|
57
|
+
TSharedPtr<FJsonObject> Call(const TCHAR* Method, TSharedPtr<FJsonObject> Params = MakeShared<FJsonObject>())
|
|
58
|
+
{
|
|
59
|
+
const TSharedPtr<FJsonValue> Value = Registry.ExecuteHandler(Method, Params);
|
|
60
|
+
return Value.IsValid() && Value->Type == EJson::Object ? Value->AsObject() : MakeShared<FJsonObject>();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
FString Engine() { return FString::Printf(TEXT("UE_%d.%d"), ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION); }
|
|
65
|
+
|
|
66
|
+
FString Platform()
|
|
67
|
+
{
|
|
68
|
+
#if PLATFORM_WINDOWS
|
|
69
|
+
return TEXT("Windows");
|
|
70
|
+
#elif PLATFORM_MAC
|
|
71
|
+
return TEXT("Mac");
|
|
72
|
+
#else
|
|
73
|
+
return TEXT("Linux");
|
|
74
|
+
#endif
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
FString Item(const FState& S, const FString& Title, const FString& Listing, const FString& Artifact)
|
|
78
|
+
{
|
|
79
|
+
return FString::Printf(
|
|
80
|
+
TEXT("{\"title\":\"%s\",\"assetId\":\"%s\",\"assetNamespace\":\"%s\",\"url\":\"https://www.fab.com/listings/%s\",")
|
|
81
|
+
TEXT("\"listingType\":\"3d-model\",\"projectVersions\":[{\"artifactId\":\"%s\",\"engineVersions\":[\"%s\"],\"targetPlatforms\":[\"%s\"]}]}"),
|
|
82
|
+
*Title, *S.AssetId, *S.Namespace, *Listing, *Artifact, *Engine(), *Platform());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
FString Header(const FHttpServerRequest& Request, const FString& Name)
|
|
86
|
+
{
|
|
87
|
+
for (const auto& Pair : Request.Headers)
|
|
88
|
+
{
|
|
89
|
+
if (Pair.Key.Equals(Name, ESearchCase::IgnoreCase) && Pair.Value.Num() > 0) return Pair.Value[0];
|
|
90
|
+
}
|
|
91
|
+
return FString();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
FString Query(const FHttpServerRequest& Request, const TCHAR* Name)
|
|
95
|
+
{
|
|
96
|
+
const FString* Value = Request.QueryParams.Find(Name);
|
|
97
|
+
return Value ? FGenericPlatformHttp::UrlDecode(*Value) : FString();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
TUniquePtr<FHttpServerResponse> Json(const FString& Text) { return FHttpServerResponse::Create(Text, TEXT("application/json")); }
|
|
101
|
+
|
|
102
|
+
bool StartServer(const TSharedRef<FState>& S)
|
|
103
|
+
{
|
|
104
|
+
FHttpServerModule& Server = FHttpServerModule::Get();
|
|
105
|
+
for (int32 Attempt = 0; Attempt < 20 && !S->Router.IsValid(); ++Attempt)
|
|
106
|
+
{
|
|
107
|
+
S->Port = 40000 + FMath::RandRange(0, 19999);
|
|
108
|
+
S->Router = Server.GetHttpRouter(S->Port, /*bFailOnBindFailure=*/true);
|
|
109
|
+
}
|
|
110
|
+
if (!S->Router.IsValid()) return false;
|
|
111
|
+
|
|
112
|
+
TWeakPtr<FState> Weak = S;
|
|
113
|
+
S->Routes.Add(S->Router->BindRoute(FHttpPath(TEXT("/e")), EHttpServerRequestVerbs::VERB_GET | EHttpServerRequestVerbs::VERB_POST,
|
|
114
|
+
FHttpRequestHandler::CreateLambda([Weak](const FHttpServerRequest& Request, const FHttpResultCallback& OnComplete)
|
|
115
|
+
{
|
|
116
|
+
const TSharedPtr<FState> State = Weak.Pin();
|
|
117
|
+
const FString Path = Request.RelativePath.GetPath();
|
|
118
|
+
if (!State) { OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::NotFound)); return true; }
|
|
119
|
+
if (Header(Request, TEXT("Authorization")) != TEXT("Bearer ") + State->Token)
|
|
120
|
+
{
|
|
121
|
+
OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::Denied)); return true;
|
|
122
|
+
}
|
|
123
|
+
if (Request.Verb == EHttpServerRequestVerbs::VERB_GET && Path.Contains(State->Account + TEXT("/ue/library")))
|
|
124
|
+
{
|
|
125
|
+
++State->LibraryRequests;
|
|
126
|
+
const FString Cursor = Query(Request, TEXT("cursor"));
|
|
127
|
+
if (Cursor.IsEmpty())
|
|
128
|
+
{
|
|
129
|
+
OnComplete(Json(TEXT("{\"results\":[") + Item(*State, TEXT("Decoy Owned Pack"), TEXT("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), TEXT("Decoy"))
|
|
130
|
+
+ TEXT("],\"cursors\":{\"next\":\"") + State->Cursor + TEXT("\"}}")));
|
|
131
|
+
}
|
|
132
|
+
else if (Cursor == State->Cursor)
|
|
133
|
+
{
|
|
134
|
+
OnComplete(Json(TEXT("{\"results\":[") + Item(*State, TEXT("MCP E2E Cube Pack"), State->ListingId, TEXT("MCPFabE2E"))
|
|
135
|
+
+ TEXT("],\"cursors\":{\"next\":null}}")));
|
|
136
|
+
}
|
|
137
|
+
else OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::BadRequest, TEXT("cursor"), Cursor));
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (Request.Verb == EHttpServerRequestVerbs::VERB_POST && Path.Contains(TEXT("artifacts/MCPFabE2E/manifest")))
|
|
141
|
+
{
|
|
142
|
+
TSharedPtr<FJsonObject> Body;
|
|
143
|
+
const FString Text = FString(FUTF8ToTCHAR(reinterpret_cast<const ANSICHAR*>(Request.Body.GetData()), Request.Body.Num()));
|
|
144
|
+
if (!FJsonSerializer::Deserialize(TJsonReaderFactory<>::Create(Text), Body) || !Body
|
|
145
|
+
|| Body->GetStringField(TEXT("item_id")) != State->AssetId || Body->GetStringField(TEXT("namespace")) != State->Namespace
|
|
146
|
+
|| Body->GetStringField(TEXT("platform")) != Platform())
|
|
147
|
+
{
|
|
148
|
+
OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::BadRequest)); return true;
|
|
149
|
+
}
|
|
150
|
+
++State->AuthorizedDistribution;
|
|
151
|
+
OnComplete(Json(FString::Printf(
|
|
152
|
+
TEXT("{\"downloadInfo\":[{\"artifactId\":\"MCPFabE2E\",\"distributionPoints\":[{\"manifestUrl\":\"http://127.0.0.1:%u/cloud/fixture.manifest?Signature=s1\",\"signatureExpiration\":\"2999-01-01T00:00:00Z\"}]}]}"),
|
|
153
|
+
State->Port)));
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::NotFound));
|
|
157
|
+
return true;
|
|
158
|
+
})));
|
|
159
|
+
|
|
160
|
+
S->Routes.Add(S->Router->BindRoute(FHttpPath(TEXT("/cloud")), EHttpServerRequestVerbs::VERB_GET,
|
|
161
|
+
FHttpRequestHandler::CreateLambda([Weak](const FHttpServerRequest& Request, const FHttpResultCallback& OnComplete)
|
|
162
|
+
{
|
|
163
|
+
const TSharedPtr<FState> State = Weak.Pin();
|
|
164
|
+
FString Relative = Request.RelativePath.GetPath();
|
|
165
|
+
while (Relative.StartsWith(TEXT("/"))) Relative.RightChopInline(1);
|
|
166
|
+
Relative.RemoveFromStart(TEXT("cloud/"));
|
|
167
|
+
TArray<uint8> Bytes;
|
|
168
|
+
if (!State || Relative.Contains(TEXT("..")) || !FFileHelper::LoadFileToArray(Bytes, *(State->Cloud / Relative)))
|
|
169
|
+
{
|
|
170
|
+
OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::NotFound)); return true;
|
|
171
|
+
}
|
|
172
|
+
// The manifest is fetched from the signed URL distribution handed
|
|
173
|
+
// out. Chunks arrive unsigned here: the signing handler serves only
|
|
174
|
+
// https CDNs (BPS answers it from a ticker this test cannot pump),
|
|
175
|
+
// and UE.MCP.Fab.Download.VersionAndPaths covers how it signs.
|
|
176
|
+
if (Relative.EndsWith(TEXT(".manifest")))
|
|
177
|
+
{
|
|
178
|
+
if (Query(Request, TEXT("Signature")) != TEXT("s1")) { OnComplete(FHttpServerResponse::Error(EHttpServerResponseCodes::Denied)); return true; }
|
|
179
|
+
++State->SignedManifests;
|
|
180
|
+
}
|
|
181
|
+
else ++State->Chunks;
|
|
182
|
+
OnComplete(FHttpServerResponse::Create(MoveTemp(Bytes), TEXT("application/octet-stream")));
|
|
183
|
+
return true;
|
|
184
|
+
})));
|
|
185
|
+
Server.StartAllListeners();
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
void Cleanup(const TSharedRef<FState>& S)
|
|
190
|
+
{
|
|
191
|
+
if (S->Router.IsValid()) for (const FHttpRouteHandle& Route : S->Routes) S->Router->UnbindRoute(Route);
|
|
192
|
+
S->Routes.Reset();
|
|
193
|
+
MCPFab::ShutdownDownloads();
|
|
194
|
+
MCPFab::ResetLibrary();
|
|
195
|
+
FString Ignored; MCPFab::PublishLibrary({}, Ignored);
|
|
196
|
+
MCPFab::SetSessionForTesting(nullptr);
|
|
197
|
+
IFileManager::Get().DeleteDirectory(*FPaths::GetPath(S->Destination), false, true);
|
|
198
|
+
IFileManager::Get().DeleteDirectory(*S->Root, false, true);
|
|
199
|
+
FAssetRegistryModule::GetRegistry().ScanPathsSynchronous({ S->Folder }, true);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Runs the HTTP client and the local server until Done says so or the
|
|
204
|
+
* deadline passes. The bridge runs automation tests on the game thread
|
|
205
|
+
* with no engine frames in between, so the test pumps both itself: the
|
|
206
|
+
* client delivers its completions in FHttpManager::Tick and the server
|
|
207
|
+
* accepts and answers in its own ticker callback.
|
|
208
|
+
*/
|
|
209
|
+
bool PumpUntil(FAutomationTestBase& Test, const TSharedRef<FState>& S, const TCHAR* What, TFunctionRef<bool()> Done)
|
|
210
|
+
{
|
|
211
|
+
FHttpManager& Client = FHttpModule::Get().GetHttpManager();
|
|
212
|
+
FTSTickerObjectBase& Server = FHttpServerModule::Get();
|
|
213
|
+
while (!Done())
|
|
214
|
+
{
|
|
215
|
+
if (FPlatformTime::Seconds() > S->Deadline)
|
|
216
|
+
{
|
|
217
|
+
Test.AddError(FString(TEXT("Timed out waiting for ")) + What);
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
Client.Tick(0.01f);
|
|
221
|
+
Server.Tick(0.01f);
|
|
222
|
+
FPlatformProcess::Sleep(0.005f);
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FFabEndToEndTest, "UE.MCP.Fab.EndToEnd.SyncDownloadInstall",
|
|
229
|
+
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)
|
|
230
|
+
|
|
231
|
+
bool FFabEndToEndTest::RunTest(const FString& Parameters)
|
|
232
|
+
{
|
|
233
|
+
using namespace MCPFabEndToEnd;
|
|
234
|
+
TSharedRef<FState> S = MakeShared<FState>();
|
|
235
|
+
FFabHandlers::RegisterHandlers(S->Registry);
|
|
236
|
+
|
|
237
|
+
if (!FModuleManager::Get().IsModuleLoaded(TEXT("Fab")))
|
|
238
|
+
{
|
|
239
|
+
// No Fab plugin in this engine: every step of the flow names what is missing.
|
|
240
|
+
auto Download = MakeShared<FJsonObject>(); Download->SetStringField(TEXT("listingId"), S->ListingId);
|
|
241
|
+
for (const TSharedPtr<FJsonObject>& Refused : { S->Call(TEXT("fab_sync_library")), S->Call(TEXT("fab_list_owned")), S->Call(TEXT("fab_download"), Download) })
|
|
242
|
+
{
|
|
243
|
+
TestFalse(TEXT("refused without Fab"), Refused->GetBoolField(TEXT("success")));
|
|
244
|
+
TestEqual(TEXT("refusal code"), Refused->GetStringField(TEXT("errorCode")), FString(TEXT("PLUGIN_NOT_AVAILABLE")));
|
|
245
|
+
TestTrue(TEXT("refusal says how to get Fab"), Refused->GetStringField(TEXT("error")).Contains(TEXT("Fab")));
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// The pack: the engine's cube mesh, renamed into a folder of its own, as a
|
|
251
|
+
// BuildPatchServices cloud the local CDN serves.
|
|
252
|
+
const FString Suffix = FGuid::NewGuid().ToString(EGuidFormats::Digits);
|
|
253
|
+
S->Root = FPaths::ConvertRelativePathToFull(FPaths::ProjectSavedDir() / TEXT("UE_MCP/FabE2E") / Suffix);
|
|
254
|
+
S->Cloud = S->Root / TEXT("cloud");
|
|
255
|
+
S->Output = S->Root / TEXT("output");
|
|
256
|
+
S->Folder = TEXT("/Game/UEMCP/FabE2E_") + Suffix;
|
|
257
|
+
S->PackagePath = S->Folder + TEXT("/SM_FabCube");
|
|
258
|
+
const FString Relative = TEXT("Content/UEMCP/FabE2E_") + Suffix + TEXT("/SM_FabCube.uasset");
|
|
259
|
+
S->Destination = FPaths::ConvertRelativePathToFull(FPaths::ProjectContentDir() / Relative.Mid(8));
|
|
260
|
+
const FString CubeFile = FPaths::ConvertRelativePathToFull(FPaths::EngineContentDir() / TEXT("BasicShapes/Cube.uasset"));
|
|
261
|
+
if (!TestTrue(TEXT("engine cube package exists"), IFileManager::Get().FileExists(*CubeFile))) return false;
|
|
262
|
+
IFileManager::Get().MakeDirectory(*FPaths::GetPath(S->Root / TEXT("source") / Relative), true);
|
|
263
|
+
IFileManager::Get().MakeDirectory(*S->Cloud, true);
|
|
264
|
+
if (!TestEqual(TEXT("pack source staged"), IFileManager::Get().Copy(*(S->Root / TEXT("source") / Relative), *CubeFile), (uint32)COPY_OK)) { Cleanup(S); return false; }
|
|
265
|
+
FString Tool = FPaths::ConvertRelativePathToFull(FPaths::EngineDir() / TEXT("Binaries") / FPlatformProcess::GetBinariesSubdirectory() / TEXT("BuildPatchTool"));
|
|
266
|
+
#if PLATFORM_WINDOWS
|
|
267
|
+
Tool += TEXT(".exe");
|
|
268
|
+
#endif
|
|
269
|
+
const FString Arguments = FString::Printf(TEXT("-mode=ChunkBuildDirectory -FeatureLevel=Latest -BuildRoot=\"%s\" -CloudDir=\"%s\" -ArtifactId=MCPFabE2E -BuildVersion=1 -AppLaunch=\"\" -AppArgs=\"\" -OutputFilename=fixture.manifest -abslog=\"%s\""),
|
|
270
|
+
*(S->Root / TEXT("source")), *S->Cloud, *(S->Root / TEXT("chunker.log")));
|
|
271
|
+
int32 ExitCode = -1;
|
|
272
|
+
if (!TestTrue(TEXT("BuildPatchTool ran"), FPlatformProcess::ExecProcess(*Tool, *Arguments, &ExitCode, nullptr, nullptr)) || !TestEqual(TEXT("pack chunked"), ExitCode, 0))
|
|
273
|
+
{
|
|
274
|
+
Cleanup(S); return false;
|
|
275
|
+
}
|
|
276
|
+
if (!TestTrue(TEXT("local Fab server listening"), StartServer(S))) { Cleanup(S); return false; }
|
|
277
|
+
|
|
278
|
+
MCPFab::FSession Session{ FString::Printf(TEXT("http://127.0.0.1:%u"), S->Port), S->Account, S->Token };
|
|
279
|
+
MCPFab::SetSessionForTesting(&Session);
|
|
280
|
+
S->Deadline = FPlatformTime::Seconds() + 90.0;
|
|
281
|
+
ON_SCOPE_EXIT { Cleanup(S); };
|
|
282
|
+
|
|
283
|
+
// Signed in already: status says so and login opens no window.
|
|
284
|
+
TestTrue(TEXT("status sees the session"), S->Call(TEXT("fab_status"))->GetBoolField(TEXT("authenticated")));
|
|
285
|
+
const auto Login = S->Call(TEXT("fab_login"));
|
|
286
|
+
TestTrue(TEXT("login answers"), Login->GetBoolField(TEXT("success")));
|
|
287
|
+
TestTrue(TEXT("login with a session is unchanged"), Login->GetBoolField(TEXT("unchanged")));
|
|
288
|
+
|
|
289
|
+
// Before a sync, the library actions say what to do.
|
|
290
|
+
const auto Early = S->Call(TEXT("fab_list_owned"));
|
|
291
|
+
TestEqual(TEXT("list_owned before a sync"), Early->GetStringField(TEXT("errorCode")), FString(TEXT("FAB_LIBRARY_NOT_SYNCED")));
|
|
292
|
+
|
|
293
|
+
auto Sync = MakeShared<FJsonObject>(); Sync->SetNumberField(TEXT("batchSize"), 1);
|
|
294
|
+
TestTrue(TEXT("sync starts"), S->Call(TEXT("fab_sync_library"), Sync)->GetBoolField(TEXT("success")));
|
|
295
|
+
if (!PumpUntil(*this, S, TEXT("library sync"), [&S]()
|
|
296
|
+
{
|
|
297
|
+
const FString State = S->Call(TEXT("fab_status"))->GetObjectField(TEXT("librarySync"))->GetStringField(TEXT("state"));
|
|
298
|
+
return State == TEXT("complete") || State == TEXT("failed");
|
|
299
|
+
})) return false;
|
|
300
|
+
{
|
|
301
|
+
const auto Library = S->Call(TEXT("fab_status"))->GetObjectField(TEXT("librarySync"));
|
|
302
|
+
if (!TestEqual(TEXT("sync completed"), Library->GetStringField(TEXT("state")), FString(TEXT("complete"))))
|
|
303
|
+
{
|
|
304
|
+
AddError(Library->GetStringField(TEXT("error"))); return false;
|
|
305
|
+
}
|
|
306
|
+
TestEqual(TEXT("both pages fetched, cursor round-tripped"), Library->GetIntegerField(TEXT("pages")), 2);
|
|
307
|
+
TestEqual(TEXT("two library requests"), S->LibraryRequests, 2);
|
|
308
|
+
TestEqual(TEXT("snapshot holds both items"), Library->GetIntegerField(TEXT("snapshotItems")), 2);
|
|
309
|
+
TestEqual(TEXT("Content Browser table rows published"), Library->GetIntegerField(TEXT("publishedRows")), 2);
|
|
310
|
+
|
|
311
|
+
auto Find = MakeShared<FJsonObject>(); Find->SetStringField(TEXT("query"), TEXT("e2e cube"));
|
|
312
|
+
const auto Owned = S->Call(TEXT("fab_list_owned"), Find);
|
|
313
|
+
const TArray<TSharedPtr<FJsonValue>>* Items = nullptr;
|
|
314
|
+
if (!TestTrue(TEXT("list_owned answers"), Owned->GetBoolField(TEXT("success")) && Owned->TryGetArrayField(TEXT("items"), Items)) || !TestEqual(TEXT("title filter finds one"), Items->Num(), 1))
|
|
315
|
+
{
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
const auto Row = (*Items)[0]->AsObject();
|
|
319
|
+
TestEqual(TEXT("listingId derived"), Row->GetStringField(TEXT("listingId")), S->ListingId);
|
|
320
|
+
TestTrue(TEXT("available for this editor"), Row->GetBoolField(TEXT("availableForThisEditor")));
|
|
321
|
+
|
|
322
|
+
// engineVersion and platform default to this editor's.
|
|
323
|
+
auto Download = MakeShared<FJsonObject>();
|
|
324
|
+
Download->SetStringField(TEXT("listingId"), Row->GetStringField(TEXT("listingId")));
|
|
325
|
+
Download->SetStringField(TEXT("outputDirectory"), S->Output);
|
|
326
|
+
const auto Started = S->Call(TEXT("fab_download"), Download);
|
|
327
|
+
if (!TestTrue(TEXT("download starts"), Started->GetBoolField(TEXT("success")))) { AddError(Started->GetStringField(TEXT("error"))); return false; }
|
|
328
|
+
S->JobId = Started->GetObjectField(TEXT("job"))->GetStringField(TEXT("jobId"));
|
|
329
|
+
TestEqual(TEXT("artifact for this editor chosen"), Started->GetObjectField(TEXT("job"))->GetStringField(TEXT("artifactId")), FString(TEXT("MCPFabE2E")));
|
|
330
|
+
}
|
|
331
|
+
auto Params = MakeShared<FJsonObject>(); Params->SetStringField(TEXT("jobId"), S->JobId);
|
|
332
|
+
if (!PumpUntil(*this, S, TEXT("download"), [&S, &Params]()
|
|
333
|
+
{
|
|
334
|
+
const FString State = S->Call(TEXT("fab_download_status"), Params)->GetObjectField(TEXT("job"))->GetStringField(TEXT("state"));
|
|
335
|
+
return State == TEXT("complete") || State == TEXT("failed") || State == TEXT("cancelled");
|
|
336
|
+
})) return false;
|
|
337
|
+
{
|
|
338
|
+
const auto Job = S->Call(TEXT("fab_download_status"), Params)->GetObjectField(TEXT("job"));
|
|
339
|
+
if (!TestEqual(TEXT("download complete"), Job->GetStringField(TEXT("state")), FString(TEXT("complete")))) { AddError(Job->GetStringField(TEXT("error"))); return false; }
|
|
340
|
+
TestEqual(TEXT("distribution resolved with the session's token"), S->AuthorizedDistribution, 1);
|
|
341
|
+
TestEqual(TEXT("manifest fetched from the signed distribution URL"), S->SignedManifests, 1);
|
|
342
|
+
TestTrue(TEXT("chunks fetched from the CDN"), S->Chunks > 0);
|
|
343
|
+
TestTrue(TEXT("bytes transferred"), Job->GetNumberField(TEXT("downloadedBytes")) > 0);
|
|
344
|
+
|
|
345
|
+
const auto Installed = S->Call(TEXT("fab_install_pack"), Params);
|
|
346
|
+
if (!TestTrue(TEXT("install succeeds"), Installed->GetBoolField(TEXT("success")))) { AddError(Installed->GetStringField(TEXT("error"))); return false; }
|
|
347
|
+
TestEqual(TEXT("one package copied"), Installed->GetIntegerField(TEXT("copiedFiles")), 1);
|
|
348
|
+
TestTrue(TEXT("package on disk"), IFileManager::Get().FileExists(*S->Destination));
|
|
349
|
+
TArray<FAssetData> Assets;
|
|
350
|
+
FAssetRegistryModule::GetRegistry().GetAssetsByPackageName(FName(*S->PackagePath), Assets);
|
|
351
|
+
if (TestEqual(TEXT("Asset Registry knows the installed asset"), Assets.Num(), 1))
|
|
352
|
+
{
|
|
353
|
+
TestEqual(TEXT("installed asset is a static mesh"), Assets[0].AssetClassPath.GetAssetName(), FName(TEXT("StaticMesh")));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const auto Removed = S->Call(TEXT("fab_remove_installation"), Params);
|
|
357
|
+
TestTrue(TEXT("removal succeeds"), Removed->GetBoolField(TEXT("success")));
|
|
358
|
+
TestEqual(TEXT("the installed package removed"), Removed->GetIntegerField(TEXT("removedFiles")), 1);
|
|
359
|
+
TestFalse(TEXT("package gone from disk"), IFileManager::Get().FileExists(*S->Destination));
|
|
360
|
+
}
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
#endif
|
|
365
|
+
#endif
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#if WITH_DEV_AUTOMATION_TESTS
|
|
2
|
+
|
|
3
|
+
#include "Handlers/Fab/FabLibrary.h"
|
|
4
|
+
#include "Misc/AutomationTest.h"
|
|
5
|
+
#include "Misc/Base64.h"
|
|
6
|
+
|
|
7
|
+
IMPLEMENT_SIMPLE_AUTOMATION_TEST(FFabLibraryProtocolTest, "UE.MCP.Fab.Library.Protocol",
|
|
8
|
+
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)
|
|
9
|
+
|
|
10
|
+
bool FFabLibraryProtocolTest::RunTest(const FString& Parameters)
|
|
11
|
+
{
|
|
12
|
+
using namespace MCPFab;
|
|
13
|
+
const FString Account = TEXT("0123456789abcdef0123456789abcdef");
|
|
14
|
+
const FString Payload = FString::Printf(TEXT("{\"sub\":\"%s\"}"), *Account);
|
|
15
|
+
TestEqual(TEXT("native JWT account discovery"), AccountFromToken(TEXT("eg1~header.") + FBase64::Encode(Payload) + TEXT(".signature")), Account);
|
|
16
|
+
TestTrue(TEXT("opaque tokens do not guess an account"), AccountFromToken(TEXT("opaque")).IsEmpty());
|
|
17
|
+
FSession Session{TEXT("https://www.fab.com"), Account, TEXT("")};
|
|
18
|
+
TestEqual(TEXT("cursor is encoded without quotes"), LibraryUrl(Session, 20, TEXT("a+/= b")),
|
|
19
|
+
TEXT("https://www.fab.com/e/accounts/") + Account + TEXT("/ue/library?count=20&cursor=a%2B%2F%3D%20b"));
|
|
20
|
+
const FString Item = TEXT("{\"title\":\"Fixture\",\"assetId\":\"0123456789abcdef0123456789abcdef\",\"assetNamespace\":\"11111111111111111111111111111111\"}");
|
|
21
|
+
FLibraryState State;
|
|
22
|
+
State.Items.Add(MakeShared<FJsonValueString>(TEXT("previous snapshot")));
|
|
23
|
+
State.AccountId = Account;
|
|
24
|
+
State.Begin(Account);
|
|
25
|
+
TestTrue(TEXT("first valid page"), State.Consume(200, TEXT("application/json; charset=utf-8"),
|
|
26
|
+
TEXT("{\"results\":[") + Item + TEXT("],\"cursors\":{\"next\":\"cursor+1\"}}")));
|
|
27
|
+
TestEqual(TEXT("previous snapshot remains while fetching"), State.Items.Num(), 1);
|
|
28
|
+
TestEqual(TEXT("no premature success"), State.State, FString(TEXT("fetching")));
|
|
29
|
+
TestFalse(TEXT("404 HTML is failure"), State.Consume(404, TEXT("text/html"), TEXT("private response")));
|
|
30
|
+
TestEqual(TEXT("failure retains previous snapshot"), State.Items.Num(), 1);
|
|
31
|
+
TestEqual(TEXT("partial results discarded"), State.Pending.Num(), 0);
|
|
32
|
+
TestFalse(TEXT("response bodies never enter errors"), State.Error.Contains(TEXT("private response")));
|
|
33
|
+
State.Begin(Account);
|
|
34
|
+
const FString Repeated = TEXT("{\"results\":[],\"cursors\":{\"next\":\"same\"}}");
|
|
35
|
+
TestTrue(TEXT("first cursor accepted"), State.Consume(200, TEXT("application/json"), Repeated));
|
|
36
|
+
TestFalse(TEXT("repeating cursor terminates"), State.Consume(200, TEXT("application/json"), Repeated));
|
|
37
|
+
State.Begin(Account);
|
|
38
|
+
TestFalse(TEXT("malformed item cannot erase old index"), State.Consume(200, TEXT("application/json"), TEXT("{\"results\":[{}]}")));
|
|
39
|
+
State.Begin(Account);
|
|
40
|
+
TestFalse(TEXT("200 HTML is failure too"), State.Consume(200, TEXT("text/html"), TEXT("<html/>")));
|
|
41
|
+
State.Begin(Account);
|
|
42
|
+
TestTrue(TEXT("empty owned library is valid"), State.Consume(200, TEXT("application/json"), TEXT("{\"results\":[],\"cursors\":{\"next\":null}}")));
|
|
43
|
+
TestEqual(TEXT("complete fetch still awaits publication"), State.State, FString(TEXT("publishing")));
|
|
44
|
+
State.Begin(Account);
|
|
45
|
+
const FString Legacy = Item.Replace(TEXT("11111111111111111111111111111111"), TEXT("ue"));
|
|
46
|
+
TestTrue(TEXT("legacy Epic namespaces are opaque strings, not GUIDs"), State.Consume(200, TEXT("application/json"), TEXT("{\"results\":[") + Legacy + TEXT("]}")));
|
|
47
|
+
State.Begin(TEXT("22222222222222222222222222222222"));
|
|
48
|
+
TestEqual(TEXT("account switch drops private snapshot"), State.Items.Num(), 0);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#endif
|
|
@@ -358,7 +358,10 @@ bool FMCPPCGImportUpsertTest::RunTest(const FString& Parameters)
|
|
|
358
358
|
const FString GraphPath = NewGraph(Registry);
|
|
359
359
|
UPCGGraph* Graph = GraphPath.IsEmpty() ? nullptr : LoadObject<UPCGGraph>(nullptr, *GraphPath);
|
|
360
360
|
if (!TestNotNull(TEXT("the graph loads"), Graph)) return false;
|
|
361
|
-
|
|
361
|
+
// The edge comes from another Distance node: point data into point data on every engine. From the graph
|
|
362
|
+
// input (Any) into Source (Point), 5.9 asks for a conversion node first.
|
|
363
|
+
TestTrue(TEXT("the named nodes are created"), Ok(ImportGraph(Registry, GraphPath,
|
|
364
|
+
{ ImportNode(TEXT("FT_Src"), TEXT("PCGDistanceSettings")), ImportNode(TEXT("FT_BankDist"), TEXT("PCGDistanceSettings")) })));
|
|
362
365
|
UPCGNode* Original = FindNode(Graph, TEXT("FT_BankDist"));
|
|
363
366
|
if (!TestNotNull(TEXT("it keeps its name"), Original)) return false;
|
|
364
367
|
const int32 NodeCount = Graph->GetNodes().Num();
|
|
@@ -367,7 +370,7 @@ bool FMCPPCGImportUpsertTest::RunTest(const FString& Parameters)
|
|
|
367
370
|
auto Settings = MakeShared<FJsonObject>();
|
|
368
371
|
Settings->SetNumberField(TEXT("MaximumDistance"), 1234.0);
|
|
369
372
|
auto Edge = MakeShared<FJsonObject>();
|
|
370
|
-
Edge->SetStringField(TEXT("from"),
|
|
373
|
+
Edge->SetStringField(TEXT("from"), TEXT("FT_Src"));
|
|
371
374
|
Edge->SetStringField(TEXT("to"), TEXT("FT_BankDist"));
|
|
372
375
|
const TSharedPtr<FJsonObject> Upserted = ImportGraph(Registry, GraphPath,
|
|
373
376
|
{ ImportNode(TEXT("FT_BankDist"), TEXT("PCGDistanceSettings"), Settings) }, { MakeShared<FJsonValueObject>(Edge) });
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Replay input lock (lock_input): which physical events are blocked while a
|
|
2
|
+
// replay runs and which always get through.
|
|
3
|
+
|
|
4
|
+
#include "Misc/AutomationTest.h"
|
|
5
|
+
|
|
6
|
+
#if WITH_DEV_AUTOMATION_TESTS
|
|
7
|
+
|
|
8
|
+
#include "Handlers/PIE/PIEReplayInputLock.h"
|
|
9
|
+
|
|
10
|
+
namespace
|
|
11
|
+
{
|
|
12
|
+
MCPPIE::FReplayLockInputEvent KeyEvent(const FKey& Key, bool bViewportFocused, bool bInsideViewport = false)
|
|
13
|
+
{
|
|
14
|
+
MCPPIE::FReplayLockInputEvent E;
|
|
15
|
+
E.Kind = MCPPIE::EReplayLockInput::Key;
|
|
16
|
+
E.Key = Key;
|
|
17
|
+
E.bViewportFocused = bViewportFocused;
|
|
18
|
+
E.bInsideViewport = bInsideViewport;
|
|
19
|
+
return E;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
MCPPIE::FReplayLockInputEvent PointerEvent(MCPPIE::EReplayLockInput Kind, bool bInsideViewport, bool bInjected = false)
|
|
23
|
+
{
|
|
24
|
+
MCPPIE::FReplayLockInputEvent E;
|
|
25
|
+
E.Kind = Kind;
|
|
26
|
+
E.bInsideViewport = bInsideViewport;
|
|
27
|
+
E.bInjected = bInjected;
|
|
28
|
+
return E;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
IMPLEMENT_SIMPLE_AUTOMATION_TEST(
|
|
33
|
+
FPIEReplayInputLockRuleTest,
|
|
34
|
+
"UE.MCP.PIE.ReplayInputLock.Rule",
|
|
35
|
+
EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter)
|
|
36
|
+
|
|
37
|
+
bool FPIEReplayInputLockRuleTest::RunTest(const FString& /*Parameters*/)
|
|
38
|
+
{
|
|
39
|
+
using namespace MCPPIE;
|
|
40
|
+
|
|
41
|
+
// Keyboard follows focus.
|
|
42
|
+
TestTrue(TEXT("key into the focused viewport is blocked"), ShouldReplayLockBlock(KeyEvent(EKeys::W, true)));
|
|
43
|
+
TestFalse(TEXT("key typed elsewhere in the editor passes"), ShouldReplayLockBlock(KeyEvent(EKeys::W, false)));
|
|
44
|
+
|
|
45
|
+
// Escape hatches.
|
|
46
|
+
TestFalse(TEXT("Esc passes"), ShouldReplayLockBlock(KeyEvent(EKeys::Escape, true)));
|
|
47
|
+
TestFalse(TEXT("F8 passes"), ShouldReplayLockBlock(KeyEvent(EKeys::F8, true)));
|
|
48
|
+
FReplayLockInputEvent ShiftF1 = KeyEvent(EKeys::F1, true);
|
|
49
|
+
ShiftF1.bShift = true;
|
|
50
|
+
TestFalse(TEXT("Shift+F1 passes"), ShouldReplayLockBlock(ShiftF1));
|
|
51
|
+
TestTrue(TEXT("F1 without Shift is blocked"), ShouldReplayLockBlock(KeyEvent(EKeys::F1, true)));
|
|
52
|
+
|
|
53
|
+
// Releases always pass so nothing is left held.
|
|
54
|
+
FReplayLockInputEvent Release = KeyEvent(EKeys::W, true);
|
|
55
|
+
Release.bRelease = true;
|
|
56
|
+
TestFalse(TEXT("key release passes"), ShouldReplayLockBlock(Release));
|
|
57
|
+
|
|
58
|
+
// Gamepad is blocked regardless of focus.
|
|
59
|
+
TestTrue(TEXT("gamepad button is blocked"), ShouldReplayLockBlock(KeyEvent(EKeys::Gamepad_FaceButton_Bottom, false)));
|
|
60
|
+
FReplayLockInputEvent Stick;
|
|
61
|
+
Stick.Kind = EReplayLockInput::Analog;
|
|
62
|
+
Stick.Key = EKeys::Gamepad_LeftX;
|
|
63
|
+
TestTrue(TEXT("gamepad stick is blocked"), ShouldReplayLockBlock(Stick));
|
|
64
|
+
|
|
65
|
+
// Mouse follows the pointer, so the editor's own controls stay usable.
|
|
66
|
+
TestTrue(TEXT("mouse look inside the viewport is blocked"), ShouldReplayLockBlock(PointerEvent(EReplayLockInput::MouseMove, true)));
|
|
67
|
+
TestFalse(TEXT("mouse outside the viewport passes"), ShouldReplayLockBlock(PointerEvent(EReplayLockInput::MouseMove, false)));
|
|
68
|
+
TestTrue(TEXT("wheel inside the viewport is blocked"), ShouldReplayLockBlock(PointerEvent(EReplayLockInput::MouseWheel, true)));
|
|
69
|
+
TestTrue(TEXT("click inside the viewport is blocked"), ShouldReplayLockBlock(KeyEvent(EKeys::LeftMouseButton, true, true)));
|
|
70
|
+
TestFalse(TEXT("click outside the viewport passes"), ShouldReplayLockBlock(KeyEvent(EKeys::LeftMouseButton, true, false)));
|
|
71
|
+
|
|
72
|
+
// Replayed events are never blocked.
|
|
73
|
+
TestFalse(TEXT("replayed move passes"), ShouldReplayLockBlock(PointerEvent(EReplayLockInput::MouseMove, true, true)));
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#endif
|