Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AutotestSuiteBase.c
Go to the documentation of this file.
1
6[BaseContainerProps(category: "Autotest")]
8{
9 //------------------------------------------------------------------------------------------------
11 ResourceName GetWorldFile()
12 {
13 return SCR_AutotestHelper.GetDefaultWorld();
14 }
15
16 //------------------------------------------------------------------------------------------------
18 ResourceName GetWorldSystemsConfigFile()
19 {
20 return SCR_AutotestHelper.GetDefaultSystemsConfig();
21 }
22
23 //------------------------------------------------------------------------------------------------
27 void Print(string msg, LogLevel level = LogLevel.NORMAL)
28 {
29 SCR_AutotestHarness.GetLogger().Log(msg, level);
30 }
31
32 //------------------------------------------------------------------------------------------------
36 void PrintFormat(string fmt, string param1 = "", string param2 = "", string param3 = "", LogLevel level = LogLevel.NORMAL)
37 {
38 SCR_AutotestHarness.GetLogger().Log(string.Format(fmt, param1, param2, param3), level);
39 }
40
41 //------------------------------------------------------------------------------------------------
43 [Step(EStage.Setup)]
44 private void Setup_PrintPrelude()
45 {
47 }
48
49 //------------------------------------------------------------------------------------------------
51 [Step(EStage.Setup)]
52 private void Setup_OpenWorld()
53 {
54 ResourceName world = GetWorldFile();
55 ResourceName systemsConfig = GetWorldSystemsConfigFile();
56 if (world && !SCR_AutotestHelper.WorldOpenFile(world, systemsConfig))
57 {
58 string failure = string.Format("Failed to load world: %1, %2", world, systemsConfig);
59 SCR_AutotestHarness.GetLogger().Log(failure, level: LogLevel.ERROR);
60
61 SetResult(SCR_AutotestResult.AsFailure(failure));
62 }
63 }
64
65 //------------------------------------------------------------------------------------------------
67 [Step(EStage.Setup)]
68 private bool Setup_AwaitWorld()
69 {
70 return !GameStateTransitions.IsTransitionRequestedOrInProgress();
71 }
72
73 //------------------------------------------------------------------------------------------------
75 [Step(EStage.Setup)]
76 private void Setup_CloseMenus()
77 {
78 GetGame().GetMenuManager().CloseAllMenus();
79 }
80
81 //------------------------------------------------------------------------------------------------
83 [Step(EStage.TearDown)]
84 private void TearDown_PrintEpilogue()
85 {
87 }
88}
89
90#ifdef MODULE_AUTOTEST
91// HACK: prevents script compilation from sealing methods by overriding them in any class
92// fixes the issue with not being able to override these methods in different script modules (Autotest/)
93sealed class SCR_Hack_AutotestSuiteBase : SCR_AutotestSuiteBase
94{
95 override ResourceName GetWorldFile();
96 override ResourceName GetWorldSystemsConfigFile();
97}
98#endif
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
void PrintTestSuiteEpilogue(TestSuite suite)
void Log(string msg, LogLevel level=LogLevel.NORMAL, bool forceFileWrite=false, bool consoleLog=true)
Should be used in tests instead of global Print. Forwards test output to separate file.
void PrintTestSuitePrelude(TestSuite suite)
static SCR_AutotestResult AsFailure(string reason, string param1="", string param2="", string param3="")
Collection of tests. Provides API for environment preparation.
Definition TestSuite.c:14
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
class TestStep Step
class Test EStage
T3 param3
Definition tuple.c:93
T2 param2
Definition tuple.c:92
Tuple param1