DocketLineDisplay - UQcsse3200/2024-studio-3 GitHub Wiki
Test Environment
- Framework: JUnit 5
- Objects Used:
DocketLineDisplay(under test)Stage,Image,Table,Skin,Texture(mocked)ServiceLocator,RenderService,ResourceService(mocked)
Test Cases - Testing DocketLineDisplay Component Methods
-
Class Setup and Teardown
Purpose: To ensure that services are correctly registered with theServiceLocatorand cleared after all tests.
Expected Results:RenderServiceandResourceServiceshould be mocked and registered correctly.- After tests complete, the
ServiceLocatorshould be cleared.
-
Batch Initialisation
Purpose: To verify that theSpriteBatchused in the tests is correctly initialised.
Expected Results:batchshould not benull.
-
Create Method
Purpose: To verify thatDocketLineDisplaycorrectly adds UI components to the stage upon creation.
Expected Results:- The
create()method should add actors to the stage at least once.
- The
-
Resize Method
Purpose: To ensure that the UI is correctly reset and components are re-added upon resizing.
Expected Results:- The
pinLineimage should be removed. - The
tableshould be cleared. - The
stageshould receive new actors at least once.
- The
-
Dispose Method
Purpose: To verify thatDocketLineDisplaycorrectly disposes of resources.
Expected Results:- The
tableshould be cleared upon callingdispose().
- The
-
Get and Set PinLine
Purpose: To ensure that thepinLineimage can be assigned and retrieved correctly.
Expected Results:- Setting a new
Imageas the pin line should allow the sameImageto be retrieved withgetPinLine().
- Setting a new
-
Get and Set Table
Purpose: To ensure that theTableobject can be assigned and retrieved correctly.
Expected Results:- Setting a new
Tableshould allow the sameTableto be retrieved withgetTable().
- Setting a new
-
Get and Set Stage
Purpose: To verify that theStageobject can be assigned and retrieved correctly.
Expected Results:- Setting a new
Stageshould allow the sameStageto be retrieved withgetStage().
- Setting a new
-
Get Z Index
Purpose: To confirm that theZIndexofDocketLineDisplayis correctly set.
Expected Results:getZIndex()should return2f.
-
Draw Method
Purpose: To verify that thedraw()method works correctly with theSpriteBatch.
Expected Results:- Since drawing is managed by the
Stage, batch interactions do not need to be verified.
- Since drawing is managed by the
The following video demonstrates the resizing functionality added to DocketLineDisplay.
https://github.com/user-attachments/assets/446cf6c1-a8ab-4ce3-98c5-55e1bff139b9