mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 08:51:25 +00:00
Tests: Start Lists From Typed Markers on again, and its preferences checkbox
- typed_lists_off_leaves_typed_markers_as_text turns the preference back on for each marker and checks that typing it in a new paragraph starts a list with a Bullets and Numbering undo step. - start_lists_from_typed_markers_is_a_saved_type_preference: the Type page shows the checkbox, checked by default; unchecking it turns the preference off in the session and in the saved preferences, and every bundled language translates its label.
This commit is contained in:
@@ -1149,6 +1149,15 @@ fn typed_lists_off_leaves_typed_markers_as_text() {
|
||||
let t = obj(&s, id);
|
||||
assert_eq!((t.plain_text(), t.para_at(0).list), (format!("{typed} a"), None), "{typed}");
|
||||
assert!(!undo_labels(&s).iter().any(|l| l == "Bullets and Numbering"), "{typed}");
|
||||
// Turned back on, the same typing in a new paragraph starts a list.
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": true})).unwrap();
|
||||
key(&mut s, ToolKey::Enter, Mods::default());
|
||||
for c in typed.chars().chain(" ".chars()) {
|
||||
s.tool_text(&c.to_string(), v).unwrap();
|
||||
}
|
||||
let t = obj(&s, id);
|
||||
assert_eq!((t.plain_text(), t.para_at(0).list, t.para_at(1).list.is_some()), (format!("{typed} a\n"), None, true), "on: {typed}");
|
||||
assert_eq!(undo_labels(&s).last().map(String::as_str), Some("Bullets and Numbering"), "on: {typed}");
|
||||
}
|
||||
let mut s = session();
|
||||
s.execute("prefs.set", &json!({"key": "typedLists", "value": false})).unwrap();
|
||||
|
||||
@@ -16,6 +16,27 @@ fn geometric_snapping_is_a_saved_smart_guides_preference() {
|
||||
assert!(a.run("view.snapping", json!({})).is_err());
|
||||
}
|
||||
|
||||
/// Type › Start Lists From Typed Markers is a checkbox in the Type panel, on by default; turning
|
||||
/// it off is saved, and every bundled language translates its label.
|
||||
#[test]
|
||||
fn start_lists_from_typed_markers_is_a_saved_type_preference() {
|
||||
const LABEL: &str = "Start Lists From Typed Markers";
|
||||
let mut a = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default());
|
||||
assert!(a.session.prefs.typed_lists);
|
||||
open(&mut a, Some("Type"));
|
||||
let text = crate::tests_labels::painted_text(&mut a, |a, ui| show(a, ui.ctx()));
|
||||
assert!(text.contains(LABEL), "{text}");
|
||||
assert_eq!(a.ui.dialog.as_ref().unwrap().fields.get("typedLists"), Some(&json!(true)));
|
||||
a.ui.dialog.as_mut().unwrap().fields.insert("typedLists".into(), json!(false));
|
||||
confirm(&mut a).unwrap();
|
||||
assert!(!a.session.prefs.typed_lists);
|
||||
let saved: Prefs = serde_json::from_value(a.ui.engine_prefs.clone()).unwrap();
|
||||
assert!(!saved.typed_lists);
|
||||
for lang in crate::i18n::Lang::all().filter(|l| l.code() != crate::i18n::Lang::EN.code()) {
|
||||
assert!(crate::i18n::has(lang, LABEL), "{}", lang.code());
|
||||
}
|
||||
}
|
||||
|
||||
/// A resting checkbox must have a visible outline in both states and every brightness.
|
||||
#[test]
|
||||
fn preference_checkboxes_draw_outlines_without_hover() {
|
||||
|
||||
Reference in New Issue
Block a user