Skip to content

Conversation

@lucasmerlin
Copy link
Collaborator

@github-actions
Copy link

github-actions bot commented Oct 16, 2025

Preview available at https://egui-pr-preview.github.io/pr/7643-lucaskittest-toml
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@lucasmerlin lucasmerlin added feature New feature or request egui_kittest labels Oct 16, 2025

[mac]
# Since our CI runs snapshot tests on macOS, this is our source of truth.
threshold = 0.6
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to go lower here, but the redering test fails with a 0.6 between CI mac and my mac. The other tests are fine with 0.1 though


loop {
// Check if Cargo.toml exists in this directory
if current_dir.join("Cargo.lock").exists() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we look for the first parent with a kittest.toml in it? 🤷

let config_path = project_root.join("kittest.toml");
if config_path.exists() {
let config_str =
std::fs::read_to_string(config_path).expect("Failed to read config file");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error should mention the path

std::fs::read_to_string(config_path).expect("Failed to read config file");
match toml::from_str(&config_str) {
Ok(config) => return config,
Err(e) => panic!("Failed to parse config file: {e}"),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error should mention the path

}

impl Config {
pub fn get() -> &'static Self {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring!

Also, maybe call this fn global or workspace or something for clarity?

/// The output path for image snapshots.
///
/// Default is "tests/snapshots".
pub fn output_path(&self) -> PathBuf {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To where is the path relative?

Config::default()
}

pub fn config() -> &'static Config {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring

impl Default for OsThreshold<usize> {
/// Returns the default `failed_pixel_count_threshold` as configured in `kittest.toml`
///
/// The default is `0`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the default whatever is in kittest.toml?

impl Default for OsThreshold<f32> {
/// Returns the default `threshold` as configured in `kittest.toml`
///
/// The default is `0.6`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -0,0 +1,10 @@
output_path = "tests/snapshots"

# Other oses get a higher threshold so they can still run tests locally without failures due to small rendering
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Other oses get a higher threshold so they can still run tests locally without failures due to small rendering
# Other OSes get a higher threshold so they can still run tests locally without failures due to small rendering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui_kittest feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants