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

  1. Class Setup and Teardown
    Purpose: To ensure that services are correctly registered with the ServiceLocator and cleared after all tests.
    Expected Results:

    • RenderService and ResourceService should be mocked and registered correctly.
    • After tests complete, the ServiceLocator should be cleared.
  2. Batch Initialisation
    Purpose: To verify that the SpriteBatch used in the tests is correctly initialised.
    Expected Results:

    • batch should not be null.
  3. Create Method
    Purpose: To verify that DocketLineDisplay correctly adds UI components to the stage upon creation.
    Expected Results:

    • The create() method should add actors to the stage at least once.
  4. 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.
  5. Dispose Method
    Purpose: To verify that DocketLineDisplay correctly disposes of resources.
    Expected Results:

    • The table should be cleared upon calling dispose().
  6. Get and Set PinLine
    Purpose: To ensure that the pinLine image can be assigned and retrieved correctly.
    Expected Results:

    • Setting a new Image as the pin line should allow the same Image to be retrieved with getPinLine().
  7. Get and Set Table
    Purpose: To ensure that the Table object can be assigned and retrieved correctly.
    Expected Results:

    • Setting a new Table should allow the same Table to be retrieved with getTable().
  8. Get and Set Stage
    Purpose: To verify that the Stage object can be assigned and retrieved correctly.
    Expected Results:

    • Setting a new Stage should allow the same Stage to be retrieved with getStage().
  9. Get Z Index
    Purpose: To confirm that the ZIndex of DocketLineDisplay is correctly set.
    Expected Results:

    • getZIndex() should return 2f.
  10. Draw Method
    Purpose: To verify that the draw() method works correctly with the SpriteBatch.
    Expected Results:

    • Since drawing is managed by the Stage, batch interactions do not need to be verified.

The following video demonstrates the resizing functionality added to DocketLineDisplay.

https://github.com/user-attachments/assets/446cf6c1-a8ab-4ce3-98c5-55e1bff139b9