mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-26 19:56:48 -06:00
Merge pull request #2524 from Silvertree2010:fix/2453-row-height-dialog-uses-pixels-sh
This commit is contained in:
@@ -221,8 +221,8 @@ impl Dialog {
|
||||
"rowHeight",
|
||||
"Row Height",
|
||||
"home.rowHeight",
|
||||
vec![Number { key: "height", label: "Row height (pixels):" }],
|
||||
json!({"height": app.session.active().and_then(|d| d.wb.active().map(|s| s.row_height(d.selection.active.row))).unwrap_or(20.0)}),
|
||||
vec![Number { key: "points", label: "Row height (points):" }],
|
||||
json!({"points": app.session.active().and_then(|d| d.wb.active().map(|s| s.row_height(d.selection.active.row) as f64 * 0.75)).unwrap_or(15.0)}),
|
||||
),
|
||||
"columnWidth" => Dialog::form(
|
||||
"columnWidth",
|
||||
|
||||
@@ -51,13 +51,15 @@ fn row_height_opens_with_the_height_ready_to_type() {
|
||||
let mut h = harness();
|
||||
h.state_mut().open_dialog("rowHeight", json!({}));
|
||||
h.run_steps(6);
|
||||
type_and_enter(&mut h, "40");
|
||||
let shown = h.state().dialog.as_ref().and_then(|d| d.values.get("points")).and_then(|v| v.as_f64());
|
||||
assert!(shown.is_some_and(|v| (v - 15.0).abs() < 0.01), "a default row opens at 15 points, got {shown:?}");
|
||||
type_and_enter(&mut h, "30");
|
||||
assert!(h.state().dialog.is_none(), "Enter confirmed the dialog");
|
||||
let height = {
|
||||
let d = h.state().session.active().unwrap();
|
||||
d.wb.active().unwrap().row_height(CellRef::parse("C3").unwrap().row)
|
||||
};
|
||||
assert!((height as f64 - 40.0).abs() < 0.6, "row 3 is 40 high, got {height}");
|
||||
assert!((height as f64 - 40.0).abs() < 0.6, "row 3 is 30 points (40 pixels) high, got {height}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user