TestContext:expect_frame

Takes a screenshot of the latest frame drawn by love.draw() and compares it with a reference image. The test will fail if the two images are not identical. Upon failure, incorrect screenshots can be found under test-output/screenshots/.

Usage

context:expect_frame(path)

Arguments

Name Type Description
path string Path to the reference image.

Examples

crystal.test.add("Can draw blank screen", { resolution = [1280, 720] }, function(context)
  love.draw();
  -- Validate that the game drew a 1280x720 black frame by comparing the screen with a known image.
  context:expect_frame("test-data/black_1280x720.png");
end);

This site uses Just the Docs, a documentation theme for Jekyll.