GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/unittests/resources/map/maplayer/drawfringenormal.cc Lines: 376 376 100.0 %
Date: 2021-03-17 Branches: 1194 3248 36.8 %

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 "enums/resources/map/mapitemtype.h"
32
33
#include "fs/virtfs/fs.h"
34
35
#include "gui/theme.h"
36
37
#include "unittests/render/mockgraphics.h"
38
39
#include "utils/delete2.h"
40
#include "utils/env.h"
41
42
#include "resources/resourcemanager/resourcemanager.h"
43
44
#include "resources/sdlimagehelper.h"
45
46
#include "resources/image/image.h"
47
48
#include "resources/map/map.h"
49
#include "resources/map/maplayer.h"
50
#include "resources/map/speciallayer.h"
51
52
#include "debug.h"
53
54
6
TEST_CASE("MapLayer drawFringe normal", "")
55
{
56
4
    setEnv("SDL_VIDEODRIVER", "dummy");
57
58
12
    VirtFs::mountDirSilent("data", Append_false);
59
12
    VirtFs::mountDirSilent("../data", Append_false);
60
61
8
    imageHelper = new SDLImageHelper;
62
63
4
    Dirs::initRootDir();
64
4
    Dirs::initHomeDir();
65
66
4
    setBrandingDefaults(branding);
67
4
    ConfigManager::initConfiguration();
68
69
#ifdef USE_SDL2
70
    SDLImageHelper::setRenderer(graphicsManager.createRenderer(
71
        GraphicsManager::createWindow(640, 480, 0,
72
        SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE));
73
#else  // USE_SDL2
74
75
4
    GraphicsManager::createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
76
#endif  // USE_SDL2
77
78
4
    theme = new Theme;
79
4
    Theme::selectSkin();
80
81
4
    localPlayer = new LocalPlayer(static_cast<BeingId>(1),
82
4
        BeingTypeId_zero);
83
84
4
    Image *const img1 = new Image(32, 32);
85
4
    Image *const img2 = new Image(32, 32);
86
4
    Image *const img3 = new Image(32, 32);
87
4
    Map *map = nullptr;
88
4
    MapLayer *layer = nullptr;
89
4
    MockGraphics *const mock = new MockGraphics;
90
8
    const Actors actors;
91
92



28
    SECTION("normal 1")
93
    {
94
1
        const int maxX = 100;
95
1
        const int maxY = 100;
96
1
        map = new Map("map",
97
            maxX, maxY,
98

3
            32, 32);
99
1
        layer = new MapLayer("test",
100
            0, 0,
101
            maxX, maxY,
102
            true,
103
            0,
104

3
            0);
105
2
        layer->setTile(1, 10, img1);
106
2
        layer->setTile(2, 10, img1);
107
2
        layer->setTile(3, 10, img1);
108
2
        layer->setTile(4, 10, img2);
109
2
        layer->setTile(5, 10, nullptr);
110
2
        layer->setTile(6, 10, img2);
111
2
        layer->setTile(7, 10, nullptr);
112
2
        layer->setTile(8, 10, nullptr);
113
2
        layer->setTile(9, 10, img2);
114
2
        layer->setTile(10, 10, img2);
115
2
        layer->setTile(11, 10, img3);
116
2
        layer->setTile(12, 10, nullptr);
117
2
        layer->setTile(13, 10, nullptr);
118
2
        layer->setTile(14, 10, nullptr);
119
2
        layer->setTile(15, 10, img1);
120
2
        layer->setTile(16, 10, img1);
121
2
        layer->setTile(17, 10, img1);
122
1
        map->addLayer(layer);
123
2
        layer->setSpecialLayer(map->getSpecialLayer());
124
2
        layer->setTempLayer(map->getTempLayer());
125
1
        layer->updateCache(maxX, maxY);
126
127
        layer->drawFringe(mock,
128
            0, 0,
129
            maxX, maxY,
130
            0, 0,
131
1
            actors);
132



5
        REQUIRE(mock->mDraws.size() == 6);
133



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern);
134



4
        REQUIRE(mock->mDraws[0].x == 32 * 1);
135



4
        REQUIRE(mock->mDraws[0].y == 32 * 10);
136



4
        REQUIRE(mock->mDraws[0].width == 96);
137



4
        REQUIRE(mock->mDraws[0].height == 32);
138



4
        REQUIRE(mock->mDraws[0].image == img1);
139



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage);
140



4
        REQUIRE(mock->mDraws[1].x == 32 * 4);
141



4
        REQUIRE(mock->mDraws[1].y == 32 * 10);
142



4
        REQUIRE(mock->mDraws[1].image == img2);
143



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
144



4
        REQUIRE(mock->mDraws[2].x == 32 * 6);
145



4
        REQUIRE(mock->mDraws[2].y == 32 * 10);
146



4
        REQUIRE(mock->mDraws[2].image == img2);
147



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawPattern);
148



4
        REQUIRE(mock->mDraws[3].x == 32 * 9);
149



4
        REQUIRE(mock->mDraws[3].y == 32 * 10);
150



4
        REQUIRE(mock->mDraws[3].width == 64);
151



4
        REQUIRE(mock->mDraws[3].height == 32);
152



4
        REQUIRE(mock->mDraws[3].image == img2);
153



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawImage);
154



4
        REQUIRE(mock->mDraws[4].x == 32 * 11);
155



4
        REQUIRE(mock->mDraws[4].y == 32 * 10);
156



4
        REQUIRE(mock->mDraws[4].image == img3);
157



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawPattern);
158



4
        REQUIRE(mock->mDraws[5].x == 32 * 15);
159



4
        REQUIRE(mock->mDraws[5].y == 32 * 10);
160



4
        REQUIRE(mock->mDraws[5].width == 96);
161



4
        REQUIRE(mock->mDraws[5].height == 32);
162



4
        REQUIRE(mock->mDraws[5].image == img1);
163
164
2
        mock->mDraws.clear();
165
        layer->drawFringe(mock,
166
            0, 0,
167
            maxX, maxY,
168
            -10, 20,
169
1
            actors);
170



5
        REQUIRE(mock->mDraws.size() == 6);
171



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern);
172



4
        REQUIRE(mock->mDraws[0].x == 32 * 1 + 10);
173



4
        REQUIRE(mock->mDraws[0].y == 32 * 10 - 20);
174



4
        REQUIRE(mock->mDraws[0].width == 96);
175



4
        REQUIRE(mock->mDraws[0].height == 32);
176



4
        REQUIRE(mock->mDraws[0].image == img1);
177



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage);
178



4
        REQUIRE(mock->mDraws[1].x == 32 * 4 + 10);
179



4
        REQUIRE(mock->mDraws[1].y == 32 * 10 - 20);
180



4
        REQUIRE(mock->mDraws[1].image == img2);
181



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
182



4
        REQUIRE(mock->mDraws[2].x == 32 * 6 + 10);
183



4
        REQUIRE(mock->mDraws[2].y == 32 * 10 - 20);
184



4
        REQUIRE(mock->mDraws[2].image == img2);
185



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawPattern);
186



4
        REQUIRE(mock->mDraws[3].x == 32 * 9 + 10);
187



4
        REQUIRE(mock->mDraws[3].y == 32 * 10 - 20);
188



4
        REQUIRE(mock->mDraws[3].width == 64);
189



4
        REQUIRE(mock->mDraws[3].height == 32);
190



4
        REQUIRE(mock->mDraws[3].image == img2);
191



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawImage);
192



4
        REQUIRE(mock->mDraws[4].x == 32 * 11 + 10);
193



4
        REQUIRE(mock->mDraws[4].y == 32 * 10 - 20);
194



4
        REQUIRE(mock->mDraws[4].image == img3);
195



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawPattern);
196



4
        REQUIRE(mock->mDraws[5].x == 32 * 15 + 10);
197



4
        REQUIRE(mock->mDraws[5].y == 32 * 10 - 20);
198



4
        REQUIRE(mock->mDraws[5].width == 96);
199



4
        REQUIRE(mock->mDraws[5].height == 32);
200



4
        REQUIRE(mock->mDraws[5].image == img1);
201
    }
202
203



28
    SECTION("normal2")
204
    {
205
1
        const int maxX = 100;
206
1
        const int maxY = 100;
207
1
        map = new Map("map",
208
            maxX, maxY,
209

3
            32, 32);
210
1
        layer = new MapLayer("test",
211
            0, 0,
212
            maxX, maxY,
213
            true,
214
            0,
215

3
            0);
216
1
        TileInfo *const tiles = layer->getTiles();
217
1
        map->addLayer(layer);
218
2
        layer->setSpecialLayer(map->getSpecialLayer());
219
2
        layer->setTempLayer(map->getTempLayer());
220
101
        for (int x = 0; x < maxX; x ++)
221
        {
222
20100
            for (int y = 0; y < maxY; y ++)
223
            {
224
20000
                layer->setTile(x, y, img1);
225
10000
                tiles[y * maxX + x].isEnabled = false;
226
            }
227
        }
228
1
        tiles[10 * maxX + 41].isEnabled = true;
229
1
        layer->updateCache(maxX, maxY);
230
231
        layer->drawFringe(mock,
232
            0, 0,
233
            maxX, maxY,
234
            0, 0,
235
1
            actors);
236



5
        REQUIRE(mock->mDraws.size() == 1);
237



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage);
238



4
        REQUIRE(mock->mDraws[0].x == 32 * 41);
239



4
        REQUIRE(mock->mDraws[0].y == 32 * 10);
240
241
2
        mock->mDraws.clear();
242
        layer->drawFringe(mock,
243
            0, 0,
244
            maxX, maxY,
245
            -10, 20,
246
1
            actors);
247



5
        REQUIRE(mock->mDraws.size() == 1);
248



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage);
249



4
        REQUIRE(mock->mDraws[0].x == 32 * 41 + 10);
250



4
        REQUIRE(mock->mDraws[0].y == 32 * 10 - 20);
251
    }
252
253



28
    SECTION("normal 3")
254
    {
255
1
        const int maxX = 100;
256
1
        const int maxY = 100;
257
1
        map = new Map("map",
258
            maxX, maxY,
259

3
            32, 32);
260
1
        layer = new MapLayer("test",
261
            0, 0,
262
            maxX, maxY,
263
            true,
264
            0,
265

3
            0);
266
2
        layer->setTile(1, 10, img1);
267
2
        layer->setTile(2, 10, img1);
268
2
        layer->setTile(3, 10, img1);
269
2
        layer->setTile(4, 10, img2);
270
2
        layer->setTile(5, 10, nullptr);
271
2
        layer->setTile(6, 10, img2);
272
2
        layer->setTile(7, 10, nullptr);
273
2
        layer->setTile(8, 10, nullptr);
274
2
        layer->setTile(9, 10, img2);
275
2
        layer->setTile(10, 10, img2);
276
2
        layer->setTile(11, 10, img3);
277
2
        layer->setTile(12, 10, nullptr);
278
2
        layer->setTile(13, 10, nullptr);
279
2
        layer->setTile(14, 10, nullptr);
280
2
        layer->setTile(15, 10, img1);
281
2
        layer->setTile(16, 10, img1);
282
2
        layer->setTile(17, 10, img1);
283
1
        map->addLayer(layer);
284
1
        SpecialLayer *const specialLayer = map->getSpecialLayer();
285
1
        SpecialLayer *const tempLayer = map->getTempLayer();
286
2
        layer->setSpecialLayer(specialLayer);
287
2
        layer->setTempLayer(tempLayer);
288
1
        specialLayer->setTile(1, 10, MapItemType::ARROW_UP);
289
1
        specialLayer->setTile(10, 10, MapItemType::ARROW_DOWN);
290
1
        specialLayer->updateCache();
291
1
        layer->updateCache(maxX, maxY);
292
293
        layer->drawFringe(mock,
294
            0, 0,
295
            maxX, maxY,
296
            0, 0,
297
1
            actors);
298



5
        REQUIRE(mock->mDraws.size() == 8);
299



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern);
300



4
        REQUIRE(mock->mDraws[0].x == 32 * 1);
301



4
        REQUIRE(mock->mDraws[0].y == 32 * 10);
302



4
        REQUIRE(mock->mDraws[0].width == 96);
303



4
        REQUIRE(mock->mDraws[0].height == 32);
304



4
        REQUIRE(mock->mDraws[0].image == img1);
305



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage);
306



4
        REQUIRE(mock->mDraws[1].x == 32 * 1);
307



4
        REQUIRE(mock->mDraws[1].y == 32 * 10);
308
//        REQUIRE(mock->mDraws[1].image == img2);
309



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
310



4
        REQUIRE(mock->mDraws[2].x == 32 * 4);
311



4
        REQUIRE(mock->mDraws[2].y == 32 * 10);
312



4
        REQUIRE(mock->mDraws[2].image == img2);
313



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawImage);
314



4
        REQUIRE(mock->mDraws[3].x == 32 * 6);
315



4
        REQUIRE(mock->mDraws[3].y == 32 * 10);
316



4
        REQUIRE(mock->mDraws[3].image == img2);
317



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawPattern);
318



4
        REQUIRE(mock->mDraws[4].x == 32 * 9);
319



4
        REQUIRE(mock->mDraws[4].y == 32 * 10);
320



4
        REQUIRE(mock->mDraws[4].width == 64);
321



4
        REQUIRE(mock->mDraws[4].height == 32);
322



4
        REQUIRE(mock->mDraws[4].image == img2);
323



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawImage);
324



4
        REQUIRE(mock->mDraws[5].x == 32 * 10);
325



4
        REQUIRE(mock->mDraws[5].y == 32 * 10);
326
//        REQUIRE(mock->mDraws[5].image == img2);
327



4
        REQUIRE(mock->mDraws[6].drawType == MockDrawType::DrawImage);
328



4
        REQUIRE(mock->mDraws[6].x == 32 * 11);
329



4
        REQUIRE(mock->mDraws[6].y == 32 * 10);
330



4
        REQUIRE(mock->mDraws[6].image == img3);
331



4
        REQUIRE(mock->mDraws[7].drawType == MockDrawType::DrawPattern);
332



4
        REQUIRE(mock->mDraws[7].x == 32 * 15);
333



4
        REQUIRE(mock->mDraws[7].y == 32 * 10);
334



4
        REQUIRE(mock->mDraws[7].width == 96);
335



4
        REQUIRE(mock->mDraws[7].height == 32);
336



4
        REQUIRE(mock->mDraws[7].image == img1);
337
338
2
        mock->mDraws.clear();
339
        layer->drawFringe(mock,
340
            0, 0,
341
            maxX, maxY,
342
            -10, 20,
343
1
            actors);
344



5
        REQUIRE(mock->mDraws.size() == 8);
345



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern);
346



4
        REQUIRE(mock->mDraws[0].x == 32 * 1 + 10);
347



4
        REQUIRE(mock->mDraws[0].y == 32 * 10 - 20);
348



4
        REQUIRE(mock->mDraws[0].width == 96);
349



4
        REQUIRE(mock->mDraws[0].height == 32);
350



4
        REQUIRE(mock->mDraws[0].image == img1);
351



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage);
352



4
        REQUIRE(mock->mDraws[1].x == 32 * 1 + 10);
353



4
        REQUIRE(mock->mDraws[1].y == 32 * 10 - 20);
354
//        REQUIRE(mock->mDraws[1].image == img2);
355



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
356



4
        REQUIRE(mock->mDraws[2].x == 32 * 4 + 10);
357



4
        REQUIRE(mock->mDraws[2].y == 32 * 10 - 20);
358



4
        REQUIRE(mock->mDraws[2].image == img2);
359



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawImage);
360



4
        REQUIRE(mock->mDraws[3].x == 32 * 6 + 10);
361



4
        REQUIRE(mock->mDraws[3].y == 32 * 10 - 20);
362



4
        REQUIRE(mock->mDraws[3].image == img2);
363



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawPattern);
364



4
        REQUIRE(mock->mDraws[4].x == 32 * 9 + 10);
365



4
        REQUIRE(mock->mDraws[4].y == 32 * 10 - 20);
366



4
        REQUIRE(mock->mDraws[4].width == 64);
367



4
        REQUIRE(mock->mDraws[4].height == 32);
368



4
        REQUIRE(mock->mDraws[4].image == img2);
369



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawImage);
370



4
        REQUIRE(mock->mDraws[5].x == 32 * 10 + 10);
371



4
        REQUIRE(mock->mDraws[5].y == 32 * 10 - 20);
372
//        REQUIRE(mock->mDraws[5].image == img2);
373



4
        REQUIRE(mock->mDraws[6].drawType == MockDrawType::DrawImage);
374



4
        REQUIRE(mock->mDraws[6].x == 32 * 11 + 10);
375



4
        REQUIRE(mock->mDraws[6].y == 32 * 10 - 20);
376



4
        REQUIRE(mock->mDraws[6].image == img3);
377



4
        REQUIRE(mock->mDraws[7].drawType == MockDrawType::DrawPattern);
378



4
        REQUIRE(mock->mDraws[7].x == 32 * 15 + 10);
379



4
        REQUIRE(mock->mDraws[7].y == 32 * 10 - 20);
380



4
        REQUIRE(mock->mDraws[7].width == 96);
381



4
        REQUIRE(mock->mDraws[7].height == 32);
382



4
        REQUIRE(mock->mDraws[7].image == img1);
383
    }
384
385



28
    SECTION("normal 4")
386
    {
387
1
        const int maxX = 100;
388
1
        const int maxY = 100;
389
1
        map = new Map("map",
390
            maxX, maxY,
391

3
            32, 32);
392
1
        layer = new MapLayer("test",
393
            0, 0,
394
            maxX, maxY,
395
            true,
396
            0,
397

3
            0);
398
2
        layer->setTile(1, 10, img1);
399
2
        layer->setTile(2, 10, img1);
400
2
        layer->setTile(3, 10, img1);
401
2
        layer->setTile(4, 10, img2);
402
2
        layer->setTile(5, 10, nullptr);
403
2
        layer->setTile(6, 10, img2);
404
2
        layer->setTile(7, 10, nullptr);
405
2
        layer->setTile(8, 10, nullptr);
406
2
        layer->setTile(9, 10, img2);
407
2
        layer->setTile(10, 10, img2);
408
2
        layer->setTile(11, 10, img3);
409
2
        layer->setTile(12, 10, nullptr);
410
2
        layer->setTile(13, 10, nullptr);
411
2
        layer->setTile(14, 10, nullptr);
412
2
        layer->setTile(15, 10, img1);
413
2
        layer->setTile(16, 10, img1);
414
2
        layer->setTile(17, 10, img1);
415
1
        map->addLayer(layer);
416
1
        SpecialLayer *const specialLayer = map->getSpecialLayer();
417
1
        SpecialLayer *const tempLayer = map->getTempLayer();
418
2
        layer->setSpecialLayer(specialLayer);
419
2
        layer->setTempLayer(tempLayer);
420
1
        specialLayer->setTile(0, 10, MapItemType::ARROW_UP);
421
1
        specialLayer->setTile(10, 10, MapItemType::ARROW_DOWN);
422
1
        specialLayer->setTile(90, 10, MapItemType::ARROW_DOWN);
423
1
        specialLayer->updateCache();
424
1
        layer->updateCache(maxX, maxY);
425
426
        layer->drawFringe(mock,
427
            0, 0,
428
            maxX - 20, maxY,
429
            0, 0,
430
1
            actors);
431



5
        REQUIRE(mock->mDraws.size() == 8);
432



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage);
433



4
        REQUIRE(mock->mDraws[0].x == 32 * 0);
434



4
        REQUIRE(mock->mDraws[0].y == 32 * 10);
435
//        REQUIRE(mock->mDraws[0].image == img2);
436



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawPattern);
437



4
        REQUIRE(mock->mDraws[1].x == 32 * 1);
438



4
        REQUIRE(mock->mDraws[1].y == 32 * 10);
439



4
        REQUIRE(mock->mDraws[1].width == 96);
440



4
        REQUIRE(mock->mDraws[1].height == 32);
441



4
        REQUIRE(mock->mDraws[1].image == img1);
442



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
443



4
        REQUIRE(mock->mDraws[2].x == 32 * 4);
444



4
        REQUIRE(mock->mDraws[2].y == 32 * 10);
445



4
        REQUIRE(mock->mDraws[2].image == img2);
446



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawImage);
447



4
        REQUIRE(mock->mDraws[3].x == 32 * 6);
448



4
        REQUIRE(mock->mDraws[3].y == 32 * 10);
449



4
        REQUIRE(mock->mDraws[3].image == img2);
450



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawPattern);
451



4
        REQUIRE(mock->mDraws[4].x == 32 * 9);
452



4
        REQUIRE(mock->mDraws[4].y == 32 * 10);
453



4
        REQUIRE(mock->mDraws[4].width == 64);
454



4
        REQUIRE(mock->mDraws[4].height == 32);
455



4
        REQUIRE(mock->mDraws[4].image == img2);
456



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawImage);
457



4
        REQUIRE(mock->mDraws[5].x == 32 * 10);
458



4
        REQUIRE(mock->mDraws[5].y == 32 * 10);
459
//        REQUIRE(mock->mDraws[5].image == img2);
460



4
        REQUIRE(mock->mDraws[6].drawType == MockDrawType::DrawImage);
461



4
        REQUIRE(mock->mDraws[6].x == 32 * 11);
462



4
        REQUIRE(mock->mDraws[6].y == 32 * 10);
463



4
        REQUIRE(mock->mDraws[6].image == img3);
464



4
        REQUIRE(mock->mDraws[7].drawType == MockDrawType::DrawPattern);
465



4
        REQUIRE(mock->mDraws[7].x == 32 * 15);
466



4
        REQUIRE(mock->mDraws[7].y == 32 * 10);
467



4
        REQUIRE(mock->mDraws[7].width == 96);
468



4
        REQUIRE(mock->mDraws[7].height == 32);
469



4
        REQUIRE(mock->mDraws[7].image == img1);
470
471
2
        mock->mDraws.clear();
472
        layer->drawFringe(mock,
473
            0, 0,
474
            maxX - 20, maxY,
475
            -10, 20,
476
1
            actors);
477



5
        REQUIRE(mock->mDraws.size() == 8);
478



4
        REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage);
479



4
        REQUIRE(mock->mDraws[0].x == 32 * 0 + 10);
480



4
        REQUIRE(mock->mDraws[0].y == 32 * 10 - 20);
481
//        REQUIRE(mock->mDraws[0].image == img2);
482



4
        REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawPattern);
483



4
        REQUIRE(mock->mDraws[1].x == 32 * 1 + 10);
484



4
        REQUIRE(mock->mDraws[1].y == 32 * 10 - 20);
485



4
        REQUIRE(mock->mDraws[1].width == 96);
486



4
        REQUIRE(mock->mDraws[1].height == 32);
487



4
        REQUIRE(mock->mDraws[1].image == img1);
488



4
        REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage);
489



4
        REQUIRE(mock->mDraws[2].x == 32 * 4 + 10);
490



4
        REQUIRE(mock->mDraws[2].y == 32 * 10 - 20);
491



4
        REQUIRE(mock->mDraws[2].image == img2);
492



4
        REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawImage);
493



4
        REQUIRE(mock->mDraws[3].x == 32 * 6 + 10);
494



4
        REQUIRE(mock->mDraws[3].y == 32 * 10 - 20);
495



4
        REQUIRE(mock->mDraws[3].image == img2);
496



4
        REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawPattern);
497



4
        REQUIRE(mock->mDraws[4].x == 32 * 9 + 10);
498



4
        REQUIRE(mock->mDraws[4].y == 32 * 10 - 20);
499



4
        REQUIRE(mock->mDraws[4].width == 64);
500



4
        REQUIRE(mock->mDraws[4].height == 32);
501



4
        REQUIRE(mock->mDraws[4].image == img2);
502



4
        REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawImage);
503



4
        REQUIRE(mock->mDraws[5].x == 32 * 10 + 10);
504



4
        REQUIRE(mock->mDraws[5].y == 32 * 10 - 20);
505
//        REQUIRE(mock->mDraws[5].image == img2);
506



4
        REQUIRE(mock->mDraws[6].drawType == MockDrawType::DrawImage);
507



4
        REQUIRE(mock->mDraws[6].x == 32 * 11 + 10);
508



4
        REQUIRE(mock->mDraws[6].y == 32 * 10 - 20);
509



4
        REQUIRE(mock->mDraws[6].image == img3);
510



4
        REQUIRE(mock->mDraws[7].drawType == MockDrawType::DrawPattern);
511



4
        REQUIRE(mock->mDraws[7].x == 32 * 15 + 10);
512



4
        REQUIRE(mock->mDraws[7].y == 32 * 10 - 20);
513



4
        REQUIRE(mock->mDraws[7].width == 96);
514



4
        REQUIRE(mock->mDraws[7].height == 32);
515



4
        REQUIRE(mock->mDraws[7].image == img1);
516
    }
517
518
4
    delete2(localPlayer)
519
4
    delete map;
520
4
    delete img1;
521
4
    delete img2;
522
4
    delete img3;
523
4
    delete mock;
524
4
    delete2(theme)
525
4
    GraphicsManager::deleteRenderers();
526
4
    ResourceManager::cleanOrphans(true);
527
4
    ResourceManager::deleteInstance();
528

12
    VirtFs::unmountDirSilent("data");
529

16
    VirtFs::unmountDirSilent("../data");
530

7
}