GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/* |
||
2 |
* The ManaPlus Client |
||
3 |
* Copyright (C) 2016-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 "configmanager.h" |
||
25 |
#include "configuration.h" |
||
26 |
#include "dirs.h" |
||
27 |
#include "graphicsmanager.h" |
||
28 |
|||
29 |
#include "being/localplayer.h" |
||
30 |
|||
31 |
#include "fs/virtfs/fs.h" |
||
32 |
|||
33 |
#include "gui/theme.h" |
||
34 |
|||
35 |
#include "unittests/render/mockgraphics.h" |
||
36 |
|||
37 |
#include "utils/delete2.h" |
||
38 |
#include "utils/env.h" |
||
39 |
|||
40 |
#include "resources/resourcemanager/resourcemanager.h" |
||
41 |
|||
42 |
#include "resources/sdlimagehelper.h" |
||
43 |
|||
44 |
#include "resources/image/image.h" |
||
45 |
|||
46 |
#include "resources/map/map.h" |
||
47 |
#include "resources/map/maplayer.h" |
||
48 |
|||
49 |
#include "debug.h" |
||
50 |
|||
51 |
✓✗ | 10 |
TEST_CASE("MapLayer drawFringe simple", "") |
52 |
{ |
||
53 |
8 |
setEnv("SDL_VIDEODRIVER", "dummy"); |
|
54 |
|||
55 |
✓✗ | 24 |
VirtFs::mountDirSilent("data", Append_false); |
56 |
✓✗ | 24 |
VirtFs::mountDirSilent("../data", Append_false); |
57 |
|||
58 |
16 |
imageHelper = new SDLImageHelper; |
|
59 |
|||
60 |
8 |
Dirs::initRootDir(); |
|
61 |
8 |
Dirs::initHomeDir(); |
|
62 |
|||
63 |
8 |
setBrandingDefaults(branding); |
|
64 |
8 |
ConfigManager::initConfiguration(); |
|
65 |
|||
66 |
#ifdef USE_SDL2 |
||
67 |
SDLImageHelper::setRenderer(graphicsManager.createRenderer( |
||
68 |
GraphicsManager::createWindow(640, 480, 0, |
||
69 |
SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); |
||
70 |
#else // USE_SDL2 |
||
71 |
|||
72 |
8 |
GraphicsManager::createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); |
|
73 |
#endif // USE_SDL2 |
||
74 |
|||
75 |
✓✗ | 8 |
theme = new Theme; |
76 |
8 |
Theme::selectSkin(); |
|
77 |
|||
78 |
8 |
localPlayer = new LocalPlayer(static_cast<BeingId>(1), |
|
79 |
✓✗ | 8 |
BeingTypeId_zero); |
80 |
|||
81 |
✓✗ | 8 |
Image *const img1 = new Image(32, 32); |
82 |
✓✗ | 8 |
Image *const img2 = new Image(32, 32); |
83 |
✓✗ | 8 |
Image *const img3 = new Image(32, 32); |
84 |
8 |
Map *map = nullptr; |
|
85 |
8 |
MapLayer *layer = nullptr; |
|
86 |
✓✗ | 8 |
MockGraphics *const mock = new MockGraphics; |
87 |
16 |
const Actors actors; |
|
88 |
|||
89 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 1") |
90 |
{ |
||
91 |
1 |
map = new Map("map", |
|
92 |
1, 1, |
||
93 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
94 |
1 |
layer = new MapLayer("test", |
|
95 |
0, 0, |
||
96 |
1, 1, |
||
97 |
true, |
||
98 |
0, |
||
99 |
✓✗✓✗ ✓✗ |
3 |
0); |
100 |
2 |
layer->setTile(0, 0, img1); |
|
101 |
✓✗ | 1 |
map->addLayer(layer); |
102 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
103 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
104 |
✓✗ | 1 |
layer->updateCache(1, 1); |
105 |
|||
106 |
layer->drawFringe(mock, |
||
107 |
0, 0, |
||
108 |
1, 1, |
||
109 |
0, 0, |
||
110 |
✓✗ | 1 |
actors); |
111 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
112 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
113 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
114 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
115 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
116 |
|||
117 |
2 |
mock->mDraws.clear(); |
|
118 |
layer->drawFringe(mock, |
||
119 |
0, 0, |
||
120 |
1, 1, |
||
121 |
10, 5, |
||
122 |
✓✗ | 1 |
actors); |
123 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
124 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
125 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
126 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -5); |
127 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
128 |
|||
129 |
2 |
mock->mDraws.clear(); |
|
130 |
layer->drawFringe(mock, |
||
131 |
0, 0, |
||
132 |
1, 1, |
||
133 |
-10, -5, |
||
134 |
✓✗ | 1 |
actors); |
135 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
136 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
137 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
138 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 5); |
139 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
140 |
} |
||
141 |
|||
142 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 2") |
143 |
{ |
||
144 |
1 |
map = new Map("map", |
|
145 |
2, 1, |
||
146 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
147 |
1 |
layer = new MapLayer("test", |
|
148 |
0, 0, |
||
149 |
2, 1, |
||
150 |
true, |
||
151 |
0, |
||
152 |
✓✗✓✗ ✓✗ |
3 |
0); |
153 |
2 |
layer->setTile(0, 0, img1); |
|
154 |
✓✗ | 1 |
map->addLayer(layer); |
155 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
156 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
157 |
✓✗ | 1 |
layer->updateCache(2, 1); |
158 |
|||
159 |
layer->drawFringe(mock, |
||
160 |
0, 0, |
||
161 |
2, 1, |
||
162 |
0, 0, |
||
163 |
✓✗ | 1 |
actors); |
164 |
|||
165 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
166 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
167 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
168 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
169 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
170 |
|||
171 |
2 |
mock->mDraws.clear(); |
|
172 |
layer->drawFringe(mock, |
||
173 |
0, 0, |
||
174 |
2, 1, |
||
175 |
10, 5, |
||
176 |
✓✗ | 1 |
actors); |
177 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
178 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
179 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
180 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -5); |
181 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
182 |
|||
183 |
2 |
mock->mDraws.clear(); |
|
184 |
layer->drawFringe(mock, |
||
185 |
0, 0, |
||
186 |
2, 1, |
||
187 |
-10, -5, |
||
188 |
✓✗ | 1 |
actors); |
189 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
190 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
191 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
192 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 5); |
193 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
194 |
} |
||
195 |
|||
196 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 3") |
197 |
{ |
||
198 |
1 |
map = new Map("map", |
|
199 |
2, 1, |
||
200 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
201 |
1 |
layer = new MapLayer("test", |
|
202 |
0, 0, |
||
203 |
2, 1, |
||
204 |
true, |
||
205 |
0, |
||
206 |
✓✗✓✗ ✓✗ |
3 |
0); |
207 |
2 |
layer->setTile(0, 0, img1); |
|
208 |
2 |
layer->setTile(1, 0, img2); |
|
209 |
✓✗ | 1 |
map->addLayer(layer); |
210 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
211 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
212 |
✓✗ | 1 |
layer->updateCache(2, 1); |
213 |
|||
214 |
layer->drawFringe(mock, |
||
215 |
0, 0, |
||
216 |
2, 1, |
||
217 |
0, 0, |
||
218 |
✓✗ | 1 |
actors); |
219 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
220 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
221 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
222 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
223 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
224 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
225 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 32); |
226 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
227 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
228 |
|||
229 |
2 |
mock->mDraws.clear(); |
|
230 |
layer->drawFringe(mock, |
||
231 |
0, 0, |
||
232 |
2, 1, |
||
233 |
-10, -20, |
||
234 |
✓✗ | 1 |
actors); |
235 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
236 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
237 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
238 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 20); |
239 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
240 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
241 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 42); |
242 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 20); |
243 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
244 |
} |
||
245 |
|||
246 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 4") |
247 |
{ |
||
248 |
1 |
map = new Map("map", |
|
249 |
2, 1, |
||
250 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
251 |
1 |
layer = new MapLayer("test", |
|
252 |
0, 0, |
||
253 |
2, 1, |
||
254 |
true, |
||
255 |
0, |
||
256 |
✓✗✓✗ ✓✗ |
3 |
0); |
257 |
2 |
layer->setTile(0, 0, img1); |
|
258 |
2 |
layer->setTile(1, 0, img1); |
|
259 |
✓✗ | 1 |
map->addLayer(layer); |
260 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
261 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
262 |
✓✗ | 1 |
layer->updateCache(2, 1); |
263 |
|||
264 |
layer->drawFringe(mock, |
||
265 |
0, 0, |
||
266 |
2, 1, |
||
267 |
0, 0, |
||
268 |
✓✗ | 1 |
actors); |
269 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
270 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
271 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
272 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
273 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
274 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
275 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
276 |
|||
277 |
2 |
mock->mDraws.clear(); |
|
278 |
layer->drawFringe(mock, |
||
279 |
0, 0, |
||
280 |
2, 1, |
||
281 |
-10, 20, |
||
282 |
✓✗ | 1 |
actors); |
283 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
284 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
285 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
286 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
287 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
288 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
289 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
290 |
} |
||
291 |
|||
292 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 4.2") |
293 |
{ |
||
294 |
1 |
map = new Map("map", |
|
295 |
3, 1, |
||
296 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
297 |
1 |
layer = new MapLayer("test", |
|
298 |
0, 0, |
||
299 |
3, 1, |
||
300 |
true, |
||
301 |
0, |
||
302 |
✓✗✓✗ ✓✗ |
3 |
0); |
303 |
2 |
layer->setTile(0, 0, img1); |
|
304 |
2 |
layer->setTile(2, 0, img1); |
|
305 |
✓✗ | 1 |
map->addLayer(layer); |
306 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
307 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
308 |
✓✗ | 1 |
layer->updateCache(3, 1); |
309 |
|||
310 |
layer->drawFringe(mock, |
||
311 |
0, 0, |
||
312 |
3, 1, |
||
313 |
0, 0, |
||
314 |
✓✗ | 1 |
actors); |
315 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
316 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
317 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
318 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
319 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
320 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
321 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 64); |
322 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
323 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img1); |
324 |
|||
325 |
2 |
mock->mDraws.clear(); |
|
326 |
layer->drawFringe(mock, |
||
327 |
0, 0, |
||
328 |
3, 1, |
||
329 |
10, -20, |
||
330 |
✓✗ | 1 |
actors); |
331 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
332 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
333 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
334 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 20); |
335 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
336 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
337 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 54); |
338 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 20); |
339 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img1); |
340 |
} |
||
341 |
|||
342 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 5") |
343 |
{ |
||
344 |
1 |
map = new Map("map", |
|
345 |
3, 1, |
||
346 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
347 |
1 |
layer = new MapLayer("test", |
|
348 |
0, 0, |
||
349 |
3, 1, |
||
350 |
true, |
||
351 |
0, |
||
352 |
✓✗✓✗ ✓✗ |
3 |
0); |
353 |
2 |
layer->setTile(0, 0, img1); |
|
354 |
2 |
layer->setTile(1, 0, img1); |
|
355 |
✓✗ | 1 |
map->addLayer(layer); |
356 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
357 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
358 |
✓✗ | 1 |
layer->updateCache(3, 1); |
359 |
|||
360 |
layer->drawFringe(mock, |
||
361 |
0, 0, |
||
362 |
3, 1, |
||
363 |
0, 0, |
||
364 |
✓✗ | 1 |
actors); |
365 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
366 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
367 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
368 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
369 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
370 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
371 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
372 |
|||
373 |
2 |
mock->mDraws.clear(); |
|
374 |
layer->drawFringe(mock, |
||
375 |
0, 0, |
||
376 |
3, 1, |
||
377 |
-10, 20, |
||
378 |
✓✗ | 1 |
actors); |
379 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
380 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
381 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
382 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
383 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
384 |
✓✗✓✗ ✓✗✓✗ ✓✗ |
3 |
REQUIRE(mock->mDraws[0].height == 32); |
385 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
386 |
} |
||
387 |
|||
388 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 6") |
389 |
{ |
||
390 |
1 |
map = new Map("map", |
|
391 |
3, 1, |
||
392 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
393 |
1 |
layer = new MapLayer("test", |
|
394 |
0, 0, |
||
395 |
3, 1, |
||
396 |
true, |
||
397 |
0, |
||
398 |
✓✗✓✗ ✓✗ |
3 |
0); |
399 |
2 |
layer->setTile(0, 0, img1); |
|
400 |
2 |
layer->setTile(1, 0, img1); |
|
401 |
2 |
layer->setTile(2, 0, img2); |
|
402 |
✓✗ | 1 |
map->addLayer(layer); |
403 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
404 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
405 |
✓✗ | 1 |
layer->updateCache(3, 1); |
406 |
|||
407 |
layer->drawFringe(mock, |
||
408 |
0, 0, |
||
409 |
3, 1, |
||
410 |
0, 0, |
||
411 |
✓✗ | 1 |
actors); |
412 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
413 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
414 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
415 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
416 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
417 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
418 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
419 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
420 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 64); |
421 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
422 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
423 |
|||
424 |
2 |
mock->mDraws.clear(); |
|
425 |
layer->drawFringe(mock, |
||
426 |
0, 0, |
||
427 |
3, 1, |
||
428 |
-10, 20, |
||
429 |
✓✗ | 1 |
actors); |
430 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
431 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
432 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
433 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
434 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
435 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
436 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
437 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
438 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 74); |
439 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == -20); |
440 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
441 |
} |
||
442 |
|||
443 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
56 |
SECTION("simple 7") |
444 |
{ |
||
445 |
1 |
map = new Map("map", |
|
446 |
3, 1, |
||
447 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
448 |
1 |
layer = new MapLayer("test", |
|
449 |
0, 0, |
||
450 |
3, 1, |
||
451 |
true, |
||
452 |
0, |
||
453 |
✓✗✓✗ ✓✗ |
3 |
0); |
454 |
2 |
layer->setTile(0, 0, img1); |
|
455 |
2 |
layer->setTile(1, 0, img1); |
|
456 |
2 |
layer->setTile(2, 0, img2); |
|
457 |
✓✗ | 1 |
map->addLayer(layer); |
458 |
2 |
layer->setSpecialLayer(map->getSpecialLayer()); |
|
459 |
2 |
layer->setTempLayer(map->getTempLayer()); |
|
460 |
1 |
TileInfo *const tiles = layer->getTiles(); |
|
461 |
1 |
tiles[0].isEnabled = false; |
|
462 |
✓✗ | 1 |
layer->updateCache(3, 1); |
463 |
|||
464 |
layer->drawFringe(mock, |
||
465 |
0, 0, |
||
466 |
3, 1, |
||
467 |
0, 0, |
||
468 |
✓✗ | 1 |
actors); |
469 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
470 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
471 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32); |
472 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
473 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
474 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
475 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 64); |
476 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
477 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
478 |
|||
479 |
2 |
mock->mDraws.clear(); |
|
480 |
layer->drawFringe(mock, |
||
481 |
0, 0, |
||
482 |
3, 1, |
||
483 |
-10, 20, |
||
484 |
✓✗ | 1 |
actors); |
485 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
486 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
487 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 42); |
488 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
489 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
490 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
491 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 74); |
492 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == -20); |
493 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
494 |
} |
||
495 |
|||
496 |
✓✗ | 8 |
delete2(localPlayer) |
497 |
✓✗ | 8 |
delete map; |
498 |
✓✗ | 8 |
delete img1; |
499 |
✓✗ | 8 |
delete img2; |
500 |
✓✗ | 8 |
delete img3; |
501 |
✓✗ | 8 |
delete mock; |
502 |
✓✗ | 8 |
delete2(theme) |
503 |
✓✗ | 8 |
GraphicsManager::deleteRenderers(); |
504 |
✓✗ | 8 |
ResourceManager::cleanOrphans(true); |
505 |
✓✗ | 8 |
ResourceManager::deleteInstance(); |
506 |
✓✗✓✗ |
24 |
VirtFs::unmountDirSilent("data"); |
507 |
✓✗✓✗ |
32 |
VirtFs::unmountDirSilent("../data"); |
508 |
✓✗✓✗ |
11 |
} |
Generated by: GCOVR (Version 3.3) |