mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 20:01:07 +01:00
Tests: the hidden-characters memo test also tries again when the fonts or hyphenation exceptions change during the edit pass
The attempt now records whether the memo inputs still match the settled pass right after the edit pass, and accepts it only when they match after both the edit pass and the zoom pass. Before, a change and restore of the hyphenation exceptions between the two passes cleared the memo, left the zoom check passing, and failed the assertion that the object not edited keeps its layout.
This commit is contained in:
1 parent
1f5a155580
commit
ca2af5d94b
1 file changed
+4
-2
@@ -41,7 +41,8 @@ fn settled(app: &mut VectorcraftApp, view: &CanvasView, ids: &[NodeId]) -> Vec<A
|
||||
/// An unchanged type object keeps its memo entry; an edit lays out only the object edited; a zoom
|
||||
/// reuses the entries (the marks are in document points); a new font generation lays everything out.
|
||||
/// Other tests change the fonts while this one runs, so the edit and the zoom are tried again on a
|
||||
/// new document until the fonts stay the same from the settled pass to the zoomed one.
|
||||
/// new document until the fonts stay the same from the settled pass through the edited one to the
|
||||
/// zoomed one.
|
||||
#[test]
|
||||
fn hidden_characters_lay_out_only_type_that_changed() {
|
||||
let zoomed = CanvasView::new(view().rect, Point::new(100.0, 100.0), 2.0);
|
||||
@@ -54,10 +55,11 @@ fn hidden_characters_lay_out_only_type_that_changed() {
|
||||
let inputs = app.canvas.hidden_chars.inputs.clone();
|
||||
app.session.execute("text.setText", &json!({"id": ids[1].0, "text": "e f g"})).unwrap();
|
||||
marks_of(&mut app, &view());
|
||||
let edited = app.canvas.hidden_chars.inputs == inputs;
|
||||
let after = kept_hidden(&app, &ids);
|
||||
marks_of(&mut app, &zoomed);
|
||||
let zoom = kept_hidden(&app, &ids);
|
||||
(app.canvas.hidden_chars.inputs == inputs).then_some((app, ids, before, after, zoom))
|
||||
(edited && app.canvas.hidden_chars.inputs == inputs).then_some((app, ids, before, after, zoom))
|
||||
})
|
||||
.expect("the fonts settle");
|
||||
assert!(Arc::ptr_eq(&before[0], &after[0]), "the object not edited is not laid out again");
|
||||
|
||||
Reference in new issue
Block a user