Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/test_setup.cpp
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2020 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 All 22 Lines | |||||
#if OS_WIN | #if OS_WIN | ||||
#include "lib/sysdep/os/win/wdbg_heap.h" | #include "lib/sysdep/os/win/wdbg_heap.h" | ||||
#endif | #endif | ||||
#include "lib/timer.h" | #include "lib/timer.h" | ||||
#include "lib/sysdep/sysdep.h" | #include "lib/sysdep/sysdep.h" | ||||
#include "ps/Profiler2.h" | #include "ps/Profiler2.h" | ||||
#include "scriptinterface/ScriptEngine.h" | #include "scriptinterface/ScriptEngine.h" | ||||
#include "scriptinterface/ScriptInterface.h" | #include "scriptinterface/ScriptRuntime.h" | ||||
class LeakReporter : public CxxTest::GlobalFixture | class LeakReporter : public CxxTest::GlobalFixture | ||||
{ | { | ||||
virtual bool tearDownWorld() | virtual bool tearDownWorld() | ||||
{ | { | ||||
// Enable leak reporting on exit. | // Enable leak reporting on exit. | ||||
// (This is done in tearDownWorld so that it doesn't report 'leaks' | // (This is done in tearDownWorld so that it doesn't report 'leaks' | ||||
// if the program is aborted before finishing cleanly.) | // if the program is aborted before finishing cleanly.) | ||||
Show All 26 Lines | #if OS_MACOSX || OS_BSD | ||||
// See comment in GameSetup.cpp FixLocales | // See comment in GameSetup.cpp FixLocales | ||||
setlocale(LC_CTYPE, "UTF-8"); | setlocale(LC_CTYPE, "UTF-8"); | ||||
#endif | #endif | ||||
ThreadUtil::SetMainThread(); | ThreadUtil::SetMainThread(); | ||||
g_Profiler2.Initialise(); | g_Profiler2.Initialise(); | ||||
m_ScriptEngine = new ScriptEngine; | m_ScriptEngine = new ScriptEngine; | ||||
g_ScriptRuntime = ScriptInterface::CreateRuntime(); | g_ScriptRuntime = ScriptRuntime::CreateRuntime(); | ||||
return true; | return true; | ||||
} | } | ||||
virtual bool tearDownWorld() | virtual bool tearDownWorld() | ||||
{ | { | ||||
g_ScriptRuntime.reset(); | g_ScriptRuntime.reset(); | ||||
SAFE_DELETE(m_ScriptEngine); | SAFE_DELETE(m_ScriptEngine); | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator