Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.46 KB

AwtApprovals.md

File metadata and controls

45 lines (29 loc) · 1.46 KB

AwtApprovals

Contents

Paintables

Why

Java AWT is a nice utility for rendering simple graphics, but it does not play well with CI systems, especially when it is headless. Paintables provides an abstraction that allows you to use Awt independently of OS and CI.

How To

create an animated gif

Sometimes you want to verify a series of steps. A great way to visualize this is with an animated gif.

Hexagonal Game of Life

To create such a gif you pass the number of frames you want plus a function that returns a Paintable for every frame. Here is an example for a simple expanding box:

SquareDrawer squareDrawer = new SquareDrawer();
AwtApprovals.verifySequence(5, f -> squareDrawer.setSquareSize(f * 10));

snippet source | anchor

Note: Method overloads allow specifying the time between frames or the time for each frame.