|
@ -85,7 +85,7 @@ class PlayerTest { |
|
|
// assert |
|
|
// assert |
|
|
assertThat(direction).isEqualTo(expectedDdirection); |
|
|
assertThat(direction).isEqualTo(expectedDdirection); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void Player_processInput_changesDirectionLeft() { |
|
|
void Player_processInput_changesDirectionLeft() { |
|
|
// arrange |
|
|
// arrange |
|
@ -108,4 +108,27 @@ class PlayerTest { |
|
|
// assert |
|
|
// assert |
|
|
assertThat(direction).isEqualTo(expectedDdirection); |
|
|
assertThat(direction).isEqualTo(expectedDdirection); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void Player_processInput_changesDirectionRight() { |
|
|
|
|
|
// arrange |
|
|
|
|
|
|
|
|
|
|
|
String[] mapTest = { |
|
|
|
|
|
"...", |
|
|
|
|
|
"...", |
|
|
|
|
|
"..." |
|
|
|
|
|
}; |
|
|
|
|
|
GameManager gameManager = new GameManager(); |
|
|
|
|
|
|
|
|
|
|
|
gameManager.map = new Map(mapTest, gameManager); |
|
|
|
|
|
Player player = gameManager.player; |
|
|
|
|
|
player.position = new Vector2(1,1); |
|
|
|
|
|
player.direction = new Vector2(-1,0); |
|
|
|
|
|
Vector2 expectedDdirection = new Vector2(1,0); |
|
|
|
|
|
// act |
|
|
|
|
|
player.processInput('d'); |
|
|
|
|
|
Vector2 direction = player.direction; |
|
|
|
|
|
// assert |
|
|
|
|
|
assertThat(direction).isEqualTo(expectedDdirection); |
|
|
|
|
|
} |
|
|
} |
|
|
} |