mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Main's #14465 filled the dialog's interpolation from the preference and kept it out of the remembered values. This PR removes the dialog's Interpolation row, so the dialog now sends no interpolation at all and the command reads Preferences > General > Image Interpolation itself (the engine's rotate_canvas_interpolation_pref_tests). The default and the not-remembered flag for the row are gone, and #14465's dialog test now checks that no interpolation is filed before or after an OK. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0e420ceea7
commit
b7735e142d
2 files changed
+11
-32
No files matched your search
@@ -337,12 +337,6 @@ pub(crate) fn params(app: &mut PhotocraftApp, command: &str, spec: &str) -> Vec<
|
||||
if document_derived(command, &p.key) {
|
||||
p = p.not_remembered();
|
||||
}
|
||||
// #14465: the row opens from Preferences › General › Image Interpolation on every
|
||||
// opening, so a pick there applies to that opening only; the row stays out of the
|
||||
// remembered values, as the rows above do.
|
||||
if command == "image.rotation.arbitrary" && p.key == "interpolation" {
|
||||
p = p.not_remembered();
|
||||
}
|
||||
// Global Light's Altitude takes whole degrees, as its Angle does (#14980).
|
||||
if command == "layer.layerStyle.globalLight" && p.key == "altitude" {
|
||||
p = p.decimals(0);
|
||||
@@ -437,17 +431,9 @@ fn command_defaults(app: &PhotocraftApp, command: &str, params: &[Param]) -> Map
|
||||
let mut map = Map::new();
|
||||
if command == "image.rotation.arbitrary" {
|
||||
straighten_defaults(app, &mut map);
|
||||
// #14465: the reference dialog offers no interpolation choice; its resampling
|
||||
// follows Preferences › General › Image Interpolation (the dropdown itself goes
|
||||
// away with #14462). The *not measured* variants show and act as Bicubic, as the
|
||||
// Free Transform options bar renders them.
|
||||
use photocraft_engine::prefs::Interpolation;
|
||||
let interp = match app.session.prefs().general.image_interpolation {
|
||||
Interpolation::Nearest => "nearest",
|
||||
Interpolation::Bilinear => "bilinear",
|
||||
_ => "bicubic",
|
||||
};
|
||||
map.insert("interpolation".into(), json!(interp));
|
||||
// #14465: the reference dialog offers no interpolation choice, and the dialog has no row
|
||||
// for it (#14462): it sends none, so the command resamples as Preferences › General ›
|
||||
// Image Interpolation says on every run.
|
||||
}
|
||||
if command == "type.warpText" {
|
||||
warp_defaults(app, &mut map);
|
||||
|
||||
@@ -218,33 +218,26 @@ fn remembering_dialogs_never_persists_paths_or_document_indices() {
|
||||
assert_ne!(f.int("mapDocument"), Some(0), "a document index is never remembered");
|
||||
}
|
||||
|
||||
/// #14465 review: the Rotate Canvas dialog fills Interpolation from Preferences › General ›
|
||||
/// Image Interpolation on every opening, so a dropdown pick applies to that opening only and
|
||||
/// never carries into the next one. The reference application has no Interpolation row at all:
|
||||
/// the preference decides. The other rows of the dialog keep opening from the document
|
||||
/// (angle and direction are the ruler's, #12035).
|
||||
/// #14465 review: the Rotate Canvas dialog's resampling follows Preferences › General › Image
|
||||
/// Interpolation on every run. The reference application has no Interpolation row (#14462), so
|
||||
/// the dialog files no interpolation, before or after an OK, and the command reads the
|
||||
/// preference (`rotate_canvas_interpolation_pref_tests` in the engine). The other rows of the
|
||||
/// dialog keep opening from the document (angle and direction are the ruler's, #12035).
|
||||
#[test]
|
||||
fn arbitrary_rotation_interpolation_reopens_at_the_preference() {
|
||||
const CMD: &str = "image.rotation.arbitrary";
|
||||
let mut app = new_app();
|
||||
app.run("file.new", json!({"width": 8, "height": 8})).unwrap();
|
||||
|
||||
// 1. The preference's default (Bicubic Automatic) opens the row at bicubic.
|
||||
let id = open(&mut app, CMD).unwrap();
|
||||
assert_eq!(field_json(&app, id, "interpolation"), json!("bicubic"), "the row opens at the preference");
|
||||
assert_eq!(field_json(&app, id, "interpolation"), Value::Null, "no interpolation value: the preference decides");
|
||||
set(&mut app, id, "angle", json!(30.0));
|
||||
set(&mut app, id, "interpolation", json!("bilinear"));
|
||||
assert!(ok(&mut app, id), "OK rotates and files its values");
|
||||
|
||||
// 2. A later opening starts from the preference again, not from the confirmed Bilinear pick.
|
||||
let id = open(&mut app, CMD).unwrap();
|
||||
assert_eq!(field_json(&app, id, "interpolation"), json!("bicubic"), "a one-time Bilinear pick does not carry into the next opening");
|
||||
cancel(&mut app, id);
|
||||
|
||||
// 3. A changed preference reaches the next opening.
|
||||
// A later opening files none either, whatever the preference says.
|
||||
app.session.edit_prefs(|p| p.general.image_interpolation = photocraft_engine::prefs::Interpolation::Nearest);
|
||||
let id = open(&mut app, CMD).unwrap();
|
||||
assert_eq!(field_json(&app, id, "interpolation"), json!("nearest"), "Nearest Neighbor shows nearest");
|
||||
assert_eq!(field_json(&app, id, "interpolation"), Value::Null, "a reopened dialog files no interpolation");
|
||||
cancel(&mut app, id);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user