The Battle for Wesnoth  1.19.17+dev
fake_display.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2025
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 "events.hpp"
21 #include "video.hpp"
22 
23 namespace test_utils
24 {
25 namespace
26 {
27 class context_manager
28 {
29 public:
30  context_manager()
31  {
33  }
34 
35 private:
37 };
38 
39 } // namespace
40 
41 void set_test_resolution(const int width, const int height)
42 {
43  // Single object for the lifetime of the unit tests.
44  static const context_manager main_event_context;
45 
46  if(width >= 0 && height >= 0) {
47  video::set_resolution({width, height});
48  }
49 }
50 
51 } // namespace test_utils
const events::event_context main_event_context_
void set_test_resolution(const int width, const int height)
Sets the dummy display resolution for use by the tests.
void init(fake type)
Initialize the video subsystem.
Definition: video.cpp:90
bool set_resolution(const point &resolution)
Set the window resolution.
Definition: video.cpp:838