The Battle for Wesnoth  1.19.7+dev
fake_display.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2024
3  by Pauli Nieminen <paniemin@cc.hut.fi>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #define GETTEXT_DOMAIN "wesnoth-test"
17 
19 
20 #include "game_board.hpp"
21 #include "game_config_view.hpp"
22 #include "game_display.hpp"
23 #include "reports.hpp"
24 #include "video.hpp"
25 
26 namespace wb
27 {
28 class manager;
29 }
30 
31 namespace test_utils
32 {
34 {
36 
42 
44 
45 public:
48 
50  // ~fake_display_manager();
51 };
52 
54 
56 {
57  if(!manager_) {
59  }
60 
61  return manager_;
62 }
63 
65  : dummy_cfg_()
66  , dummy_cfg2_()
67  , dummy_board_(dummy_cfg2_)
68  , main_event_context_()
69  , disp_(dummy_board_, std::shared_ptr<wb::manager>(), dummy_reports, "", dummy_cfg_)
70 {
72 }
73 
75 {
76  return disp_;
77 }
78 
79 game_display& get_fake_display(const int width, const int height)
80 {
82 
83  if(width >= 0 && height >= 0) {
84  video::set_resolution({width, height});
85  }
86 
87  return display;
88 }
89 
90 } // namespace test_utils
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:172
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Definition: display.hpp:97
Game board class.
Definition: game_board.hpp:47
static fake_display_manager * get_manager()
static fake_display_manager * manager_
const events::event_context main_event_context_
Unit and team statistics.
game_display & get_fake_display(const int width, const int height)
Gets a fake test display.
void init(fake type)
Initialize the video subsystem.
Definition: video.cpp:81
bool set_resolution(const point &resolution)
Set the window resolution.
Definition: video.cpp:808
Definition: display.hpp:45