UnrealModFramework
Mod framework API
Toggle main menu visibility
Loading...
Searching...
No Matches
ModTestRegistry.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Nelaric Contributors
3
#pragma once
4
5
#if WITH_EDITOR && WITH_DEV_AUTOMATION_TESTS
6
7
#include "Misc/AutomationTest.h"
8
#include "
ModAPIHost.h
"
9
#include "
ModAPINative.h
"
10
#include "
ModTestWorld.h
"
11
12
namespace
Mod::Tests
13
{
15
template
<
class
T>
bool
Take(FAutomationTestBase& Test,
const
TCHAR* What, TModResult<T> Result, T& Out)
16
{
17
if
(!Test.TestEqual(What,
static_cast<
uint8
>
(Result.
GetError
()),
static_cast<
uint8
>
(API::EError::None)))
18
{
19
return
false
;
20
}
21
Out = MoveTemp(Result.
GetValue
());
22
return
true
;
23
}
24
26
template
<
class
T>
27
bool
ExpectError(FAutomationTestBase& Test,
const
TCHAR* What,
const
TModResult<T>& Result, API::EError Expected)
28
{
29
return
Test.TestEqual(What,
static_cast<
uint8
>
(Result.
GetError
()),
static_cast<
uint8
>
(Expected));
30
}
31
33
class
INFRASTRUCTURE_API FTestRegistry
34
{
35
public
:
37
static
FName TypeId();
38
40
static
constexpr
const
TCHAR* Signature = TEXT(
"TestRegistry.Type.v1"
);
41
43
static
API::FTypeDescriptor Describe(FName Id = TypeId());
44
50
bool
Open(FAutomationTestBase& Test, TSet<FName> Permissions = {});
51
58
TModResult<UObject*> Enter(
const
API::FObjectBinding& Target,
bool
bMutable =
false
,
59
TConstArrayView<FName> Permissions = {})
const
;
60
62
FTestWorld
World
;
63
65
API::FRegistry Registry;
66
68
TStrongObjectPtr<UObject> Object;
69
71
API::FRegistration Type;
72
74
API::FRegistration Provider;
75
77
API::FScope Scope;
78
80
API::FCaller Caller;
81
83
API::FObjectBinding Binding;
84
};
85
}
// namespace Mod::Tests
86
87
#endif
ModAPIHost.h
ModAPINative.h
Mod::API::EScope::World
@ World
An object belonging to a live world.
Definition
ModAPIRegistry.h:25
ModTestWorld.h
TModResult::GetValue
const T & GetValue() const
Reads a successful value.
Definition
ModAPIResult.h:89
TModResult::GetError
Mod::API::EError GetError() const
Returns the operation status.
Definition
ModAPIResult.h:81
TestSuite
Source
Infrastructure
Public
ModTestRegistry.h
Generated by
1.18.0