Test Cases: Slides (Help Menu) - UQcsse3200/2024-studio-2 GitHub Wiki

Test Cases for slides (Help Menu)

Test Case 1: Verify Labels in MovementSlide

Objective: Ensure that the title and content labels are correctly added to the MovementSlide.

Preconditions: The MovementSlide object is instantiated.

Test Steps:

  • Create an instance of MovementSlide with a mock Skin.
  • Retrieve the labels added to the slide.

Expected Result:

  • The first label should have the text "Movement Instructions".
  • The second label should have the text "Move the dog with WASD keys!!"

Test Case 2: Verify DogActor Initialization

Objective: Ensure that the DogActor is created and added to the MovementSlide.

Preconditions: The MovementSlide object is instantiated.

Test Steps:

  • Instantiate the MovementSlide class.
  • Check if the dogActor object is not null.
  • Verify that the dogActor is added as a child to the MovementSlide.

Expected Result:

  • The dogActor should be initialized.
  • The dogActor should be part of the MovementSlide's children.

Test Case 3: Test Dog Movement (W Key)

Objective: Simulate pressing the W key and check if the DogActor moves upward.

Preconditions:

  • MovementSlide is instantiated.
  • The W key is pressed.

Test Steps:

  • Simulate the press of the W key.
  • Call the act() method of the DogActor with a delta time of 1 second.
  • Check the Y position of the dogActor.

Expected Result:

  • The dogActor's Y position should increase after pressing the W key.

Test Case 4: Test Dog Movement (Boundary Check)

Objective: Ensure that the DogActor does not move outside the boundaries of the slide.

Preconditions:

  • MovementSlide is instantiated.
  • The dog is placed at the boundary of the slide.

Test Steps:

  • Set the dogActor's position near the left boundary (e.g., dogX = 0).
  • Simulate pressing the A key (move left).
  • Check the dogX position after the movement.

Expected Result:

  • The dogX position should not be less than 0 (dog stays within the boundary).