Skip to content

ResourceSpriteTestSuite: Split the single fact into one-fact-per-scenario #348

Description

@YYDan

Description

ResourceSpriteTestSuite was never covered by the summer 2024 refactor campaign. The whole suite is one fact, sprite_add, containing 6 asserts across 34 lines — it reports a single result for six distinct checks.

The six checks are: the sprite is valid, it has the correct subimage count, the correct width, the correct height, it preserves colour when alpha is 0, and it deletes successfully.

The colour-preservation assert requires a surface and buffer round-trip, so that scenario carries real setup; the rest are cheap property reads on the same added sprite. Each new fact should call sprite_add() and sprite_delete() itself so it is self-contained.

This suite is also very thin for the area it covers — one function out of the whole sprite API. A follow-up test-proposal issue for broader sprite_* coverage would be worthwhile, but is out of scope here.

Target: 6 facts.

Script Name

ResourceSpriteTestSuite

Steps To The Task

  • Split sprite_add into 6 facts named sprite_add #1 through sprite_add #6
  • Give each fact its own sprite_add() / sprite_delete() so it is self-contained
  • Keep the surface and buffer setup confined to the colour-preservation fact, and free both within it
  • Add a // SPRITE ADD TESTS section comment header
  • Update assert descriptions so they identify the specific scenario
  • Run the suite on VM and YYC and confirm the same set of checks pass as before

Metadata

Metadata

Assignees

Labels

refactorAn improvement to existing test/module code

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions