forked from 1b-agent/opencadstudio-upstream
Translate the new Selection labels, and pin what SELECTIONPREVIEW's bits do
The ten strings the Options card gained were English in nineteen of the twenty-one locales. They are now translated in all of them, using the words each locale already uses for the surrounding labels — de-DE "Griffe", fr-FR "Poignées", zh-CN "夹点", zh-TW "掣點" and so on for grips, and the same for selection, preview and object. System-variable names stay in Latin uppercase, as they already do in every locale's SETVAR listing. Composing them from existing keys, the way el-GR composes the neighbouring labels, only worked for one of the ten: there is no existing key for "limit", "unlimited", "shift", "rectangle" or "lasso", and "Grips: Objects" as the label of a numeric limit would read worse than English. The rollover preview was reported as possibly not working. It works, and now says so: `the_idle_rollover_follows_bit_one` drives a settled hover over a line and checks what the scene highlighted, for all four values of the bitmask. Bit 1 alone highlights, bit 2 alone does not, both do, neither does not. That is the assertion the inverted config comment would have made someone doubt — the pick simply needs the cursor still for the 500 ms of `HOVER_DWELL_MS` before it runs. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
1 parent
cabb20db45
commit
08d339d38f
20 files changed
+244
-190
No files matched your search
@@ -5774,3 +5774,57 @@ properties={:.1}ms picked={}",
|
||||
Task::none()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod selection_preview_tests {
|
||||
use super::*;
|
||||
use crate::app::{HoverDwell, OpenCADStudio, HOVER_DWELL_MS};
|
||||
|
||||
/// Drive one settled rollover pick over a line and report what the scene
|
||||
/// ended up highlighting.
|
||||
fn rollover_hits(preview: u8) -> bool {
|
||||
let mut app = OpenCADStudio::new_for_test();
|
||||
app.automation_op(r#"{"op":"new"}"#);
|
||||
let i = app.active_tab;
|
||||
app.model_space.selection_preview = preview;
|
||||
let _ = app.run_command_line("LINE 0,0 10,10");
|
||||
app.tabs[i].scene.selection.borrow_mut().vp_size = (800.0, 600.0);
|
||||
let _ = app.run_command_line("ZOOM EXTENTS");
|
||||
|
||||
// The pick only runs once the cursor has been still for the dwell
|
||||
// window, so the arming timestamp is backdated past it.
|
||||
app.hover_dwell = Some(HoverDwell {
|
||||
last_move_at: Instant::now()
|
||||
- std::time::Duration::from_millis(HOVER_DWELL_MS as u64 * 2),
|
||||
point: iced::Point::new(400.0, 300.0),
|
||||
tile_size: (800.0, 600.0),
|
||||
tab: i,
|
||||
});
|
||||
let _ = app.on_hover_dwell_tick();
|
||||
app.tabs[i].scene.hover_highlight.is_some()
|
||||
}
|
||||
|
||||
/// Bit 1 of `SELECTIONPREVIEW` is the rollover that runs with no command
|
||||
/// active, and the Options card gives it a checkbox. The config comment
|
||||
/// used to describe the bits the wrong way round, so which bit does what
|
||||
/// is worth asserting rather than reading.
|
||||
#[test]
|
||||
fn the_idle_rollover_follows_bit_one() {
|
||||
assert!(
|
||||
rollover_hits(1),
|
||||
"bit 1 set: the line under the cursor must be highlighted",
|
||||
);
|
||||
assert!(
|
||||
rollover_hits(3),
|
||||
"both bits set: still highlighted",
|
||||
);
|
||||
assert!(
|
||||
!rollover_hits(0),
|
||||
"preview off: nothing may be highlighted",
|
||||
);
|
||||
assert!(
|
||||
!rollover_hits(2),
|
||||
"only the in-command bit: the idle rollover stays off",
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user