OpenTTD Source  20241108-master-g80f628063a
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 <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef MOCK_ENVIRONMENT_H
11 #define MOCK_ENVIRONMENT_H
12 
13 #include "mock_fontcache.h"
14 #include "mock_spritecache.h"
15 
18 public:
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 
28 private:
30  {
31  /* Mock SpriteCache initialization is needed for some widget generators. */
32  MockGfxLoadSprites();
33 
34  /* Mock FontCache initialization is needed for some NWidgetParts. */
35  MockFontCache::InitializeFontCaches();
36  }
37 };
38 
39 #endif /* MOCK_ENVIRONMENT_H */
Singleton class to set up the mock environemnt once.
Mock font cache implementation definition.
Mock sprite cache definition.