mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-29 21:06:50 -06:00
M2: doc comments for the padding diff's functions
This commit is contained in:
@@ -149,6 +149,7 @@ mod tests {
|
||||
assert!(s.execute("node.set", &json!({"id": b, "props": {"absolute": "maybe"}})).is_err());
|
||||
}
|
||||
|
||||
/// Each side key writes its own padding slot and leaves the other three alone.
|
||||
#[test]
|
||||
fn each_side_padding_sets_its_side_alone() {
|
||||
let mut s = Session::new();
|
||||
|
||||
@@ -401,6 +401,8 @@ fn alignment(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], l: &AutoLayout) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Spacing row: gap fields, then the H/V padding pair (or the 2x2 per-side
|
||||
/// grid while the individual-padding toggle is open).
|
||||
fn spacing(app: &mut FigApp, ui: &mut Ui, ids: &[NodeId], l: &AutoLayout) {
|
||||
let col = widgets::col_width(ui.available_width());
|
||||
let [pt, pr, pb, pl] = l.padding;
|
||||
|
||||
@@ -23,16 +23,19 @@ fn scene() -> (Ui, NodeId) {
|
||||
(Ui::new(s), f)
|
||||
}
|
||||
|
||||
/// The frame's padding as `[top, right, bottom, left]`.
|
||||
fn padding(u: &Ui, f: NodeId) -> [f64; 4] {
|
||||
u.app.session.doc().unwrap().node(f).unwrap().layout.clone().unwrap().padding
|
||||
}
|
||||
|
||||
/// A full press-and-release at `p`, then settling one frame.
|
||||
fn click(u: &mut Ui, p: Pos2) {
|
||||
u.button(p, true);
|
||||
u.button(p, false);
|
||||
u.frame(vec![]);
|
||||
}
|
||||
|
||||
/// A press-and-release of Enter, committing the focused number field.
|
||||
fn enter(u: &mut Ui) {
|
||||
u.frame(vec![
|
||||
Event::Key { key: Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE },
|
||||
@@ -51,6 +54,8 @@ fn named_button(u: &mut Ui, label: &str) -> Pos2 {
|
||||
pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)
|
||||
}
|
||||
|
||||
/// The side fields stay hidden until the toggle opens, then typing in one sets
|
||||
/// that side alone in a single undo step.
|
||||
#[test]
|
||||
fn side_fields_show_only_once_the_toggle_opens_and_set_one_side() {
|
||||
let (mut u, f) = scene();
|
||||
|
||||
Reference in New Issue
Block a user