OpenTTD Source 20260206-master-g4d4e37dbf1
mock_environment.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef MOCK_ENVIRONMENT_H
11#define MOCK_ENVIRONMENT_H
12
13#include "mock_fontcache.h"
14#include "mock_spritecache.h"
15
17class MockEnvironment {
18public:
19 static MockEnvironment &Instance()
20 {
21 static MockEnvironment instance;
22 return instance;
23 }
24
25 MockEnvironment(MockEnvironment const &) = delete;
26 void operator=(MockEnvironment const &) = delete;
27
28private:
29 MockEnvironment()
30 {
31 /* Mock SpriteCache initialization is needed for some widget generators. */
32 MockGfxLoadSprites();
33
34 /* Mock FontCache initialization is needed for some NWidgetParts. */
36 }
37};
38
39#endif /* MOCK_ENVIRONMENT_H */
static void InitializeFontCaches()
Initialise font caches with the base sprite font cache for all sizes.
Definition fontcache.cpp:98
Mock font cache implementation definition.
Mock sprite cache definition.