Files
EscapistsReintroduced/tests/test_diagnostic_no_splash.py
T
jakub cab998fb64 Combine Workshop addon and fix prison startup
Merge owned systems into one addon while preserving resource identities. Gate player admission on the replicated prison scene, restore the original framed door, and hold enemy AI until escape. Correct scenario branding and author metadata, include publishing assets, and retain regression and native verification evidence.
2026-09-20 16:42:52 +02:00

45 lines
2.1 KiB
Python

"""Execute the actual opt-in Load body; no native engine or GUI is launched."""
from policy_harness import ROOT, body, run
source=ROOT/'addons/core/Scripts/GameLib/ERR/00_Core/ERR_DiagnosticNoSplash.c'
load=body(source,'override void Load()').replace('override void','void').replace('System.','System::').replace('super.Load()', 'Base::Load()')
run('''#include <cassert>
#include <string>
using string=std::string;
struct System {
static bool noSplash, explicitScenario;
static string project;
static bool IsCLIParam(const char*) { return noSplash; }
static bool GetCLIParam(const char*, string& value) {value=project;return explicitScenario;}
};
bool System::noSplash=false; bool System::explicitScenario=false; string System::project;
int diagnostics=0;
void Print(const char*) {diagnostics++;}
struct Base {
int nativeLoads=0, s_iSplashShown=0;
void Load(){nativeLoads++;s_iSplashShown++;}
};
struct Subject:Base {
bool m_ERRDiagnosticSplashSkipped=false;
''' + load + '''
};
int main(){
for(bool flag:{false,true}) for(bool explicitRequest:{false,true})
for(const string& project:{string("core"),string("chat"),string(""),string("other")}) {
System::noSplash=flag;System::explicitScenario=explicitRequest;System::project=project;
diagnostics=0;Subject instance;
instance.Load();instance.Load();instance.Load();
bool selected=flag && explicitRequest && (project=="core" || project=="chat");
assert(instance.nativeLoads==(selected ? 0 : 3));
assert(instance.s_iSplashShown==(selected ? 1 : 3));
assert(diagnostics==(selected ? 1 : 0));
assert(instance.m_ERRDiagnosticSplashSkipped==selected);
}
// Recreated splash instance on addon reload remains independently bounded.
System::noSplash=true;System::explicitScenario=true;System::project="core";
Subject first,reloaded;diagnostics=0;
first.Load();reloaded.Load();reloaded.Load();
assert(first.s_iSplashShown==1 && reloaded.s_iSplashShown==1 && diagnostics==2);
}
''')
print('PASS: actual noSplash Load body requires both explicit diagnostic and noSplash, preserves vanilla otherwise, and handles repeated Load/reload')