mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Report rejected action continuations and exercise a real artboard edit
This commit is contained in:
1 parent
3028355333
commit
fdc667e010
2 files changed
+9
-1
No files matched your search
@@ -680,10 +680,15 @@ fn artboard_edit_descriptor(background: i32, change_sizes: i32) -> Descriptor {
|
||||
fn artboard_background_edit_roundtrips_without_replaying_recorded_geometry() {
|
||||
for (kind, expected) in [(1, [1.0; 4]), (2, [0.0, 0.0, 0.0, 1.0]), (3, [0.0; 4]), (4, [0.25, 0.5, 0.75, 1.0])] {
|
||||
let mut s = artboard_fixture();
|
||||
s.execute("layer.new.artboardFromGroup", json!({})).unwrap();
|
||||
let initial_background = if kind == 1 { "black" } else { "white" };
|
||||
s.execute("layer.new.artboardFromGroup", json!({"background":initial_background})).unwrap();
|
||||
Arc::make_mut(&mut s.active_mut().unwrap().doc).guides.horizontal.push(3.0);
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let id = s.active().unwrap().active_layer.unwrap();
|
||||
assert_eq!(
|
||||
before.layer(id).unwrap().artboard().unwrap().background,
|
||||
if kind == 1 { photocraft_doc::ArtboardBackground::Black } else { photocraft_doc::ArtboardBackground::White }
|
||||
);
|
||||
let history = s.active().unwrap().history.past_len();
|
||||
let d = artboard_edit_descriptor(kind, 8);
|
||||
assert_eq!(load(&mut s, &file("editArtboardEvent", d.clone()))["unsupported"], json!([]));
|
||||
|
||||
@@ -955,6 +955,9 @@ pub fn resume(app: &mut PhotocraftApp, fields: &serde_json::Map<String, Value>)
|
||||
&& let Err(e) = history.resume(&mut app.session)
|
||||
{
|
||||
restore_recording(app, owner.as_ref());
|
||||
let template = "Action playback failed: {error}";
|
||||
app.ui.status = crate::i18n::fmt(tl!(template), &[("error", &e.to_string())]);
|
||||
app.ui.status_error = true;
|
||||
return Err(e.to_string());
|
||||
}
|
||||
// The dialog's command may run as a background job; the next step needs its result.
|
||||
|
||||
Reference in new issue
Block a user