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 "dirs.h" |
||
26 |
|||
27 |
#include "unittests/render/mockgraphics.h" |
||
28 |
|||
29 |
#include "resources/image/image.h" |
||
30 |
|||
31 |
#include "resources/map/map.h" |
||
32 |
#include "resources/map/maplayer.h" |
||
33 |
|||
34 |
#include "debug.h" |
||
35 |
|||
36 |
✓✗ | 12 |
TEST_CASE("MapLayer draw", "") |
37 |
{ |
||
38 |
10 |
Dirs::initRootDir(); |
|
39 |
10 |
Dirs::initHomeDir(); |
|
40 |
|||
41 |
10 |
ConfigManager::initConfiguration(); |
|
42 |
|||
43 |
✓✗ | 10 |
Image *const img1 = new Image(32, 32); |
44 |
✓✗ | 10 |
Image *const img2 = new Image(32, 32); |
45 |
✓✗ | 10 |
Image *const img3 = new Image(32, 32); |
46 |
10 |
Map *map = nullptr; |
|
47 |
10 |
MapLayer *layer = nullptr; |
|
48 |
✓✗ | 10 |
MockGraphics *const mock = new MockGraphics; |
49 |
|||
50 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 1") |
51 |
{ |
||
52 |
1 |
map = new Map("map", |
|
53 |
1, 1, |
||
54 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
55 |
1 |
layer = new MapLayer("test", |
|
56 |
0, 0, |
||
57 |
1, 1, |
||
58 |
false, |
||
59 |
0, |
||
60 |
✓✗✓✗ ✓✗ |
3 |
0); |
61 |
2 |
layer->setTile(0, 0, img1); |
|
62 |
✓✗ | 1 |
map->addLayer(layer); |
63 |
✓✗ | 1 |
layer->updateCache(1, 1); |
64 |
|||
65 |
layer->draw(mock, |
||
66 |
0, 0, |
||
67 |
1, 1, |
||
68 |
✓✗ | 1 |
0, 0); |
69 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
70 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
71 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
72 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
73 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
74 |
|||
75 |
2 |
mock->mDraws.clear(); |
|
76 |
layer->draw(mock, |
||
77 |
0, 0, |
||
78 |
1, 1, |
||
79 |
✓✗ | 1 |
10, 5); |
80 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
81 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
82 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
83 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -5); |
84 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
85 |
|||
86 |
2 |
mock->mDraws.clear(); |
|
87 |
layer->draw(mock, |
||
88 |
0, 0, |
||
89 |
1, 1, |
||
90 |
✓✗ | 1 |
-10, -5); |
91 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
92 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
93 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
94 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 5); |
95 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
96 |
} |
||
97 |
|||
98 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 2") |
99 |
{ |
||
100 |
1 |
map = new Map("map", |
|
101 |
2, 1, |
||
102 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
103 |
1 |
layer = new MapLayer("test", |
|
104 |
0, 0, |
||
105 |
2, 1, |
||
106 |
false, |
||
107 |
0, |
||
108 |
✓✗✓✗ ✓✗ |
3 |
0); |
109 |
2 |
layer->setTile(0, 0, img1); |
|
110 |
✓✗ | 1 |
map->addLayer(layer); |
111 |
✓✗ | 1 |
layer->updateCache(2, 1); |
112 |
|||
113 |
layer->draw(mock, |
||
114 |
0, 0, |
||
115 |
2, 1, |
||
116 |
✓✗ | 1 |
0, 0); |
117 |
|||
118 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
119 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
120 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
121 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
122 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
123 |
|||
124 |
2 |
mock->mDraws.clear(); |
|
125 |
layer->draw(mock, |
||
126 |
0, 0, |
||
127 |
2, 1, |
||
128 |
✓✗ | 1 |
10, 5); |
129 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
130 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
131 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
132 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -5); |
133 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
134 |
|||
135 |
2 |
mock->mDraws.clear(); |
|
136 |
layer->draw(mock, |
||
137 |
0, 0, |
||
138 |
2, 1, |
||
139 |
✓✗ | 1 |
-10, -5); |
140 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
141 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
142 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
143 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 5); |
144 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
145 |
} |
||
146 |
|||
147 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 3") |
148 |
{ |
||
149 |
1 |
map = new Map("map", |
|
150 |
2, 1, |
||
151 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
152 |
1 |
layer = new MapLayer("test", |
|
153 |
0, 0, |
||
154 |
2, 1, |
||
155 |
false, |
||
156 |
0, |
||
157 |
✓✗✓✗ ✓✗ |
3 |
0); |
158 |
2 |
layer->setTile(0, 0, img1); |
|
159 |
2 |
layer->setTile(1, 0, img2); |
|
160 |
✓✗ | 1 |
map->addLayer(layer); |
161 |
✓✗ | 1 |
layer->updateCache(2, 1); |
162 |
|||
163 |
layer->draw(mock, |
||
164 |
0, 0, |
||
165 |
2, 1, |
||
166 |
✓✗ | 1 |
0, 0); |
167 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
168 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
169 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
170 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
171 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
172 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
173 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 32); |
174 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
175 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
176 |
|||
177 |
2 |
mock->mDraws.clear(); |
|
178 |
layer->draw(mock, |
||
179 |
0, 0, |
||
180 |
2, 1, |
||
181 |
✓✗ | 1 |
-10, -20); |
182 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
183 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
184 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
185 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 20); |
186 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
187 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
188 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 42); |
189 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 20); |
190 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
191 |
} |
||
192 |
|||
193 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 4") |
194 |
{ |
||
195 |
1 |
map = new Map("map", |
|
196 |
2, 1, |
||
197 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
198 |
1 |
layer = new MapLayer("test", |
|
199 |
0, 0, |
||
200 |
2, 1, |
||
201 |
false, |
||
202 |
0, |
||
203 |
✓✗✓✗ ✓✗ |
3 |
0); |
204 |
2 |
layer->setTile(0, 0, img1); |
|
205 |
2 |
layer->setTile(1, 0, img1); |
|
206 |
✓✗ | 1 |
map->addLayer(layer); |
207 |
✓✗ | 1 |
layer->updateCache(2, 1); |
208 |
|||
209 |
layer->draw(mock, |
||
210 |
0, 0, |
||
211 |
2, 1, |
||
212 |
✓✗ | 1 |
0, 0); |
213 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
214 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
215 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
216 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
217 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
218 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
219 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
220 |
|||
221 |
2 |
mock->mDraws.clear(); |
|
222 |
layer->draw(mock, |
||
223 |
0, 0, |
||
224 |
2, 1, |
||
225 |
✓✗ | 1 |
-10, 20); |
226 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
227 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
228 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
229 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
230 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
231 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
232 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
233 |
} |
||
234 |
|||
235 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 4.2") |
236 |
{ |
||
237 |
1 |
map = new Map("map", |
|
238 |
3, 1, |
||
239 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
240 |
1 |
layer = new MapLayer("test", |
|
241 |
0, 0, |
||
242 |
3, 1, |
||
243 |
false, |
||
244 |
0, |
||
245 |
✓✗✓✗ ✓✗ |
3 |
0); |
246 |
2 |
layer->setTile(0, 0, img1); |
|
247 |
2 |
layer->setTile(2, 0, img1); |
|
248 |
✓✗ | 1 |
map->addLayer(layer); |
249 |
✓✗ | 1 |
layer->updateCache(3, 1); |
250 |
|||
251 |
layer->draw(mock, |
||
252 |
0, 0, |
||
253 |
3, 1, |
||
254 |
✓✗ | 1 |
0, 0); |
255 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
256 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
257 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
258 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
259 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
260 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
261 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 64); |
262 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
263 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img1); |
264 |
|||
265 |
2 |
mock->mDraws.clear(); |
|
266 |
layer->draw(mock, |
||
267 |
0, 0, |
||
268 |
3, 1, |
||
269 |
✓✗ | 1 |
10, -20); |
270 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
271 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
272 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == -10); |
273 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 20); |
274 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
275 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
276 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 54); |
277 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 20); |
278 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img1); |
279 |
} |
||
280 |
|||
281 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 5") |
282 |
{ |
||
283 |
1 |
map = new Map("map", |
|
284 |
3, 1, |
||
285 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
286 |
1 |
layer = new MapLayer("test", |
|
287 |
0, 0, |
||
288 |
3, 1, |
||
289 |
false, |
||
290 |
0, |
||
291 |
✓✗✓✗ ✓✗ |
3 |
0); |
292 |
2 |
layer->setTile(0, 0, img1); |
|
293 |
2 |
layer->setTile(1, 0, img1); |
|
294 |
✓✗ | 1 |
map->addLayer(layer); |
295 |
✓✗ | 1 |
layer->updateCache(3, 1); |
296 |
|||
297 |
layer->draw(mock, |
||
298 |
0, 0, |
||
299 |
3, 1, |
||
300 |
✓✗ | 1 |
0, 0); |
301 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
302 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
303 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
304 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
305 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
306 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
307 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
308 |
|||
309 |
2 |
mock->mDraws.clear(); |
|
310 |
layer->draw(mock, |
||
311 |
0, 0, |
||
312 |
3, 1, |
||
313 |
✓✗ | 1 |
-10, 20); |
314 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
315 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
316 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
317 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
318 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
319 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
320 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
321 |
} |
||
322 |
|||
323 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 6") |
324 |
{ |
||
325 |
1 |
map = new Map("map", |
|
326 |
3, 1, |
||
327 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
328 |
1 |
layer = new MapLayer("test", |
|
329 |
0, 0, |
||
330 |
3, 1, |
||
331 |
false, |
||
332 |
0, |
||
333 |
✓✗✓✗ ✓✗ |
3 |
0); |
334 |
2 |
layer->setTile(0, 0, img1); |
|
335 |
2 |
layer->setTile(1, 0, img1); |
|
336 |
2 |
layer->setTile(2, 0, img2); |
|
337 |
✓✗ | 1 |
map->addLayer(layer); |
338 |
✓✗ | 1 |
layer->updateCache(3, 1); |
339 |
|||
340 |
layer->draw(mock, |
||
341 |
0, 0, |
||
342 |
3, 1, |
||
343 |
✓✗ | 1 |
0, 0); |
344 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
345 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
346 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 0); |
347 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
348 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
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 == 64); |
353 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
354 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
355 |
|||
356 |
2 |
mock->mDraws.clear(); |
|
357 |
layer->draw(mock, |
||
358 |
0, 0, |
||
359 |
3, 1, |
||
360 |
✓✗ | 1 |
-10, 20); |
361 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
362 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
363 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 10); |
364 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
365 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 64); |
366 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
367 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
368 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
369 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 74); |
370 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == -20); |
371 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
372 |
} |
||
373 |
|||
374 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("simple 7") |
375 |
{ |
||
376 |
1 |
map = new Map("map", |
|
377 |
3, 1, |
||
378 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
379 |
1 |
layer = new MapLayer("test", |
|
380 |
0, 0, |
||
381 |
3, 1, |
||
382 |
false, |
||
383 |
0, |
||
384 |
✓✗✓✗ ✓✗ |
3 |
0); |
385 |
2 |
layer->setTile(0, 0, img1); |
|
386 |
2 |
layer->setTile(1, 0, img1); |
|
387 |
2 |
layer->setTile(2, 0, img2); |
|
388 |
✓✗ | 1 |
map->addLayer(layer); |
389 |
1 |
TileInfo *const tiles = layer->getTiles(); |
|
390 |
1 |
tiles[0].isEnabled = false; |
|
391 |
✓✗ | 1 |
layer->updateCache(3, 1); |
392 |
|||
393 |
layer->draw(mock, |
||
394 |
0, 0, |
||
395 |
3, 1, |
||
396 |
✓✗ | 1 |
0, 0); |
397 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
398 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
399 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32); |
400 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 0); |
401 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
402 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
403 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 64); |
404 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 0); |
405 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
406 |
|||
407 |
2 |
mock->mDraws.clear(); |
|
408 |
layer->draw(mock, |
||
409 |
0, 0, |
||
410 |
3, 1, |
||
411 |
✓✗ | 1 |
-10, 20); |
412 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 2); |
413 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
414 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 42); |
415 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == -20); |
416 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
417 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
418 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 74); |
419 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == -20); |
420 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
421 |
} |
||
422 |
|||
423 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("normal 1") |
424 |
{ |
||
425 |
1 |
const int maxX = 100; |
|
426 |
1 |
const int maxY = 100; |
|
427 |
1 |
map = new Map("map", |
|
428 |
maxX, maxY, |
||
429 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
430 |
1 |
layer = new MapLayer("test", |
|
431 |
0, 0, |
||
432 |
maxX, maxY, |
||
433 |
false, |
||
434 |
0, |
||
435 |
✓✗✓✗ ✓✗ |
3 |
0); |
436 |
2 |
layer->setTile(1, 10, img1); |
|
437 |
2 |
layer->setTile(2, 10, img1); |
|
438 |
2 |
layer->setTile(3, 10, img1); |
|
439 |
2 |
layer->setTile(4, 10, img2); |
|
440 |
2 |
layer->setTile(5, 10, nullptr); |
|
441 |
2 |
layer->setTile(6, 10, img2); |
|
442 |
2 |
layer->setTile(7, 10, nullptr); |
|
443 |
2 |
layer->setTile(8, 10, nullptr); |
|
444 |
2 |
layer->setTile(9, 10, img2); |
|
445 |
2 |
layer->setTile(10, 10, img2); |
|
446 |
2 |
layer->setTile(11, 10, img3); |
|
447 |
2 |
layer->setTile(12, 10, nullptr); |
|
448 |
2 |
layer->setTile(13, 10, nullptr); |
|
449 |
2 |
layer->setTile(14, 10, nullptr); |
|
450 |
2 |
layer->setTile(15, 10, img1); |
|
451 |
2 |
layer->setTile(16, 10, img1); |
|
452 |
2 |
layer->setTile(17, 10, img1); |
|
453 |
✓✗ | 1 |
map->addLayer(layer); |
454 |
✓✗ | 1 |
layer->updateCache(maxX, maxY); |
455 |
|||
456 |
layer->draw(mock, |
||
457 |
0, 0, |
||
458 |
maxX, maxY, |
||
459 |
✓✗ | 1 |
0, 0); |
460 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 6); |
461 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
462 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32 * 1); |
463 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 32 * 10); |
464 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 96); |
465 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
466 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
467 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
468 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 32 * 4); |
469 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 32 * 10); |
470 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
471 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage); |
472 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].x == 32 * 6); |
473 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].y == 32 * 10); |
474 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].image == img2); |
475 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawPattern); |
476 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].x == 32 * 9); |
477 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].y == 32 * 10); |
478 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].width == 64); |
479 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].height == 32); |
480 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].image == img2); |
481 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawImage); |
482 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].x == 32 * 11); |
483 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].y == 32 * 10); |
484 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].image == img3); |
485 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawPattern); |
486 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].x == 32 * 15); |
487 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].y == 32 * 10); |
488 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].width == 96); |
489 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].height == 32); |
490 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].image == img1); |
491 |
|||
492 |
2 |
mock->mDraws.clear(); |
|
493 |
layer->draw(mock, |
||
494 |
0, 0, |
||
495 |
maxX, maxY, |
||
496 |
✓✗ | 1 |
-10, 20); |
497 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 6); |
498 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawPattern); |
499 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32 * 1 + 10); |
500 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 32 * 10 - 20); |
501 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].width == 96); |
502 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].height == 32); |
503 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].image == img1); |
504 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].drawType == MockDrawType::DrawImage); |
505 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].x == 32 * 4 + 10); |
506 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].y == 32 * 10 - 20); |
507 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[1].image == img2); |
508 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].drawType == MockDrawType::DrawImage); |
509 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].x == 32 * 6 + 10); |
510 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].y == 32 * 10 - 20); |
511 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[2].image == img2); |
512 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].drawType == MockDrawType::DrawPattern); |
513 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].x == 32 * 9 + 10); |
514 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].y == 32 * 10 - 20); |
515 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].width == 64); |
516 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].height == 32); |
517 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[3].image == img2); |
518 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].drawType == MockDrawType::DrawImage); |
519 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].x == 32 * 11 + 10); |
520 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].y == 32 * 10 - 20); |
521 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[4].image == img3); |
522 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].drawType == MockDrawType::DrawPattern); |
523 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].x == 32 * 15 + 10); |
524 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].y == 32 * 10 - 20); |
525 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].width == 96); |
526 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].height == 32); |
527 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[5].image == img1); |
528 |
} |
||
529 |
|||
530 |
✓✗✓✗ ✓✗✓✗ ✓✗✓✓ |
70 |
SECTION("normal2") |
531 |
{ |
||
532 |
1 |
const int maxX = 100; |
|
533 |
1 |
const int maxY = 100; |
|
534 |
1 |
map = new Map("map", |
|
535 |
maxX, maxY, |
||
536 |
✓✗✓✗ ✓✗ |
3 |
32, 32); |
537 |
1 |
layer = new MapLayer("test", |
|
538 |
0, 0, |
||
539 |
maxX, maxY, |
||
540 |
false, |
||
541 |
0, |
||
542 |
✓✗✓✗ ✓✗ |
3 |
0); |
543 |
1 |
TileInfo *const tiles = layer->getTiles(); |
|
544 |
✓✗ | 1 |
map->addLayer(layer); |
545 |
✓✓ | 201 |
for (int x = 0; x < maxX; x ++) |
546 |
{ |
||
547 |
✓✓ | 20100 |
for (int y = 0; y < maxY; y ++) |
548 |
{ |
||
549 |
20000 |
layer->setTile(x, y, img1); |
|
550 |
10000 |
tiles[y * maxX + x].isEnabled = false; |
|
551 |
} |
||
552 |
} |
||
553 |
1 |
tiles[10 * maxX + 41].isEnabled = true; |
|
554 |
✓✗ | 1 |
layer->updateCache(maxX, maxY); |
555 |
|||
556 |
layer->draw(mock, |
||
557 |
0, 0, |
||
558 |
maxX, maxY, |
||
559 |
✓✗ | 1 |
0, 0); |
560 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
561 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
562 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32 * 41); |
563 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 32 * 10); |
564 |
|||
565 |
2 |
mock->mDraws.clear(); |
|
566 |
layer->draw(mock, |
||
567 |
0, 0, |
||
568 |
maxX, maxY, |
||
569 |
✓✗ | 1 |
-10, 20); |
570 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
5 |
REQUIRE(mock->mDraws.size() == 1); |
571 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].drawType == MockDrawType::DrawImage); |
572 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].x == 32 * 41 + 10); |
573 |
✓✗✓✗ ✓✗✓✗ ✓✗✗✗ ✗✗ |
4 |
REQUIRE(mock->mDraws[0].y == 32 * 10 - 20); |
574 |
} |
||
575 |
|||
576 |
✓✗ | 10 |
delete map; |
577 |
✓✗ | 10 |
delete img1; |
578 |
✓✗ | 10 |
delete img2; |
579 |
✓✗ | 10 |
delete img3; |
580 |
✓✗ | 10 |
delete mock; |
581 |
✓✗✓✗ |
13 |
} |
Generated by: GCOVR (Version 3.3) |