The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fake_display.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Pauli Nieminen <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-test"
16 
17 #include "fake_display.hpp"
18 
19 #include "game_board.hpp"
20 #include "game_display.hpp"
21 #include "terrain/type_data.hpp"
22 #include "tod_manager.hpp"
23 #include "reports.hpp"
24 
25 #include <boost/make_shared.hpp>
26 
27 namespace wb {
28  class manager;
29 }
30 
31 namespace test_utils {
32 
35 
43 
44 
46 
47  public:
50 
52 // ~fake_display_manager();
53  };
54 
56 
58  {
59  if (!manager_)
60  {
62  }
63  return manager_;
64  }
65 
67  video_(CVideo::FAKE_TEST),
68  dummy_cfg_(),
69  dummy_cfg2_(),
70  dummy_board_(boost::make_shared<terrain_type_data>(dummy_cfg_), dummy_cfg2_),
71  dummy_tod_(dummy_cfg_),
72  main_event_context_(),
73  disp_(dummy_board_, video_, boost::shared_ptr<wb::manager> (), dummy_reports, dummy_tod_,
74  dummy_cfg_, dummy_cfg_)
75  {
76  }
77 
79  {
80  return disp_;
81  }
82 
83  game_display& get_fake_display(const int width, const int height)
84  {
87 
88  if(width >= 0 && height >= 0) {
89  display.video().make_test_fake(width, height);
90  }
91 
92  return display;
93  }
94 
95 
96 }
Game board class.
Definition: game_board.hpp:55
Definition: video.hpp:58
game_display & get_fake_display(const int width, const int height)
Gets a fake test display.
static fake_display_manager * get_manager()
Unit and team statistics.
static fake_display_manager * manager_
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1220
display & disp_
Definition: dialogs.cpp:98
CVideo & video()
Gets the underlying screen object.
Definition: display.hpp:202
void make_test_fake(const unsigned width=1024, const unsigned height=768, const unsigned bpp=DefaultBpp)
Creates a fake frame buffer for the unit tests.
Definition: video.cpp:362
GLint GLint GLint GLint GLint GLint GLsizei width
Definition: glew.h:1220
const events::event_context main_event_context_
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
Definition: display.hpp:47