Module visual

Module visual 

Source
Expand description

Visual regression testing for TUI applications

Provides comprehensive visual testing including color, style, and layout comparison. Unlike simple text snapshots, visual tests capture the full rendered appearance.

§Features

FeatureDescription
Full Render CaptureColors, styles, and text
Diff VisualizationSee exactly what changed
Threshold TestingAllow minor variations
CI IntegrationGitHub Actions, GitLab CI

§Example

use revue::testing::{VisualTest, VisualTestConfig};

#[test]
fn test_button_styles() {
    let mut test = VisualTest::new("button_styles");

    // Render your widget
    let buffer = render_button();

    // Compare against golden file
    test.assert_matches(&buffer);
}

§Updating Golden Files

# Update all visual tests
REVUE_UPDATE_VISUALS=1 cargo test

# Update specific test
REVUE_UPDATE_VISUALS=1 cargo test test_button_styles

Structs§

CapturedCell
Captured cell data
CellDiff
Difference in a single cell
VisualCapture
Captured visual state of a buffer
VisualDiff
Difference between two captures
VisualTest
Visual regression test instance
VisualTestConfig
Configuration for visual regression tests

Enums§

VisualTestResult
Result of a visual test