GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/unittests/resources/map/maplayer/drawfringenormal.cc Lines: 376 376 100.0 %
Date: 2018-09-20 Branches: 1246 3352 37.2 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2016-2018  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "unittests/unittests.h"
22
23
#include "configmanager.h"
24
#include "configuration.h"
25
#include "dirs.h"
26
#include "graphicsmanager.h"
27
28
#include "being/localplayer.h"
29
30
#include "enums/resources/map/mapitemtype.h"
31
32
#include "fs/virtfs/fs.h"
33
34
#include "gui/theme.h"
35
36
#include "unittests/render/mockgraphics.h"
37
38
#include "utils/delete2.h"
39
#include "utils/env.h"
40
41
#include "resources/resourcemanager/resourcemanager.h"
42
43
#include "resources/sdlimagehelper.h"
44
45
#include "resources/image/image.h"
46
47
#include "resources/map/map.h"
48
#include "resources/map/maplayer.h"
49
#include "resources/map/speciallayer.h"
50
51
#include "debug.h"
52
53
6
TEST_CASE("MapLayer drawFringe normal", "")
54
{
55
4
    setEnv("SDL_VIDEODRIVER", "dummy");
56
57
12
    VirtFs::mountDirSilent("data", Append_false);
58
12
    VirtFs::mountDirSilent("../data", Append_false);
59
60
8
    imageHelper = new SDLImageHelper;
61
62
4
    Dirs::initRootDir();
63
4
    Dirs::initHomeDir();
64
65
4
    setBrandingDefaults(branding);
66
4
    ConfigManager::initConfiguration();
67
68
#ifdef USE_SDL2
69
    SDLImageHelper::setRenderer(graphicsManager.createRenderer(
70
        graphicsManager.createWindow(640, 480, 0,
71
        SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE));
72
#else  // USE_SDL2
73
74
4
    graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
75
#endif  // USE_SDL2
76
77
4
    theme = new Theme;
78
4
    Theme::selectSkin();
79
80
4
    localPlayer = new LocalPlayer(static_cast<BeingId>(1),
81
4
        BeingTypeId_zero);
82
83
4
    Image *const img1 = new Image(32, 32);
84
4
    Image *const img2 = new Image(32, 32);
85
4
    Image *const img3 = new Image(32, 32);
86
4
    Map *map = nullptr;
87
4
    MapLayer *layer = nullptr;
88
4
    MockGraphics *const mock = new MockGraphics;
89
8
    const Actors actors;
90
91



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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

7
}