From da39198142a363f79ff24b9373ad5fe910067436 Mon Sep 17 00:00:00 2001 From: Lucas Meurer Date: Thu, 9 Oct 2025 12:00:39 +0200 Subject: [PATCH] Some minor docs improvements (#7614) --- crates/egui/src/gui_zoom.rs | 2 +- crates/egui_kittest/README.md | 6 +++--- crates/egui_kittest/src/lib.rs | 1 + crates/egui_kittest/src/snapshot.rs | 1 + scripts/docs.sh | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/gui_zoom.rs b/crates/egui/src/gui_zoom.rs index 5e24ad2d..4242d927 100644 --- a/crates/egui/src/gui_zoom.rs +++ b/crates/egui/src/gui_zoom.rs @@ -1,4 +1,4 @@ -//! Helpers for zooming the whole GUI of an app (changing [`Context::pixels_per_point`]. +//! Helpers for zooming the whole GUI of an app (changing [`Context::pixels_per_point`]). //! use crate::{Button, Context, Key, KeyboardShortcut, Modifiers, Ui}; diff --git a/crates/egui_kittest/README.md b/crates/egui_kittest/README.md index 64004a9c..b774572f 100644 --- a/crates/egui_kittest/README.md +++ b/crates/egui_kittest/README.md @@ -50,8 +50,8 @@ This is so that you can set `UPDATE_SNAPSHOTS=true` and update all tests, withou If you want to update all snapshot images, even those that are within error margins, run with `UPDATE_SNAPSHOTS=force`. -If you want to have multiple snapshots in the same test, it makes sense to collect the results in a `Vec` -([look here](https://github.com/emilk/egui/blob/70a01138b77f9c5724a35a6ef750b9ae1ab9f2dc/crates/egui_demo_lib/src/demo/demo_app_windows.rs#L388-L427) for an example). +If you want to have multiple snapshots in the same test, it makes sense to collect the results in a `SnapshotResults` +([look here](https://github.com/emilk/egui/blob/d1fcd740ded5d69016c993a502b52e67f5d492d7/crates/egui_demo_lib/src/demo/demo_app_windows.rs#L387-L420) for an example). This way they can all be updated at the same time. You should add the following to your `.gitignore`: @@ -67,7 +67,7 @@ You should add the following to your `.gitignore`: * …they are brittle since unrelated side effects (like a change in color) can cause the test to fail * …images take up repo space * images should… - * …be checked in or otherwise be available (egui use [git LFS](https://git-lfs.com/) files for this purpose) + * …be checked in or otherwise be available (egui uses [git LFS](https://git-lfs.com/) files for this purpose) * …depict exactly what's tested and nothing else * …have a low resolution to avoid growth in repo size * …have a low comparison threshold to avoid the test passing despite unwanted differences (the default threshold should be fine for most usecases!) diff --git a/crates/egui_kittest/src/lib.rs b/crates/egui_kittest/src/lib.rs index ebeba65a..e331119e 100644 --- a/crates/egui_kittest/src/lib.rs +++ b/crates/egui_kittest/src/lib.rs @@ -52,6 +52,7 @@ impl Display for ExceededMaxStepsError { } /// The test Harness. This contains everything needed to run the test. +/// /// Create a new Harness using [`Harness::new`] or [`Harness::builder`]. /// /// The [Harness] has a optional generic state that can be used to pass data to the app / ui closure. diff --git a/crates/egui_kittest/src/snapshot.rs b/crates/egui_kittest/src/snapshot.rs index 90a59857..c1153320 100644 --- a/crates/egui_kittest/src/snapshot.rs +++ b/crates/egui_kittest/src/snapshot.rs @@ -26,6 +26,7 @@ pub struct SnapshotOptions { } /// Helper struct to define the number of pixels that can differ before the snapshot is considered a failure. +/// /// This is useful if you want to set different thresholds for different operating systems. /// /// The default values are 0 / 0.0 diff --git a/scripts/docs.sh b/scripts/docs.sh index ee8f863f..5d755ddc 100755 --- a/scripts/docs.sh +++ b/scripts/docs.sh @@ -4,6 +4,6 @@ script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/.." cargo doc -p eframe --target wasm32-unknown-unknown --lib --no-deps -cargo doc -p emath -p epaint -p egui -p eframe -p egui-winit -p egui_extras -p egui_glow --lib --no-deps --all-features --open +cargo doc -p emath -p epaint -p egui -p eframe -p egui-winit -p egui_extras -p egui_glow -p egui_kittest --lib --no-deps --all-features --open # cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features'