mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Use an engine-core fixture for Transform Again
This commit is contained in:
1 parent
80fa3a977c
commit
2a6fb51738
1 file changed
+7
-3
@@ -1,3 +1,4 @@
|
||||
use photocraft_geom::Rect;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
@@ -8,9 +9,12 @@ fn transform_again_is_enabled_only_after_a_transform_in_the_session() {
|
||||
|
||||
session.execute("file.new", json!({"width": 100, "height": 100})).unwrap();
|
||||
session.execute("layer.new.layer", json!({"name": "Pixels"})).unwrap();
|
||||
session.execute("select.rect", json!({"x": 10, "y": 10, "width": 25, "height": 20})).unwrap();
|
||||
session.execute("edit.fill", json!({"color": "#ff0000"})).unwrap();
|
||||
session.execute("select.deselect", json!({})).unwrap();
|
||||
session
|
||||
.edit("Paint fixture", |doc, active| {
|
||||
doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap().fill_rect(Rect::new(10, 10, 35, 30), &[1.0, 0.0, 0.0, 1.0]);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
assert!(!session.is_enabled(command), "ordinary document edits do not enable Again");
|
||||
let history = session.active().unwrap().history.past_len();
|
||||
let error = session.execute(command, json!({})).unwrap_err().to_string();
|
||||
|
||||
Reference in new issue
Block a user