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 theServiceLocator
and cleared after all tests.
Expected Results:RenderService
andResourceService
should be mocked and registered correctly.- After tests complete, the
ServiceLocator
should be cleared.
-
Batch Initialisation
Purpose: To verify that theSpriteBatch
used in the tests is correctly initialised.
Expected Results:batch
should not benull
.
-
Create Method
Purpose: To verify thatDocketLineDisplay
correctly 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
pinLine
image should be removed. - The
table
should be cleared. - The
stage
should receive new actors at least once.
- The
-
Dispose Method
Purpose: To verify thatDocketLineDisplay
correctly disposes of resources.
Expected Results:- The
table
should be cleared upon callingdispose()
.
- The
-
Get and Set PinLine
Purpose: To ensure that thepinLine
image can be assigned and retrieved correctly.
Expected Results:- Setting a new
Image
as the pin line should allow the sameImage
to be retrieved withgetPinLine()
.
- Setting a new
-
Get and Set Table
Purpose: To ensure that theTable
object can be assigned and retrieved correctly.
Expected Results:- Setting a new
Table
should allow the sameTable
to be retrieved withgetTable()
.
- Setting a new
-
Get and Set Stage
Purpose: To verify that theStage
object can be assigned and retrieved correctly.
Expected Results:- Setting a new
Stage
should allow the sameStage
to be retrieved withgetStage()
.
- Setting a new
-
Get Z Index
Purpose: To confirm that theZIndex
ofDocketLineDisplay
is 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