mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-19 11:57:26 +00:00
Design-lint: non-exhaustive types, focus through runtime::egui, prop setters, relation in guides trial
This commit is contained in:
@@ -161,11 +161,12 @@ fn position_text_that_does_not_parse_keeps_ok_from_making_a_guide() {
|
||||
let position = fixture.by_label("Position").expect("the Position field");
|
||||
fixture.click(&position).settle();
|
||||
fixture.key(egui::Key::A, egui::Modifiers::COMMAND);
|
||||
fixture.type_text("40").settle();
|
||||
let typed = 40.0;
|
||||
fixture.type_text(&typed.to_string()).settle();
|
||||
assert!(enabled.get(), "a number enables OK again");
|
||||
let ok = fixture.by_label("OK").expect("the footer has OK");
|
||||
fixture.click(&ok).settle();
|
||||
assert!(!open.get(), "OK closes the dialog");
|
||||
let confirmed: Vec<_> = made.borrow().iter().map(|guide| guide.position).collect();
|
||||
assert_eq!(confirmed, [40.0]);
|
||||
assert_eq!(confirmed, [typed], "OK makes the guide at the typed position");
|
||||
}
|
||||
|
||||
@@ -164,7 +164,8 @@ pub struct CanvasSize<'a> {
|
||||
/// The bytes one pixel takes, for the file size readouts.
|
||||
#[prop(quantity = "bytes per pixel")]
|
||||
bytes_per_pixel: f64,
|
||||
/// The held OK of a hosted dialog.
|
||||
/// The held OK of a hosted dialog ([`Hold`]).
|
||||
#[prop(name = "hold_ok", vis = "pub(crate)")]
|
||||
hold: Hold<CanvasSizeValues>,
|
||||
}
|
||||
|
||||
@@ -174,12 +175,6 @@ impl<'a> CanvasSize<'a> {
|
||||
CanvasSize { values, open: None, bytes_per_pixel: 4.0, hold: Hold::default() }
|
||||
}
|
||||
|
||||
/// Holds the OK of a hosted dialog ([`Hold`]).
|
||||
fn hold_ok(mut self, hold: Hold<CanvasSizeValues>) -> Self {
|
||||
self.hold = hold;
|
||||
self
|
||||
}
|
||||
|
||||
/// Shows the dialog.
|
||||
pub fn show(self, ui: &mut Ui) -> CanvasSizeOutput {
|
||||
let CanvasSize { values, open, bytes_per_pixel, hold } = self;
|
||||
|
||||
@@ -163,7 +163,8 @@ pub struct ImageSize<'a> {
|
||||
/// document's depth, no alpha (1/8 for Bitmap, 1 for Indexed).
|
||||
#[prop(quantity = "bytes per pixel")]
|
||||
bytes_per_pixel: f64,
|
||||
/// The held OK of a hosted dialog.
|
||||
/// The held OK of a hosted dialog ([`Hold`]).
|
||||
#[prop(name = "hold_ok", vis = "pub(crate)")]
|
||||
hold: Hold<ImageSizeValues>,
|
||||
}
|
||||
|
||||
@@ -173,12 +174,6 @@ impl<'a> ImageSize<'a> {
|
||||
ImageSize { values, open: None, methods: Vec::new(), bytes_per_pixel: 4.0, hold: Hold::default() }
|
||||
}
|
||||
|
||||
/// Holds the OK of a hosted dialog ([`Hold`]).
|
||||
fn hold_ok(mut self, hold: Hold<ImageSizeValues>) -> Self {
|
||||
self.hold = hold;
|
||||
self
|
||||
}
|
||||
|
||||
/// Shows the dialog.
|
||||
pub fn show(self, ui: &mut Ui) -> ImageSizeOutput {
|
||||
let ImageSize { values, open, methods, bytes_per_pixel, hold } = self;
|
||||
|
||||
Reference in New Issue
Block a user