Skip to content

Repository files navigation

Lookalike

Golden image comparison for Ruby graphics.

Gem Version Downloads Ruby Version License

Features · Installation · Quick Start


Lookalike turns rendered images into visual regression tests. It compares Tessel images, file paths, and framebuffer-like objects, then writes actionable diffs for failed snapshots.

Features

  • Channel and YIQ perceptual comparison modes.
  • Per-pixel deltas, allowed-pixel limits, bounding boxes, and diff images.
  • Optional antialiasing detection for cleaner UI and text snapshots.
  • RSpec, Minitest, and Test::Unit assertion helpers.
  • Snapshot approval flow for local development and CI.
  • HTML reports with an expected/actual overlay slider.

Installation

Add Lookalike to your Gemfile:

gem "lookalike"

Then run:

bundle install

Or install the released gem:

gem install lookalike

Requirements

  • Ruby 3.1 or newer.
  • Tessel is installed automatically as a runtime dependency.

Quick Start

require "lookalike"

actual = Tessel.read("actual.png")
result = Lookalike.compare("expected.png", actual, mode: :channel, max_delta: 1)
abort result.inspect unless result.match?

For snapshot assertions, include Lookalike::Assertions in the test context:

include Lookalike::Assertions

assert_snapshot(render_scene, "home")

Missing snapshots are pending locally. Approve them with:

LOOKALIKE_UPDATE=1 bundle exec rake
lookalike approve NAME
lookalike approve --all
lookalike report tmp/lookalike

Set CI to make missing snapshots fail.

Development

bundle install
bundle exec rake verify

Contributing

Bug reports and pull requests are welcome at rbgfx/lookalike.

License

MIT

About

Visual regression testing for Ruby graphics with perceptual image comparison and useful diffs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages