MCPcopy Create free account
hub / github.com/EasyRPG/Player / testAnimBlocked

Function testAnimBlocked

tests/game_player_pan.cpp:185–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185static void testAnimBlocked(Game_Player::PanDirection dir_x, Game_Player::PanDirection dir_y, int speed) {
186 static constexpr auto map_id = MockMap::ePassBlock20x15;
187
188 const MockGame mg(map_id);
189 auto& ch = *mg.GetPlayer();
190
191 ch.SetMapId(static_cast<int>(map_id));
192 ch.MoveTo(static_cast<int>(map_id), 0, 0);
193
194 const auto wait = 2 * SCREEN_TILE_SIZE / (2 << speed);
195 int fx = 1 * SCREEN_TILE_SIZE;
196 int fy = 2 * SCREEN_TILE_SIZE;
197
198 if (dir_x == Game_Player::PanRight) {
199 fx = -1 * SCREEN_TILE_SIZE;
200 }
201 if (dir_y == Game_Player::PanDown) {
202 fy = -2 * SCREEN_TILE_SIZE;
203 }
204
205 ch.StartPan(dir_x, 1, speed);
206 ch.StartPan(dir_y, 2, speed);
207
208 testPanAbs(ch, true, false, 0, 0, fx, fy, wait);
209
210 for (int i = 1; i < 10; ++i) {
211 ForceUpdate(ch);
212 testPanAbs(ch, true, false, 0, 0, fx, fy, wait);
213 }
214
215 ch.ResetPan(speed);
216 testPan(ch, false, false, 0, 0, 0, 0, 0);
217}
218
219TEST_CASE("BlockedPan") {
220 for (int speed = 1; speed <= 6; ++speed) {

Callers 1

Calls 8

testPanAbsFunction · 0.85
testPanFunction · 0.85
GetPlayerMethod · 0.80
SetMapIdMethod · 0.80
StartPanMethod · 0.80
ResetPanMethod · 0.80
ForceUpdateFunction · 0.70
MoveToMethod · 0.45

Tested by

no test coverage detected