Skip to content

Test Plan for Inventory Display

Sourav-RC edited this page Oct 16, 2024 · 1 revision

1. Introduction

This test plan outlines the test cases for the InventoryDisplay class. The InventoryDisplay is responsible for creating and managing the visual representation of a player's inventory in the game, including displaying items and updating the UI when the inventory changes.

2. Test Objectives

  • Verify the correct initialization of the InventoryDisplay
  • Ensure proper creation and management of UI elements
  • Test the updating of the display when inventory changes
  • Verify the handling of different item types and states
  • Test edge cases and error handling

3. Test Cases

3.1 Initialization Tests

3.1.1 Default Constructor

  • Test Method: testDefaultConstructor()
  • Objective: Verify that the InventoryDisplay initializes correctly with default slot size.
  • Expected Result: The component should initialize with a slot size of 200.

3.1.2 Custom Constructor

  • Test Method: testCustomConstructor()
  • Objective: Ensure that the InventoryDisplay initializes correctly with a custom slot size.
  • Expected Result: The component should initialize with the specified slot size.

3.1.3 Invalid Slot Size

  • Test Method: testInvalidSlotSize()
  • Objective: Verify that the InventoryDisplay throws an exception when initialized with invalid slot sizes.
  • Expected Result: An IllegalArgumentException should be thrown for slot sizes <= 0.

3.2 UI Creation Tests

3.2.1 Create with Empty Inventory

  • Test Method: testCreateWithEmptyInventory()
  • Objective: Ensure that the InventoryDisplay creates the correct number of empty slots for an empty inventory.
  • Expected Result: The display should create the correct number of slots, each containing only the background image.

3.2.2 Create with Items

  • Test Method: testCreateWithItems()
  • Objective: Verify that the InventoryDisplay correctly creates slots with items when the inventory contains items.
  • Expected Result: The display should create slots with both background and item images for occupied slots.

3.3 Update Tests

3.3.1 Update Inventory

  • Test Method: testUpdateInventory()
  • Objective: Ensure that the InventoryDisplay updates correctly when items are added or removed from the inventory.
  • Expected Result: The display should update to show new items, remove displayed items, and handle null texture paths.

3.4 Resource Management Tests

3.4.1 Asset Loading

  • Test Methods: Various (integrated into other tests)
  • Objective: Verify that the InventoryDisplay correctly loads and uses texture assets for slots and items.
  • Expected Result: The correct textures should be loaded for slots and items, including handling of null textures.

3.5 Disposal Tests

3.5.1 Dispose

  • Test Method: testDispose()
  • Objective: Ensure that the InventoryDisplay properly disposes of its resources.
  • Expected Result: All UI elements (table and slots) should be removed from the stage.

4. Test Execution

All tests should be executed as part of the test suite in InventoryDisplayTest.java. The testing framework (JUnit) will report on the success or failure of each test case.

5. Conclusion

This test plan covers the core functionality of the InventoryDisplay, including initialization, UI creation, updating, resource management, and disposal. Successful execution of all test cases will provide confidence in the robustness and correctness of the InventoryDisplay implementation.

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally