Docket - UQcsse3200/2024-studio-3 GitHub Wiki
Test Environment
- Framework: JUnit 5
- Objects Used: Docket (under test), Skin (mocked), Image (mocked)
Test Cases - Testing Docket Component Methods
-
Docket Initialisation
Purpose: To verify that theDocketcomponent is properly initialised with default values.
Expected Results:- Two
Docketinstances (docketanddocket2) should be created without errors. - The start time of the second docket (
docket2) should be initialised and greater than 0.
- Two
-
Get Current Texture Name
Purpose: To verify that the current texture name is correctly retrieved based on the drawable image assigned.
Expected Results:- When the drawable is set, the returned texture name should match the first texture name in the texture array.
- When the drawable is
null, the returned texture name should be"none".
-
Update Docket Textures
Purpose: To verify that theDocketupdates its textures correctly based on the remaining recipe time.
Expected Results:- When paused, the texture should not change regardless of time updates.
- When resumed, the texture should update appropriately based on the remaining time:
- Remaining time = 1.5s → First texture.
- Remaining time = 0.3s → Second texture.
- Remaining time = 1s, total recipe time = 10s → Third texture.
- Remaining time < 0 → Final texture.
-
Set and Get Recipe Time
Purpose: To verify that the recipe time is correctly set and retrieved.
Expected Results:- Setting recipe time to 1.5 should return 1.5 when retrieved.
- Setting recipe time to 3.8 should return 3.8 when retrieved.
-
Set and Get Pause State
Purpose: To ensure that the pause state can be toggled and retrieved correctly.
Expected Results:- After setting paused to
true,getPaused()should returntrue. - After setting paused to
false,getPaused()should returnfalse.
- After setting paused to
-
Set and Get Skin
Purpose: To verify that a new skin can be assigned to theDocketand retrieved correctly.
Expected Results:- After setting a mocked
Skin,getSkin()should return the sameSkininstance.
- After setting a mocked
-
Set and Get Docket Image
Purpose: To ensure that the docket image can be assigned and retrieved correctly.
Expected Results:- After setting a mocked
Image,getDocketImage()should return the sameImageinstance.
- After setting a mocked
-
Default Start Time Initialisation
Purpose: To confirm that the start time is correctly initialised upon docket creation.
Expected Results:getStartTime()should return a value greater than 0.
-
Set and Get Cell Hash
Purpose: To verify that the cell hash value is correctly assigned and retrieved.
Expected Results:- Setting the cell hash to 12345 should return 12345 when retrieved.
-
Get Texture Name Array
Purpose: To confirm that the texture name array is initialised with the correct values and length.
Expected Results:getTextureNameArray()should not returnnull.- The length of the texture name array should be 4.