QA targets for the newest UX reports (pending until their owners land): s37 browser chevrons on every node kind (all toggle; no Joints folder yet), s38 view animations to Top/Bottom end without a jump (the last frame turns 22.5 degrees today), s39 view cube edge/corner hover lights 2/3 patches, s40 toolbar Pin/Remove/reorder survive a restart and the workspace switcher spans the toolbar; ui_layout tests: every command dialog docked right at 260-380 px (or 480-560 for tables; the exploded view is 635), other windows fit on screen. Harness: published rects and counts, browser rows/fold arrows as handles, camera and view_anim steps, ui.at cube points, settings carried over a close restart, an adhoc scenario runner
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
1 parent
1e8fc25976
commit
c45f3173fa
11 files changed
+831
-9
No files matched your search
@@ -72,4 +72,22 @@ macro_rules! pending {
|
||||
|
||||
pending!(
|
||||
s31_sketch_on_face_projects: "user bug: a sketch on a face projects its loops as reference (solvecraft-sketch)",
|
||||
s37_browser_chevrons: "every chevron works; the browser has no Joints folder (solvecraft-shell)",
|
||||
s38_view_anim_no_jump: "the last frame of an animation to Top turns the view 22.5 degrees (solvecraft-ui)",
|
||||
s39_view_cube_hover: "view cube edge and corner hover light 1 patch, Fusion lights 2 and 3 (solvecraft-ui)",
|
||||
s40_toolbar_customize_persists: "toolbar Pin/Remove/reorder (toolbar:<id> handles, ui.menu toolbar_command) and a full-height workspace switcher (solvecraft-shell)",
|
||||
);
|
||||
|
||||
/// A scenario file named by `SOLVECRAFT_SCENARIO_FILE` (for trying one out):
|
||||
/// `SOLVECRAFT_SCENARIO_FILE=x.json cargo test --test scenarios adhoc -- --ignored --nocapture`.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn adhoc() {
|
||||
let Ok(path) = std::env::var("SOLVECRAFT_SCENARIO_FILE") else { return };
|
||||
let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{path}: {e}"));
|
||||
let steps: serde_json::Value = serde_json::from_str(&text).unwrap_or_else(|e| panic!("{path}: {e}"));
|
||||
let mut h = Harness::new();
|
||||
if let Err(e) = h.run(&steps) {
|
||||
panic!("{path}: {e}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,523 @@
|
||||
[
|
||||
{
|
||||
"note": "Browser chevrons expand and collapse every kind of node (folders, components, groups, the origin, named views, document settings). Model: two components with a body each, a joint, a sketch, an offset plane, a named view."
|
||||
},
|
||||
{
|
||||
"start": "FusionCreateNewComponentCommand"
|
||||
},
|
||||
{
|
||||
"key": "Enter"
|
||||
},
|
||||
{
|
||||
"start": "SketchCreate"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"plane": "XY"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "ShapeRectangleTwoPoint"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"sketch": [
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"sketch": [
|
||||
20,
|
||||
20
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Escape"
|
||||
},
|
||||
{
|
||||
"start": "SketchStop"
|
||||
},
|
||||
{
|
||||
"call": "ui.view",
|
||||
"params": {
|
||||
"view": "iso"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "Extrude"
|
||||
},
|
||||
{
|
||||
"text": "10"
|
||||
},
|
||||
{
|
||||
"key": "Enter"
|
||||
},
|
||||
{
|
||||
"call": "ui.menu",
|
||||
"params": {
|
||||
"x": 100,
|
||||
"y": 170,
|
||||
"target": {
|
||||
"type": "component",
|
||||
"id": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "ui.menuPick",
|
||||
"params": {
|
||||
"item": "Activate"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "FusionCreateNewComponentCommand"
|
||||
},
|
||||
{
|
||||
"key": "Enter"
|
||||
},
|
||||
{
|
||||
"start": "SketchCreate"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"plane": "XZ"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "ShapeRectangleTwoPoint"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"sketch": [
|
||||
30,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"sketch": [
|
||||
50,
|
||||
10
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Escape"
|
||||
},
|
||||
{
|
||||
"start": "SketchStop"
|
||||
},
|
||||
{
|
||||
"call": "ui.view",
|
||||
"params": {
|
||||
"view": "iso"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "Extrude"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"world": [
|
||||
40,
|
||||
0,
|
||||
5
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"text": "20"
|
||||
},
|
||||
{
|
||||
"key": "Enter"
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"bodies": 2,
|
||||
"errors": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "JointAssembleCmdNew"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"world": [
|
||||
10,
|
||||
10,
|
||||
10
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"world": [
|
||||
40,
|
||||
0,
|
||||
5
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget": "Rigid"
|
||||
},
|
||||
{
|
||||
"widget": "Revolute"
|
||||
},
|
||||
{
|
||||
"widget": "OK"
|
||||
},
|
||||
{
|
||||
"call": "engine.execute",
|
||||
"params": {
|
||||
"command": "ConstructionPlaneOffsetFromPlaneCommand",
|
||||
"params": {
|
||||
"base": "XY",
|
||||
"offset": 30
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Escape"
|
||||
},
|
||||
{
|
||||
"call": "ui.menu",
|
||||
"params": {
|
||||
"x": 100,
|
||||
"y": 300,
|
||||
"target": {
|
||||
"type": "named_views"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "ui.menuPick",
|
||||
"params": {
|
||||
"item": "New Named View"
|
||||
}
|
||||
},
|
||||
{
|
||||
"note": "Each kind of node: its chevron hides its children, and shows them again."
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Document Settings"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Units: mm"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Document Settings"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Units: mm"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Document Settings"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Units: mm"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Named View1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Named Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Named View1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Named Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Named View1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Origin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:XY"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Origin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:XY"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Origin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:XY"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Body2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Bodies"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Body2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Bodies"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Body2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Sketches"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Sketches"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Plane1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Construction"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Plane1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Construction"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Plane1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Component2:1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Component2:1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Component1:1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Sketch1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Component1:1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Sketch1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Origin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Untitled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"hidden_handles": [
|
||||
"row:Origin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Untitled"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"row:Origin"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"note": "The joints folder lists the joint (Fusion's Joints folder in the root component)."
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"fold:Joints"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Joints"
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "fold:Joints"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"shown_handles": [
|
||||
"fold:Joints"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
[
|
||||
{"note": "Animating to Top or Bottom from iso, front or any orbit turns the view smoothly to the end: no frame (the last included) turns it more than 10 degrees."},
|
||||
{"start": "PrimitiveBox"},
|
||||
{"key": "Escape"},
|
||||
{"view_anim": "top"},
|
||||
{"view_anim": "home"},
|
||||
{"view_anim": "bottom"},
|
||||
{"call": "ui.view", "params": {"view": "front"}},
|
||||
{"view_anim": "top"},
|
||||
{"call": "ui.view", "params": {"view": "front"}},
|
||||
{"view_anim": "bottom"},
|
||||
{"camera": {"yaw": 2.3, "pitch": 0.35}},
|
||||
{"view_anim": "top"},
|
||||
{"camera": {"yaw": -1.1, "pitch": -0.4}},
|
||||
{"view_anim": "top"},
|
||||
{"camera": {"yaw": 2.3, "pitch": 0.35}},
|
||||
{"view_anim": "bottom"},
|
||||
{"camera": {"yaw": 0.4, "pitch": 1.2}},
|
||||
{"view_anim": "front"}
|
||||
]
|
||||
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{"note": "View cube hover from the home view: a face lights one patch, an edge the 2 patches on its faces, a corner the 3 around it (Fusion)."},
|
||||
{"call": "ui.view", "params": {"view": "home"}},
|
||||
{"move": {"cube": [0, 0, 1]}},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 1}}},
|
||||
{"move": {"cube": [0, -0.9, 1]}},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 2}}},
|
||||
{"move": {"cube": [1, -0.9, 0]}},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 2}}},
|
||||
{"move": {"cube": [0.9, -0.9, 1]}},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 3}}},
|
||||
{"move": {"cube": [0.9, -1, 0.9]}},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 3}}},
|
||||
{"move": [800, 500]},
|
||||
{"expect": {"count": {"name": "cube_highlights", "value": 0}}}
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{"note": "Toolbar customizing like Fusion survives a restart: Pin to Toolbar, Remove from Toolbar, drag to reorder. Toolbar buttons publish handles `toolbar:<command id>`. The workspace switcher spans the toolbar's height."},
|
||||
{"expect": {"spans": {"inner": "workspace_switcher", "outer": "toolbar", "axis": "y", "tol": 6}}},
|
||||
{"expect": {"shown_handles": ["toolbar:Extrude", "toolbar:Revolve"], "hidden_handles": ["toolbar:FusionShellBodyCommand"]}},
|
||||
{"call": "ui.menu", "params": {"x": 400, "y": 80, "target": {"type": "toolbar_command", "id": "FusionShellBodyCommand"}}},
|
||||
{"call": "ui.menuPick", "params": {"item": "Pin to Toolbar"}},
|
||||
{"expect": {"shown_handles": ["toolbar:FusionShellBodyCommand"]}},
|
||||
{"call": "ui.menu", "params": {"x": 400, "y": 80, "target": {"type": "toolbar_command", "id": "Revolve"}}},
|
||||
{"call": "ui.menuPick", "params": {"item": "Remove from Toolbar"}},
|
||||
{"expect": {"hidden_handles": ["toolbar:Revolve"]}},
|
||||
{"drag": [{"handle": "toolbar:FusionShellBodyCommand"}, {"handle": "toolbar:Extrude"}], "steps": 12},
|
||||
{"expect": {"handle_order": ["toolbar:FusionShellBodyCommand", "toolbar:Extrude"]}},
|
||||
{"restart": "close"},
|
||||
{"expect": {"shown_handles": ["toolbar:FusionShellBodyCommand"], "hidden_handles": ["toolbar:Revolve"]}},
|
||||
{"expect": {"handle_order": ["toolbar:FusionShellBodyCommand", "toolbar:Extrude"]}},
|
||||
{"expect": {"spans": {"inner": "workspace_switcher", "outer": "toolbar", "axis": "y", "tol": 6}}}
|
||||
]
|
||||
@@ -0,0 +1,67 @@
|
||||
//! Layout checks over every toolbar command, headless (see `solvecraft_ui_egui::scenario`):
|
||||
//! each command's dialog opens docked at the viewport's right within its width limits, and
|
||||
//! every window it opens fits on screen.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use solvecraft_ui_egui::scenario::{Harness, check};
|
||||
|
||||
/// A box body (its sketch finished) to give feature dialogs something to work on.
|
||||
fn harness() -> Harness {
|
||||
let mut h = Harness::new();
|
||||
for (id, p) in [
|
||||
("SketchCreate", json!({"plane": "XY"})),
|
||||
("ShapeRectangleTwoPoint", json!({"p0": [0, 0], "p1": [40, 30]})),
|
||||
("SketchStop", json!({})),
|
||||
("Extrude", json!({"distance": 10})),
|
||||
] {
|
||||
h.call("engine.execute", json!({"command": id, "params": p}));
|
||||
}
|
||||
h.frames(3);
|
||||
h
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "pending: the exploded view dialog opens 635 px wide (solvecraft-ui)"]
|
||||
fn every_dialog_opens_docked_within_its_width_limits() {
|
||||
let mut bad = Vec::new();
|
||||
let mut seen = 0;
|
||||
for spec in solvecraft_engine::command_specs() {
|
||||
if spec.tab.is_empty() || spec.tab == "SKETCH" {
|
||||
continue;
|
||||
}
|
||||
let mut h = harness();
|
||||
h.call("ui.start", json!({"command": spec.id}));
|
||||
h.frames(4);
|
||||
if h.app.dialog.is_some() {
|
||||
seen += 1;
|
||||
// Command dialogs are 260–380 px (plus their 1 px border), the few with tables
|
||||
// (motion study, configurations) 480–560.
|
||||
let w = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_dialog"))).map_or(0.0, |r| r.width());
|
||||
let limits = if w > 400.0 { json!({"min": 480, "max": 562}) } else { json!({"min": 260, "max": 382}) };
|
||||
if let Err(e) = check(&mut h, &json!({ "dialog_docked": limits })) {
|
||||
bad.push(format!("{}: {e}", spec.id));
|
||||
}
|
||||
}
|
||||
if let Err(e) = check(&mut h, &json!({"windows_fit": {"max_width": 900}})) {
|
||||
bad.push(format!("{}: {e}", spec.id));
|
||||
}
|
||||
}
|
||||
assert!(seen > 20, "only {seen} commands opened a dialog");
|
||||
assert!(bad.is_empty(), "{} problems:\n{}", bad.len(), bad.join("\n"));
|
||||
}
|
||||
|
||||
/// Windows that are not command dialogs: each fits on screen.
|
||||
#[test]
|
||||
fn other_windows_fit_on_screen() {
|
||||
let mut bad = Vec::new();
|
||||
let opens: [(&str, Value); 3] = [("ui.help", json!({"item": "about"})), ("ui.key", json!({"key": "S"})), ("ui.prefs", json!({"open": true}))];
|
||||
for (m, p) in opens {
|
||||
let mut h = harness();
|
||||
h.call(m, p.clone());
|
||||
h.frames(4);
|
||||
if let Err(e) = check(&mut h, &json!({"windows_fit": {"max_width": 900}})) {
|
||||
bad.push(format!("{m} {p}: {e}"));
|
||||
}
|
||||
}
|
||||
assert!(bad.is_empty(), "{}", bad.join("\n"));
|
||||
}
|
||||
Reference in new issue
Block a user