mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Engine split step 6: cargo fmt
This commit is contained in:
1 parent
3f9eb0d59d
commit
cf80a283f2
197 files changed
+275
-238
No files matched your search
@@ -1,9 +1,9 @@
|
||||
//! Synchronous engine boundary for asynchronous browser storage. No browser handles cross the
|
||||
//! engine's `Send` boundary. Byte buffers are shared with the single in-flight transaction.
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use photocraft_engine::preset_store::PresetStoreExt;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::preset_store::PresetStoreExt;
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ mod tablet;
|
||||
mod ui_state;
|
||||
mod window_frame;
|
||||
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::print_cmds::PrintExt;
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_ui_egui::PhotocraftApp;
|
||||
use photocraft_ui_egui::Prefix;
|
||||
use photocraft_ui_egui::window_policy::{self, Backend, Frame, TitleBarPref};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Playback Options (`actions.setPlayback`): validation, preferences and headless playback.
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use serde_json::json;
|
||||
|
||||
fn options(s: &Session) -> (crate::prefs::PlaybackPerformance, u8, bool) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use serde_json::json;
|
||||
|
||||
/// An `ActionList` holding `actions` in order.
|
||||
@@ -238,7 +238,10 @@ fn rename_follows_conditional_branches() {
|
||||
fn delete_action_drops_its_function_key_but_deleting_a_step_keeps_it() {
|
||||
let mut s = crate::session();
|
||||
let key = format!("{PLAY_SHORTCUT_PREFIX}Action 1");
|
||||
s.actions_mut().list.push(Action::new("Action 1", vec![ActionStep::new("layer.new.layer", json!({})), ActionStep::new("layer.new.layer", json!({}))])).unwrap();
|
||||
s.actions_mut()
|
||||
.list
|
||||
.push(Action::new("Action 1", vec![ActionStep::new("layer.new.layer", json!({})), ActionStep::new("layer.new.layer", json!({}))]))
|
||||
.unwrap();
|
||||
s.edit_prefs(|p| p.shortcuts.insert(key.clone(), "F2".into()));
|
||||
s.execute("actions.delete", json!({"action": 0, "step": 0})).unwrap();
|
||||
assert_eq!(s.prefs().shortcuts.get(&key).map(String::as_str), Some("F2"), "deleting a step keeps the key");
|
||||
|
||||
@@ -95,7 +95,8 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if id == "actions.play" {
|
||||
// Refuse the one cycle visible here; deeper ones are caught at playback.
|
||||
let target = params.get("action");
|
||||
let is_self = target.and_then(Value::as_str) == Some(s.actions().list.actions()[idx].name.as_str()) || target.and_then(Value::as_u64) == Some(idx as u64);
|
||||
let is_self =
|
||||
target.and_then(Value::as_str) == Some(s.actions().list.actions()[idx].name.as_str()) || target.and_then(Value::as_u64) == Some(idx as u64);
|
||||
if is_self {
|
||||
return Err(bad(cmd, "an action cannot play itself"));
|
||||
}
|
||||
@@ -504,9 +505,9 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::Action;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
fn session_with(steps: &[&str]) -> Session {
|
||||
let mut s = crate::session();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::Session;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{Action, ActionStep, PLAY_SHORTCUT_PREFIX};
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::preset_store::{ACTIONS_FILE, MemBackend, PresetBackend, open};
|
||||
use craft_psd::atn::{AtnAction, AtnFile, write};
|
||||
use craft_psd::descriptor::UnicodeString;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Record Again executes the selected command before replacing its stored settings.
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::{Result, Session, Value, bad, index, json, not_playing, resolve};
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{ActionStep, list_error};
|
||||
|
||||
const COMMAND: &str = "actions.recordAgain";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! #10723: Layer › New › Artboard and Layer › New › Artboard from Layers, recorded as a Make of
|
||||
//! class `artboardSection` (`docs/atn.md`, "Recorded through the menus").
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use photocraft_doc::{Layer, LayerId};
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! #10723: File › Automate › Fit Image steps, the script event measured in the reference
|
||||
//! application: class `cjsp`, then `Msge`, `Hght` and `Wdth` in pixels, `limit` (Don't Enlarge).
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::steps_automate::{FIT_IMAGE, FIT_IMAGE_EVENT};
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
const SOURCE: &str = "_atnFitImageDescriptor";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::convert::{ReplacementSet, clip_name, export, import_first_with_keys};
|
||||
use super::{Action, DEFAULT_SET, EngineError, Result, Session, Value, bad, json};
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::ActionsFile;
|
||||
|
||||
mod replacement;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! #10723: Layer › New › Frame from Layers, recorded as a Make of class `framedGroupSection`
|
||||
//! (`docs/atn.md`, "Recorded through the menus").
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use photocraft_doc::{Layer, LayerId};
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, ReferenceItem, UnicodeString, Value as D};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{ActionList, ActionStep, ActionsFile};
|
||||
|
||||
/// PhotoCraft's own roundtrip accepts a combined Set, but Photoshop applies only its rename.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! #10723: Image › Analysis › Set Measurement Scale › Custom steps, recorded as a Set of the
|
||||
//! document's `measurementScale` property (`docs/atn.md`, "Recorded through the menus").
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
const SET_SCALE: &str = "image.analysis.setMeasurementScale";
|
||||
const SOURCE: &str = "_atnMeasurementScaleDescriptor";
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
//! reference application: class `cjsp`, then `Msge`, `SrcM` (`Cndn` per ticked source mode) and
|
||||
//! `DstM` (the target mode's object).
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::stylize_tests::{load_items, saved_items};
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use photocraft_color::ColorMode;
|
||||
|
||||
const EVENT: &str = "8cba8cd6-cb66-11d1-bc43-0060b0a13dc4";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::super::{Action, AtnAction, AtnEvent, AtnFile, AtnItem, UnicodeString, atn};
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{ActionList, ActionsFile};
|
||||
|
||||
/// Construct a pixel point directly from the measured #10706 wire format.
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
//! gives them (measured in `docs/atn.md` › "Measured through dialogs and recordings"; once mapped,
|
||||
//! the events are listed with the supported events instead).
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
fn action(items: Vec<AtnItem>) -> Vec<u8> {
|
||||
atn::write(&AtnFile {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
/// A real action file with one step, used by both descriptor and playback checks.
|
||||
fn file(event: AtnEvent, descriptor: Descriptor) -> Vec<u8> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
/// An independently constructed selection-property reference, as recorded in Group F.
|
||||
fn selection() -> D {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
/// The parameterless events use an empty descriptor and accept both event identifiers.
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, ReferenceItem, UnicodeString, Value as D};
|
||||
use serde_json::json;
|
||||
@@ -3709,7 +3709,10 @@ fn select_rect_modes_export_without_becoming_replace() {
|
||||
assert_eq!(s.actions().list.actions(), before);
|
||||
}
|
||||
|
||||
s.actions_mut().list.push(Action::new("Unsupported", vec![ActionStep::new("select.rect", json!({"x":4,"y":4,"width":2,"height":2,"mode":"xor"}))])).unwrap();
|
||||
s.actions_mut()
|
||||
.list
|
||||
.push(Action::new("Unsupported", vec![ActionStep::new("select.rect", json!({"x":4,"y":4,"width":2,"height":2,"mode":"xor"}))]))
|
||||
.unwrap();
|
||||
let before = s.actions().list.actions().to_vec();
|
||||
assert!(s.execute("actions.save", json!({"action":"Unsupported"})).is_err());
|
||||
assert_eq!(s.actions().list.actions(), before, "rejected export must leave actions unchanged");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
|
||||
/// An `ActionList` holding `actions` in order.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::*;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use photocraft_color::SampleType;
|
||||
|
||||
fn session_depth(depth: u32) -> Session {
|
||||
|
||||
@@ -1738,8 +1738,8 @@ mod assign_profile_enabled_modes_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod settings_tests {
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
|
||||
fn tagged(spec: &str) -> Document {
|
||||
let mut d = Document::with_background("t", photocraft_doc::Size::new(8, 8), ColorMode::Rgb, SampleType::U8, Color::rgba(0.2, 0.6, 0.9, 1.0));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use photocraft_color::BlendMode;
|
||||
use photocraft_doc::Layer;
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//! history. A user contour is applied to an effect as a `contour` curve object (see
|
||||
//! [`contour_param`]); `.shc` files go through `craft_psd::shc` (see [`contours_from_shc`]).
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_doc::Contour;
|
||||
use photocraft_doc::adjust::CurvePoint;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Named New Document configurations. The existing preferences services persist these with the
|
||||
//! other presets; selecting one only returns settings, and document creation stays in `file.new`.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_color::{ColorMode, SampleType};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
@@ -406,8 +406,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
|
||||
fn settings() -> Value {
|
||||
json!({"width":16,"height":24,"resolution":254.5,"mode":"lab","depth":16,
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
//! Check Spelling is not implemented: it needs a word list per language, and no permissively
|
||||
//! licensed dictionary small enough to bundle (or a pure-Rust checker with one) was available.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_color::{BlendMode, PixelFormat};
|
||||
use photocraft_doc::vector::Path;
|
||||
use photocraft_doc::{Document, Layer, LayerContent, LayerId};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use super::{CustomShape, Deserialize, Document, EngineError, LayerContent, LayerId, Path, Result, Serialize, Session, Value, bad, json, str_or};
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
|
||||
// ------------------------------------------------------------------ Define Brush / Custom Shape
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
use crate::presets::PresetsExt;
|
||||
use photocraft_doc::vector::Subpath;
|
||||
|
||||
fn session(depth: u32) -> Session {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Named Export As configurations. They persist with the other presets in the preferences
|
||||
//! document; applying one only returns settings, and the export itself stays in Export As.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -278,8 +278,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
|
||||
fn settings(sizing: &str) -> Value {
|
||||
json!({
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::open::import_at_raw_ppi;
|
||||
use super::paths::{extension, file_name, join, list_files, list_images, read_file, sanitize, stem, write_file};
|
||||
use super::processing::parse_steps;
|
||||
use super::save::{SaveOpts, encode, save_doc, save_doc_as};
|
||||
use super::{Arc, Document, EngineError, Result, Session, Value, batch_naming, json, str_param};
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
/// Inputs of a batch command: `"input"` is a folder or an array of files.
|
||||
pub(crate) fn batch_inputs(p: &Value, cmd: &str) -> Result<Vec<String>> {
|
||||
@@ -1461,8 +1461,8 @@ fn preserve_exr(bytes: &[u8]) -> Result<()> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod action_history_tests {
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{Action, ActionStep};
|
||||
use std::cell::RefCell;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::paths::{file_name, read_file, stem, template_name};
|
||||
use super::{Arc, Document, EngineError, Layer, LayerContent, LayerId, PixelFormat, PlaceSteps, Result, Session, Value, json, str_param};
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
/// Replace only the file choice before either authorization gate; malformed params stay invalid.
|
||||
pub(crate) fn batch_open_params(s: &Session, id: &str, params: &Value) -> Option<Value> {
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
//! size and position `0, 0`) and put into the document before it is admitted, so the opening
|
||||
//! snapshot already shows it.
|
||||
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::open::import_result_for_open;
|
||||
use super::paths::{file_name, read_file, stem, untitled_name};
|
||||
use super::{Affine, Arc, Document, Layer, LayerContent, Result, Session, SmartObject, SmartSource, Value, flattened_checked, json, str_param};
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::layer_place::Place;
|
||||
|
||||
const CMD: &str = "file.openAsSmartObject";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::actions_cmds::{ActionList, ActionStep, ActionsFile};
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
/// An `ActionList` holding `actions` in order.
|
||||
fn list_of(actions: Vec<crate::actions_cmds::Action>) -> ActionList {
|
||||
@@ -398,7 +398,10 @@ fn batch_override_open_authorizes_effective_path_and_carries_failure_budget() {
|
||||
let existing = png(&output, "b.png", 3, 2, "#4488aa");
|
||||
let intact = std::fs::read(&existing).unwrap();
|
||||
let mut s = crate::session();
|
||||
s.actions_mut().list.push(crate::actions_cmds::Action::new("Open", vec![ActionStep::new("file.openAs", json!({"path":"/recorded.png","as":"png"}))])).unwrap();
|
||||
s.actions_mut()
|
||||
.list
|
||||
.push(crate::actions_cmds::Action::new("Open", vec![ActionStep::new("file.openAs", json!({"path":"/recorded.png","as":"png"}))]))
|
||||
.unwrap();
|
||||
s.batch_open = Some(crate::state::BatchOpen { path: first.clone(), sources: Vec::new(), raw_ppi: 300.0, read_only: false });
|
||||
assert!(matches!(s.execute("file.openAs", json!([1])), Err(EngineError::BadParams { .. })));
|
||||
assert!(s.documents().is_empty());
|
||||
|
||||
@@ -201,8 +201,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use serde_json::json;
|
||||
|
||||
fn entries(s: &Session) -> Vec<String> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! #9329 PR A: a pixel change damages only the tiles that changed, and command rects are hints
|
||||
//! checked against them.
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use photocraft_geom::TILE_SIZE;
|
||||
|
||||
fn session(w: u32, h: u32) -> Session {
|
||||
|
||||
@@ -91,9 +91,9 @@ pub fn specs() -> Vec<crate::commands::CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn merges_new_groups_only() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::*;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
fn session(w: u32, h: u32, depth: u64, mode: &str) -> Session {
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
//!
|
||||
//! [`BrushSettings`]: photocraft_paint::BrushSettings
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::commands::CommandSpec;
|
||||
|
||||
@@ -263,9 +263,7 @@ pub fn rgb_printers(s: &Session) -> RgbPrinters {
|
||||
/// Lists printers when the spooler is available. While it is busy, returns the cached list for
|
||||
/// the same source, or `Unsupported` if that source has no cached list.
|
||||
pub fn rgb_printers_without_waiting(s: &Session) -> RgbPrinters {
|
||||
try_with_spooler(|| list_rgb_printers(s))
|
||||
.or_else(|| last(&LAST_RGB_PRINTERS, s.printer_source()))
|
||||
.unwrap_or(Err(craft_print::rgb::PrintError::Unsupported))
|
||||
try_with_spooler(|| list_rgb_printers(s)).or_else(|| last(&LAST_RGB_PRINTERS, s.printer_source())).unwrap_or(Err(craft_print::rgb::PrintError::Unsupported))
|
||||
}
|
||||
|
||||
/// Lists printers for the Print dialog. While the system spooler is busy, returns the cached
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Resolve and freeze a clone source without changing the sampled document.
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::presets::clone_source::uses_slot;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::*;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::clone_source::Mapping;
|
||||
|
||||
/// Create a native colour-gradient source and an empty destination without re-picking.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
use crate::presets::PresetsExt;
|
||||
use photocraft_color::ColorMode;
|
||||
|
||||
const DEPTHS: [u64; 3] = [8, 16, 32];
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
//!
|
||||
//! The documents are the ones the issue measured against the reference application.
|
||||
|
||||
use crate::smartselect_cmds::SmartSelectExt;
|
||||
use super::*;
|
||||
use crate::smartselect_cmds::SmartSelectExt;
|
||||
|
||||
const W: u32 = 800;
|
||||
const H: u32 = 600;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::smartselect_cmds::SmartSelectExt;
|
||||
use super::*;
|
||||
use crate::smartselect_cmds::SmartSelectExt;
|
||||
use photocraft_algo::segment::Rng;
|
||||
|
||||
/// A document whose background shows `px(x, y)` (RGB, 0–1), at the given depth.
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
//! The container lives in `craft-psd` (`asl`), the mapping onto effects in `photocraft-io`
|
||||
//! (`asl_map`).
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::commands::CommandSpec;
|
||||
@@ -95,7 +95,8 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
list.iter()
|
||||
.map(|n| {
|
||||
let name = n.as_str().ok_or_else(|| bad(EXPORT, "`styles` must be a list of style names"))?;
|
||||
let (gi, ii) = find(&s.presets().styles, name, group).ok_or_else(|| bad(EXPORT, format!("no style \"{name}\" (see style.presets.list)")))?;
|
||||
let (gi, ii) =
|
||||
find(&s.presets().styles, name, group).ok_or_else(|| bad(EXPORT, format!("no style \"{name}\" (see style.presets.list)")))?;
|
||||
s.presets().styles.get(gi).and_then(|g| g.items.get(ii)).cloned().ok_or_else(|| bad(EXPORT, format!("no style \"{name}\"")))
|
||||
})
|
||||
.collect::<Result<_>>()?
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
//! across all groups, in panel order). Like the other preset commands they change the
|
||||
//! preferences document, not a document's history.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use craft::color_ui::palette::{SwatchFormat, SwatchNote, default_swatches, read_swatches, write_swatches};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -133,8 +133,12 @@ fn swatch_json(conv: &SwatchConv, sw: &SwatchEntry) -> Value {
|
||||
|
||||
fn list(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
let conv = SwatchConv::new(s);
|
||||
let groups: Vec<Value> =
|
||||
s.presets().swatches.iter().map(|g| json!({"name": g.name, "swatches": g.entries.iter().map(|sw| swatch_json(&conv, sw)).collect::<Vec<_>>()})).collect();
|
||||
let groups: Vec<Value> = s
|
||||
.presets()
|
||||
.swatches
|
||||
.iter()
|
||||
.map(|g| json!({"name": g.name, "swatches": g.entries.iter().map(|sw| swatch_json(&conv, sw)).collect::<Vec<_>>()}))
|
||||
.collect();
|
||||
Ok(json!({"groups": groups, "count": total(&s.presets().swatches)}))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::*;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
use craft_psd::aco::{AcoColor, AcoSwatch};
|
||||
use craft_psd::ase::{AseColor, AseEntry, AseFile, AseKind, AseSwatch};
|
||||
use photocraft_paint::tile::{b64_decode, b64_encode};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::cmd::{Color, ColorMode, CommandSpec, Document, EngineError, Layer, SampleType, Size, Value, always, json, parse_hex};
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
/// File menu: New (new documents take their presets from the document preset store).
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Free Transform of several selected layers by one box (#6501).
|
||||
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
/// A 200 x 200 document: a red 40 x 20 block on "Paint" (x 10..50, y 10..30) and a type layer
|
||||
/// over it, both selected, the type layer active (as after creating it and ⌘-clicking Paint).
|
||||
|
||||
@@ -312,9 +312,9 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionStep;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
#[test]
|
||||
fn char_offsets_matches_per_offset_counting() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
|
||||
#[test]
|
||||
/// The last native color sample remains editable on opaque layers, while selected alpha still requires transparency edits.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `layer.layerStyle.*` commands: add/replace layer effects on a layer.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_color::{BlendMode, Color};
|
||||
use photocraft_doc::adjust::CurvePoint;
|
||||
use photocraft_doc::effects::PATTERN_SCALE_RANGE;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
use crate::presets::PresetsExt;
|
||||
use serde_json::json;
|
||||
|
||||
fn session() -> Session {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::customize::{keyboard_shortcuts, menus};
|
||||
use super::validate::{SECTIONS, get_path, keyed};
|
||||
use super::{CommandSpec, EngineError, Map, Result, Session, ToolbarCustomization, Value, json};
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
// ------------------------------------------------------------------ commands
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//! preset libraries ([`SavedPrefs`]), how it is read, and the session methods that move it in and
|
||||
//! out.
|
||||
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::presets::PresetsExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::*;
|
||||
use crate::color_cmds::ColorExt;
|
||||
use crate::prefs::SavedPrefsExt;
|
||||
|
||||
#[test]
|
||||
fn system_title_bar_defaults_to_integrated_and_preserves_saved_choices() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use super::*;
|
||||
use crate::actions_cmds::ActionsExt;
|
||||
use crate::preset_store::PresetStoreExt;
|
||||
use craft_psd::abr::{AbrSample, LegacyBrush, LegacyTip, write_v12};
|
||||
use serde_json::json;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -32,8 +32,8 @@ mod tests;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use craft_tracked::Tracked;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::commands::CommandSpec;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//! Photoshop's "Foreground to Background") and transparency stops, both at `0..=1`. Midpoints are
|
||||
//! always 50 %. Built-in colours are our own.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_doc::{Color, Fill, Layer, LayerContent};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
//! Groups hold pattern **ids**. Library patterns that are in no group (newly defined or imported)
|
||||
//! are shown in a trailing "Patterns" group; ids whose pattern was deleted are dropped.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_doc::{Fill, LayerContent};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
//! (a circle) and `!` before `M`/`O` to subtract that subpath (holes). Shapes defined with Edit ›
|
||||
//! Define Custom Shape appear in a trailing "Custom Shapes" group.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_doc::vector::{Knot, Path, PathOp, Subpath};
|
||||
use photocraft_geom::{Affine, Point, Rect};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Import a complete custom-shape set before changing the persistent library.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
//! The built-in groups are our own designs, built from the same effect params as
|
||||
//! `layer.layerStyle.*`.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use photocraft_color::{BlendMode, ColorMode, SampleType};
|
||||
use photocraft_doc::{Document, Effect, Layer, Pattern, Size};
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
@@ -249,9 +249,9 @@ pub fn hex(c: [f32; 3]) -> String {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::presets::PresetsExt;
|
||||
use super::*;
|
||||
use crate::presets::PresetState;
|
||||
use crate::presets::PresetsExt;
|
||||
|
||||
#[test]
|
||||
fn default_library_has_the_forty_six_colours() {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
//! The Crop tool's options-bar presets (New / Delete Crop Preset…) are tool presets of the
|
||||
//! `"crop"` tool, as in Photoshop, so they also show in the Tool Presets panel.
|
||||
|
||||
use crate::presets::presets_changed;
|
||||
use crate::presets::PresetsExt;
|
||||
use crate::presets::presets_changed;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
|
||||
@@ -318,8 +318,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::color_cmds::ColorExt;
|
||||
use super::*;
|
||||
use crate::color_cmds::ColorExt;
|
||||
|
||||
/// The shared sRGB functions match the removed copies bit for bit.
|
||||
#[test]
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
//! concurrent test could flatten one document under two settings. Keep any other test that
|
||||
//! changes the spot dot gain in this file.
|
||||
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use photocraft_compose::multichannel::{SPOT_DOT_GAIN, spot_dot_gain};
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use serde_json::json;
|
||||
|
||||
/// A Multichannel document with one transparent black ink at 50 %.
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
//! with the one after its undo, and failed on Windows CI that way). Keep any other test that
|
||||
//! changes the gamma in this file.
|
||||
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Public playback history semantics, independent of the Actions panel implementation.
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
@@ -522,7 +522,8 @@ fn again_copy_failure_preserves_the_completed_prefix() {
|
||||
s.execute("layer.setProps", json!({"locks":{"position":true}})).unwrap();
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let count = s.active().unwrap().history.past_len();
|
||||
s.actions_mut().list = only("Prefix", vec![("layer.renameLayer".into(), json!({"name":"Completed prefix"})), ("edit.transform.againCopy".into(), json!({}))]);
|
||||
s.actions_mut().list =
|
||||
only("Prefix", vec![("layer.renameLayer".into(), json!({"name":"Completed prefix"})), ("edit.transform.againCopy".into(), json!({}))]);
|
||||
let result = s.execute("actions.play", json!({"action":0})).unwrap();
|
||||
assert_eq!(result["failed"]["step"], 1, "{result}");
|
||||
let after = s.active().unwrap().doc.clone();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! #8384: an adjustment layer's Make step keeps the new layer's name (`Nm `), blend mode
|
||||
//! (`Md `) and clipping (`Grup`) on load, playback and save.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D};
|
||||
use photocraft_doc::{BlendMode, LayerContent};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Recorded Calculations Make forms, using the measured reference and ScriptListener types.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Synthetic measured-layout recordings through public ATN load/save and playback.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionsFile},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, UnicodeString, Value as D};
|
||||
use photocraft_doc::{Adjustment, LayerContent};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{ActionList, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Recorded CAF settings use the native operation; unsupported descriptors stay whole.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! #7669: strict ATN export must not replace a native fractional Crystallize cell size.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{atn, descriptor::Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{ActionList, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
//! Recorded direct Gradient Map and Replace Color forms from #10603 / #10607.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::json;
|
||||
@@ -343,7 +343,10 @@ fn invalid_replace_descriptors_and_lossy_exports_are_refused() {
|
||||
let mut stale = s.actions().list.actions()[0].steps[0].clone();
|
||||
stale.params["stops"][0][1][0] = json!(0.2);
|
||||
s.actions_mut().list.replace_step(0, 0, stale).unwrap();
|
||||
assert!(atn_cmds::export("Direct adjustments", &[&s.actions().list.actions()[0]], &[], false).is_err(), "stale color metadata must not fall through to GdMp");
|
||||
assert!(
|
||||
atn_cmds::export("Direct adjustments", &[&s.actions().list.actions()[0]], &[], false).is_err(),
|
||||
"stale color metadata must not fall through to GdMp"
|
||||
);
|
||||
for p in [json!({"color":"#ff0000"}), json!({"labMinimum":[40,0,0],"labMaximum":[60,0,0],"hue":0.5})] {
|
||||
let a = photocraft_engine::actions_cmds::Action::new("Native", vec![ActionStep::new("image.adjustments.replaceColor", p)]);
|
||||
assert!(atn_cmds::export("Direct adjustments", &[&a], &[], false).is_err());
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Measured layer-style action steps retain their settings and use the existing native commands.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, MAX_DEPTH, ObjectArray, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{Document, Effect, LayerId};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Recorded identifiers must match Photoshop, even when a local round trip would accept a typo.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! #10700: recorded Link and Unlink must not replay as a state-dependent toggle.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{Layer, LayerContent, LayerId, SmartObject, SmartSource};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! The measured Perspective Warp descriptor shape through ATN conversion and action playback.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{LayerContent, LayerId};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Public-API regressions for the dialog-event and Batch review findings.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D};
|
||||
use photocraft_doc::LayerContent;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! #7670: integer ATN Ripple amounts must never silently replace native fractions.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{atn, descriptor::Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, UnicodeString, Value as D};
|
||||
use photocraft_doc::LayerContent;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{ActionList, ActionsFile};
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::json;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Public load/save/playback witnesses for the measured Shear action mapping.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, Id, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionStep},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! The measured Smart Object Stack Mode events retain their descriptor and native behavior.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{Group, Layer, LayerContent, StackMode};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! #7671: exported Stroke widths must have the same effect as command execution.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{atn, descriptor::Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//! Recorded Type > Create Work Path preserves its descriptor and uses native glyph outlines.
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{LayerContent, LayerId};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{Session, actions_cmds::ActionStep, paint::tile::b64_encode};
|
||||
use serde_json::json;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//! #10694: Content-Aware Fill options survive ATN load, save and playback.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_doc::{LayerId, Rect};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
//! Photoshop does: it keeps the pixels past the canvas, and an extension is transparent on every
|
||||
//! layer. Delete on keeps the Background, and Image › Reveal All is unchanged (#10867).
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{atn, descriptor::Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{Action, ActionList, ActionStep, ActionsFile};
|
||||
use photocraft_engine::{EngineError, Session, atn_cmds};
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Original geometric CSH fixture, assembled from the public container/path layout.
|
||||
//! No Adobe or third-party shape assets are embedded.
|
||||
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::presets::PresetsExt;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::csh_fixture as fixture;
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
//! depths and on both routes, and ratchet the distance to Photoshop's measured row so a future
|
||||
//! kernel change is a decision with a number attached to it instead of a silent drift.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem};
|
||||
use craft_psd::descriptor::{Descriptor, UnicodeString, Value as D};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::actions_cmds::{ActionList, ActionsFile};
|
||||
use photocraft_engine::{Session, atn_cmds};
|
||||
use serde_json::json;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! #10694: Image Size style scaling survives ATN import, playback and saving.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_color::{BlendMode, Color};
|
||||
use photocraft_doc::{Effect, Effects, FxCommon, FxPaint, LayerId, StrokeFx, StrokePosition};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! Paste Layer Style applies group eligibility consistently and preserves the ATN flag.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use craft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use photocraft_color::{BlendMode, Color, ColorMode, SampleType};
|
||||
use photocraft_doc::{BlendRange, Document, Effect, Layer, LayerId};
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::{
|
||||
Session,
|
||||
actions_cmds::{Action, ActionList, ActionStep, ActionsFile},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Explicit Paste modes preserve source kind instead of silently using the ordinary raster route.
|
||||
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::actions_cmds::ActionsExt;
|
||||
use serde_json::json;
|
||||
|
||||
/// This uses only the original public command API, so the pre-fix failure is executable.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
//! Working RGB must support reading and editing for the configured intent.
|
||||
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use craft_cms::{
|
||||
Builtin, Curve, Intent, Profile, ProfileClass,
|
||||
pipeline::Stage,
|
||||
@@ -10,6 +8,8 @@ use craft_cms::{
|
||||
use photocraft_color::{Color, ColorMode, SampleType};
|
||||
use photocraft_doc::{Document, Layer};
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_engine::color_cmds::ColorExt;
|
||||
use photocraft_engine::prefs::SavedPrefsExt;
|
||||
use photocraft_geom::Size;
|
||||
use serde_json::json;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
Loaded 100 of 197 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user