Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pixel_threshold and improve threshold docs #5683

Open
lucasmerlin opened this issue Feb 5, 2025 · 3 comments
Open

Add pixel_threshold and improve threshold docs #5683

lucasmerlin opened this issue Feb 5, 2025 · 3 comments
Labels
egui_kittest rerun Desired for Rerun.io

Comments

@lucasmerlin
Copy link
Collaborator

Sometimes visual threshold isn't enough and it would be nice to just allow x pixels to be different

@lucasmerlin lucasmerlin added egui_kittest rerun Desired for Rerun.io labels Feb 5, 2025
@teh-cmc
Copy link
Collaborator

teh-cmc commented Feb 5, 2025

Workaround we use right now:

    let broken_percent_threshold = 0.003;
    let num_pixels = (size.x * size.y).ceil() as f64;

    use re_viewer_context::external::egui_kittest;
    match harness.try_snapshot(name) {
        Ok(_) => {}

        Err(err) => match err {
            egui_kittest::SnapshotError::Diff {
                name,
                diff: num_broken_pixels,
                diff_path,
            } => {
                let broken_percent = num_broken_pixels as f64 / num_pixels;
                re_log::debug!(num_pixels, num_broken_pixels, broken_percent);
                assert!(
                    broken_percent <= broken_percent_threshold,
                    "{name} failed because {broken_percent} > {broken_percent_threshold}\n{diff_path:?}"
                )
            }

            _ => panic!("{name} failed: {err}"),
        },
    }

@emilk emilk added this to egui Feb 5, 2025
@emilk
Copy link
Owner

emilk commented Feb 11, 2025

@Wumpf Do we still need this after mergning

@Wumpf
Copy link
Collaborator

Wumpf commented Feb 11, 2025

Yes absolutely. Even with AA disabled, we still have one (down from several) test where this is needed and there is many reasons why we may run into problems that need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
egui_kittest rerun Desired for Rerun.io
Projects
Status: No status
Development

No branches or pull requests

4 participants