Main Game Order Button Display - UQcsse3200/2024-studio-3 GitHub Wiki
Test Environment
- Framework: JUnit 5
- Objects Used:
MainGameOrderBtnDisplay(under test)RenderService,Stage,DocketService(mocked)Entity,SpriteBatch(mocked)
Test Cases - Testing MainGameOrderBtnDisplay Component Methods
-
Component Setup
Purpose: To ensure that theMainGameOrderBtnDisplaycomponent is correctly initialised and registered with required services.
Expected Results:RenderServiceandDocketServiceshould be mocked and registered withServiceLocator.- The stage for the button display should be correctly assigned during setup.
-
Button Creation
Purpose: To verify that the button display correctly adds UI actors when theaddActors()method is called.
Expected Results:- The
addActors()method should be called at least once during the test.
- The
-
Component Association with Entity
Purpose: To verify that theMainGameOrderBtnDisplaycomponent is correctly associated with anEntity.
Expected Results:- Adding the button display to an entity should allow retrieval of the same entity through
getEntity().
- Adding the button display to an entity should allow retrieval of the same entity through
-
Dispose Method Functionality
Purpose: To ensure that thedispose()method correctly clears UI elements when called.
Expected Results:- Before disposal, the table should contain children elements.
- After calling
dispose(), the table should have no children elements.
-
Dummy Test for Draw Method
Purpose: To acknowledge that thedraw()method currently performs no meaningful operations.
Expected Results:- The
draw()method should run without exceptions or side effects.
- The
-
Get Z Index
Purpose: To confirm that theZIndexof the button display is correctly set.
Expected Results:getZIndex()should return2f.
-
Get and Set State
Purpose: To verify that the state of the button display can be toggled and retrieved correctly.
Expected Results:- Setting the state to
trueshould returntruefromgetState(). - Setting the state to
falseshould returnfalsefromgetState().
- Setting the state to