Project

lookalike

0.0
The project is in a healthy, maintained state
Channel and perceptual visual regression testing with PNG diffs.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.1.0, < 1
 Project Readme

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