GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/* |
||
2 |
* The ManaPlus Client |
||
3 |
* Copyright (C) 2012-2019 The ManaPlus Developers |
||
4 |
* Copyright (C) 2019-2021 Andrei Karas |
||
5 |
* |
||
6 |
* This file is part of The ManaPlus Client. |
||
7 |
* |
||
8 |
* This program is free software; you can redistribute it and/or modify |
||
9 |
* it under the terms of the GNU General Public License as published by |
||
10 |
* the Free Software Foundation; either version 2 of the License, or |
||
11 |
* any later version. |
||
12 |
* |
||
13 |
* This program is distributed in the hope that it will be useful, |
||
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 |
* GNU General Public License for more details. |
||
17 |
* |
||
18 |
* You should have received a copy of the GNU General Public License |
||
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
20 |
*/ |
||
21 |
|||
22 |
#include "unittests/unittests.h" |
||
23 |
|||
24 |
#include "client.h" |
||
25 |
#include "configuration.h" |
||
26 |
#include "configmanager.h" |
||
27 |
#include "dirs.h" |
||
28 |
#include "graphicsmanager.h" |
||
29 |
|||
30 |
#include "being/actorsprite.h" |
||
31 |
|||
32 |
#include "fs/virtfs/fs.h" |
||
33 |
|||
34 |
#include "gui/gui.h" |
||
35 |
|||
36 |
#include "gui/fonts/font.h" |
||
37 |
|||
38 |
#include "gui/widgets/staticbrowserbox.h" |
||
39 |
|||
40 |
#include "utils/delete2.h" |
||
41 |
#include "utils/env.h" |
||
42 |
|||
43 |
#include "render/sdlgraphics.h" |
||
44 |
|||
45 |
#include "resources/sdlimagehelper.h" |
||
46 |
|||
47 |
#include "debug.h" |
||
48 |
|||
49 |
✓✗ | 3 |
TEST_CASE("StaticBrowserBox tests", "browserbox") |
50 |
{ |
||
51 |
1 |
setEnv("SDL_VIDEODRIVER", "dummy"); |
|
52 |
|||
53 |
✓✗ | 1 |
client = new Client; |
54 |
✓✗ | 3 |
VirtFs::mountDirSilent("data", Append_false); |
55 |
✓✗ | 3 |
VirtFs::mountDirSilent("../data", Append_false); |
56 |
|||
57 |
✓✗ | 1 |
mainGraphics = new SDLGraphics; |
58 |
2 |
imageHelper = new SDLImageHelper; |
|
59 |
|||
60 |
1 |
Dirs::initRootDir(); |
|
61 |
1 |
Dirs::initHomeDir(); |
|
62 |
|||
63 |
1 |
ConfigManager::initConfiguration(); |
|
64 |
1 |
setConfigDefaults2(config); |
|
65 |
1 |
setBrandingDefaults(branding); |
|
66 |
|||
67 |
#ifdef USE_SDL2 |
||
68 |
SDLImageHelper::setRenderer(graphicsManager.createRenderer( |
||
69 |
GraphicsManager::createWindow(640, 480, 0, |
||
70 |
SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); |
||
71 |
#else // USE_SDL2 |
||
72 |
|||
73 |
1 |
GraphicsManager::createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); |
|
74 |
#endif // USE_SDL2 |
||
75 |
|||
76 |
✓✗ | 1 |
theme = new Theme; |
77 |
1 |
Theme::selectSkin(); |
|
78 |
|||
79 |
1 |
ActorSprite::load(); |
|
80 |
✓✗ | 1 |
gui = new Gui(); |
81 |
1 |
gui->postInit(mainGraphics); |
|
82 |
|||
83 |
3 |
Widget::setGlobalFont(new Font( |
|
84 |
"fonts/dejavusans.ttf", |
||
85 |
18, |
||
86 |
✓✗✓✗ ✓✗ |
1 |
TTF_STYLE_NORMAL)); |
87 |
StaticBrowserBox *const box = new StaticBrowserBox(nullptr, |
||
88 |
Opaque_true, |
||
89 |
✓✗✓✗ |
3 |
""); |
90 |
1 |
box->setWidth(100); |
|
91 |
3 |
std::string row = "test"; |
|
92 |
✓✗ | 1 |
box->addRow(row, false); |
93 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(box->hasRows() == true); |
94 |
✓✗ | 1 |
box->clearRows(); |
95 |
1 |
row = "@@"; |
|
96 |
✓✗ | 1 |
box->addRow(row, false); |
97 |
1 |
row = "@@|"; |
|
98 |
✓✗ | 1 |
box->addRow(row, false); |
99 |
1 |
row = "|@@"; |
|
100 |
✓✗ | 1 |
box->addRow(row, false); |
101 |
1 |
row = "@@|@@"; |
|
102 |
✓✗ | 1 |
box->addRow(row, false); |
103 |
1 |
row = "|@@@@"; |
|
104 |
✓✗ | 1 |
box->addRow(row, false); |
105 |
1 |
row = "@@11|22@@"; |
|
106 |
✓✗ | 1 |
box->addRow(row, false); |
107 |
1 |
row = "##@@11|22@@"; |
|
108 |
✓✗ | 1 |
box->addRow(row, false); |
109 |
1 |
row = "@@##|22@@"; |
|
110 |
✓✗ | 1 |
box->addRow(row, false); |
111 |
1 |
row = "@@11|##22@@"; |
|
112 |
✓✗ | 1 |
box->addRow(row, false); |
113 |
1 |
row = "@@11|22##@@"; |
|
114 |
✓✗ | 1 |
box->addRow(row, false); |
115 |
1 |
row = "@@11|22@@##"; |
|
116 |
✓✗ | 1 |
box->addRow(row, false); |
117 |
1 |
row = "<##@@11|22@@"; |
|
118 |
✓✗ | 1 |
box->addRow(row, false); |
119 |
1 |
row = "@@<##|22@@"; |
|
120 |
✓✗ | 1 |
box->addRow(row, false); |
121 |
1 |
row = "@@11|<##22@@"; |
|
122 |
✓✗ | 1 |
box->addRow(row, false); |
123 |
1 |
row = "@@11|22<##@@"; |
|
124 |
✓✗ | 1 |
box->addRow(row, false); |
125 |
1 |
row = "@@11|22@@<##"; |
|
126 |
✓✗ | 1 |
box->addRow(row, false); |
127 |
1 |
row = "<##11|22@@"; |
|
128 |
✓✗ | 1 |
box->addRow(row, false); |
129 |
1 |
row = "<##|22@@"; |
|
130 |
✓✗ | 1 |
box->addRow(row, false); |
131 |
1 |
row = "11|<##22@@"; |
|
132 |
✓✗ | 1 |
box->addRow(row, false); |
133 |
1 |
row = "11|22<##@@"; |
|
134 |
✓✗ | 1 |
box->addRow(row, false); |
135 |
1 |
row = "11|22@@<##"; |
|
136 |
✓✗ | 1 |
box->addRow(row, false); |
137 |
1 |
row = "##>@@11|22@@"; |
|
138 |
✓✗ | 1 |
box->addRow(row, false); |
139 |
1 |
row = "@@##>|22@@"; |
|
140 |
✓✗ | 1 |
box->addRow(row, false); |
141 |
1 |
row = "@@11|##>22@@"; |
|
142 |
✓✗ | 1 |
box->addRow(row, false); |
143 |
1 |
row = "@@11|22##>@@"; |
|
144 |
✓✗ | 1 |
box->addRow(row, false); |
145 |
1 |
row = "@@11|22@@##>"; |
|
146 |
✓✗ | 1 |
box->addRow(row, false); |
147 |
1 |
row = "<##11|22##>"; |
|
148 |
✓✗ | 1 |
box->addRow(row, false); |
149 |
1 |
row = "<##|22##>"; |
|
150 |
✓✗ | 1 |
box->addRow(row, false); |
151 |
1 |
row = "11|<##22##>"; |
|
152 |
✓✗ | 1 |
box->addRow(row, false); |
153 |
1 |
row = "11|22<####>"; |
|
154 |
✓✗ | 1 |
box->addRow(row, false); |
155 |
1 |
row = "11|22##><##"; |
|
156 |
✓✗ | 1 |
box->addRow(row, false); |
157 |
1 |
row = "%%@@11|22@@"; |
|
158 |
✓✗ | 1 |
box->addRow(row, false); |
159 |
1 |
row = "%%2@@11|22@@"; |
|
160 |
✓✗ | 1 |
box->addRow(row, false); |
161 |
1 |
row = "<%%11|22@@"; |
|
162 |
✓✗ | 1 |
box->addRow(row, false); |
163 |
1 |
row = "@@%%>|22@@"; |
|
164 |
✓✗ | 1 |
box->addRow(row, false); |
165 |
1 |
row = "<%%|22%%>"; |
|
166 |
✓✗ | 1 |
box->addRow(row, false); |
167 |
1 |
row = "11|22<%%%%>"; |
|
168 |
✓✗ | 1 |
box->addRow(row, false); |
169 |
1 |
row = "%%"; |
|
170 |
✓✗ | 1 |
box->addRow(row, false); |
171 |
1 |
row = "%%1"; |
|
172 |
✓✗ | 1 |
box->addRow(row, false); |
173 |
1 |
row = "%%##"; |
|
174 |
✓✗ | 1 |
box->addRow(row, false); |
175 |
1 |
row = "%%###"; |
|
176 |
✓✗ | 1 |
box->addRow(row, false); |
177 |
1 |
row = "##%%"; |
|
178 |
✓✗ | 1 |
box->addRow(row, false); |
179 |
1 |
row = "##1%%"; |
|
180 |
✓✗ | 1 |
box->addRow(row, false); |
181 |
1 |
row = "##%%2"; |
|
182 |
✓✗ | 1 |
box->addRow(row, false); |
183 |
1 |
row = "##1%%2"; |
|
184 |
✓✗ | 1 |
box->addRow(row, false); |
185 |
|||
186 |
✓✗ | 1 |
delete Widget::getGloablFont(); |
187 |
✓✗ | 1 |
Widget::setGlobalFont(nullptr); |
188 |
✓✗ | 1 |
delete box; |
189 |
✓✗ | 1 |
delete2(client) |
190 |
✓✗✓✗ |
3 |
VirtFs::unmountDirSilent("data"); |
191 |
✓✗✓✗ |
4 |
VirtFs::unmountDirSilent("../data"); |
192 |
✓✗✓✗ |
4 |
} |
Generated by: GCOVR (Version 3.3) |