Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/tests/test_scripts.h
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
static void Script_LoadHelperScript(ScriptInterface::CxPrivate* pCxPrivate, const VfsPath& pathname) | static void Script_LoadHelperScript(ScriptInterface::CxPrivate* pCxPrivate, const VfsPath& pathname) | ||||
{ | { | ||||
CComponentManager* componentManager = static_cast<CComponentManager*> (pCxPrivate->pCBData); | CComponentManager* componentManager = static_cast<CComponentManager*> (pCxPrivate->pCBData); | ||||
TS_ASSERT(componentManager->LoadScript(VfsPath(L"simulation/helpers") / pathname)); | TS_ASSERT(componentManager->LoadScript(VfsPath(L"simulation/helpers") / pathname)); | ||||
} | } | ||||
void test_global_scripts() | |||||
Stan: Is that related ? | |||||
{ | |||||
VfsPaths paths; | |||||
TS_ASSERT_OK(vfs::GetPathnames(g_VFS, L"globalscripts/tests/", L"test_*.js", paths)); | |||||
for (const VfsPath& path : paths) | |||||
{ | |||||
CSimContext context; | |||||
CComponentManager componentManager(context, g_ScriptRuntime, true); | |||||
ScriptTestSetup(componentManager.GetScriptInterface()); | |||||
load_script(componentManager.GetScriptInterface(), path); | |||||
} | |||||
} | |||||
void test_scripts() | void test_scripts() | ||||
{ | { | ||||
if (!VfsFileExists(L"simulation/components/tests/setup.js")) | if (!VfsFileExists(L"simulation/components/tests/setup.js")) | ||||
{ | { | ||||
debug_printf("WARNING: Skipping component scripts tests (can't find binaries/data/mods/public/simulation/components/tests/setup.js)\n"); | debug_printf("WARNING: Skipping component scripts tests (can't find binaries/data/mods/public/simulation/components/tests/setup.js)\n"); | ||||
return; | return; | ||||
} | } | ||||
Show All 20 Lines |
Wildfire Games · Phabricator
Is that related ?