IntroCutscene Test Plan - UQcsse3200/2024-studio-3 GitHub Wiki
This test plan is used to test all cutscenes within the game system.
Test Environment:
Framework: JUnit 4
Objects Used: IntroCutscene
, ResourceService
(mocked), GameTime
(mocked), Entity
(mocked), EntityService
(mocked), Texture
(mocked)
**Test Cases
1. Cutscene Initialization
Purpose:
To verify that the IntroCutscene
is properly initialized and that its necessary components (e.g., ResourceService
, GameTime
, and entity event system) are set up correctly.
Expected Results:
After initialization:
- The
IntroCutscene
object should not be null. - The associated
GameTime
andResourceService
instances should not be null. - The
entity.getEvents()
should return a non-nullEventHandler
.
2. Asset Loading
Purpose:
To verify that the correct assets (textures, animations) for the cutscene are loaded by the ResourceService
.
Expected Results:
ResourceService.loadTextures()
should be called with the correct texture paths for the background and animation.ResourceService.loadTextureAtlases()
should be called for the cutscene character animations.ResourceService.loadAll()
should be called to ensure all assets are loaded before the cutscene begins.
3. Scene Setup
Purpose:
To verify that the scenes in the IntroCutscene
are set up with the correct background images, text, and animations.
Expected Results:
- The correct number of scenes should be created (e.g., 2 scenes for the intro cutscene).
- The first scene should contain the expected background image (
"images/Cutscenes/Beastly_Bistro_Background.png"
). - The scene text should be correctly set, with the first scene containing three pieces of dialogue.
4. Entity Creation
Purpose:
To verify that the entities (background, animations) are created and registered correctly during the cutscene.
Expected Results:
- When
loadScene(0)
is called, the background entity and animation entities should be created. ServiceLocator.getEntityService().register()
should be called for each created entity (e.g., background, animations).
5. Cutscene Updates and Scene Transitions
Purpose:
To verify that the cutscene transitions to the next scene after the current scene's duration has passed and eventually ends the cutscene.
Expected Results:
- Before the duration of the first scene has passed, no scene transition should occur.
- After the scene duration is exceeded, the cutscene should transition to the next scene or trigger the "cutsceneEnded" event if there are no more scenes.
- The
entity.getEvents().trigger("cutsceneEnded")
should be called when the cutscene ends.
6. Handling Entity Disposal
Purpose:
To verify that all entities created during the cutscene are properly disposed of when transitioning between scenes or when the cutscene ends.
Expected Results:
- After a scene ends,
disposeEntities()
should be called, and all entities should be disposed of correctly. ServiceLocator.getEntityService().unregister()
should be called for each entity to remove them from the entity system.- Each entity should call
dispose()
to release resources.
7. Unloading Assets on Disposal
Purpose:
To verify that all assets loaded for the cutscene are unloaded when the cutscene is disposed of.
Expected Results:
ResourceService.unloadAssets()
should be called with the correct texture paths to free up resources.- The background, animations, and any other cutscene-related assets should be correctly unloaded.
8. Triggering Events During Cutscene
Purpose:
To verify that the nextCutscene()
method triggers the appropriate events for transitioning between scenes or ending the cutscene.
Expected Results:
- During a cutscene, calling
nextCutscene()
should correctly dispose of the current scene's entities and load the next scene. - If no more scenes are available, the
entity.getEvents().trigger("cutsceneEnded")
event should be fired.