GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/unittests/resources/map/maplayer/drawfringenormal.cc Lines: 376 376 100.0 %
Date: 2017-11-29 Branches: 1247 3354 37.2 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2016-2017  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
12
TEST_CASE("MapLayer drawFringe normal", "")
54
{
55
8
    setEnv("SDL_VIDEODRIVER", "dummy");
56
57

32
    VirtFs::mountDirSilent("data", Append_false);
58

32
    VirtFs::mountDirSilent("../data", Append_false);
59
60
16
    imageHelper = new SDLImageHelper;
61
62
8
    Dirs::initRootDir();
63
8
    Dirs::initHomeDir();
64
65
8
    setBrandingDefaults(branding);
66
8
    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
8
    graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE);
75
#endif  // USE_SDL2
76
77
8
    theme = new Theme;
78
8
    Theme::selectSkin();
79
80
8
    localPlayer = new LocalPlayer(static_cast<BeingId>(1),
81
8
        BeingTypeId_zero);
82
83
8
    Image *const img1 = new Image(32, 32);
84
8
    Image *const img2 = new Image(32, 32);
85
8
    Image *const img3 = new Image(32, 32);
86
8
    Map *map = nullptr;
87
8
    MapLayer *layer = nullptr;
88
8
    MockGraphics *const mock = new MockGraphics;
89
16
    const Actors actors;
90
91



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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



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

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

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

14
}