-
Notifications
You must be signed in to change notification settings - Fork 1
Test Plan for KeyMapping
manya-k edited this page Oct 16, 2024
·
1 revision
The goal is to verify that the KeyMapping
class is correctly handling default key bindings, allowing custom key bindings, and modifying the key map.
- Description: Verify that the default key mappings for walking are set correctly when the class is initialized.
-
Steps:
- Initialize the
KeyMapping
class. - Retrieve the default key map.
- Assert that the correct key bindings are set for walking (W, A, S, D).
- Initialize the
-
Expected Result: The default key bindings should map W to
WALK_UP
, A toWALK_LEFT
, D toWALK_RIGHT
, and S toWALK_DOWN
.
- Description: Verify that the default key mappings for shooting are set correctly.
-
Steps:
- Initialize the
KeyMapping
class. - Retrieve the default key map.
- Assert that the correct key bindings are set for shooting (Arrow keys).
- Initialize the
- Expected Result: The default key bindings should map the arrow keys (LEFT, UP, RIGHT, DOWN) to shooting directions.
- Description: Verify that the default key bindings for item usage are set correctly (e.g., Space for melee, numbers for item usage).
-
Steps:
- Initialize the
KeyMapping
class. - Retrieve the default key map.
- Assert that the correct key bindings are set for items (Space for melee, numbers 1-3 for item usage).
- Initialize the
-
Expected Result: Space should be mapped to
MELEE
, and numbers 1, 2, 3 should be mapped toUSE_1
,USE_2
, andUSE_3
.
- Description: Verify that a custom key binding can be set and is correctly reflected in the key map.
-
Steps:
- Initialize the
KeyMapping
class. - Set a custom key binding for a new key (e.g., number 4).
- Retrieve the updated key map.
- Assert that the custom key binding has been set correctly.
- Initialize the
-
Expected Result: Number 4 should be mapped to the new key binding (e.g.,
USE_4
).
- Description: Verify that a custom key mapping is returned correctly after setting it.
-
Steps:
- Initialize the
KeyMapping
class. - Set a custom key binding for an unused key (e.g., F1).
- Retrieve the updated key map.
- Assert that the custom key binding is reflected in the key map.
- Initialize the
-
Expected Result: F1 should be mapped to the new key binding (e.g.,
SHOOT_UP
).
- Description: Verify that modifying an existing key binding updates the key map correctly.
-
Steps:
- Initialize the
KeyMapping
class. - Set a key binding for a key (e.g., number 4).
- Modify the key binding for the same key.
- Retrieve the updated key map.
- Assert that the key binding has been updated, and the old binding no longer exists.
- Initialize the
-
Expected Result: Number 4 should reflect the modified key binding (e.g., from
USE_4
toWALK_UP
), and the old binding should no longer be present.
- Unit Testing Framework: JUnit 5 (Jupiter)
-
Extensions:
GameExtension
for LibGDX-related tests -
Assertions: Use
assertEquals
andassertNotEquals
to verify correct key bindings.
This test plan covers both the verification of default key bindings and the functionality of setting and modifying custom key mappings in the KeyMapping
class.
Design Choices
Utilities
Animals
Menus/screens
Character
- Character Animations
- Character's Inventory On Display
- Character's Inventory System
- Character's HealthBar
- Character's Interaction with Items
- Character achievements
- Saving Character
- Player-(and-other-NPC)-invincibility-frames
- Player Factory
- Scoring System
- Test Plan for Inventory System
- Test Plan for Player's Interaction with Items
- Test Plan for Player's Inventory Display
- Test Plan for Saving Character State
- Test Plan for Scoring System
Map
Weapon
- Weapon Overview
- Weapon Types
- Weapon Structure
- Weapon Stats Display
- Testing Plan for Weapon Factory
- Testing Plan for Firing Controller Component
- Testing Plan for Position Tracker Component
- Testing Plan for Weapon Animation Controller component
- Testing Plan for Concrete Melee Weapon class
- Testing Plan for Concrete Ranged Weapon class