fix(ui): Rotate Canvas keeps its Interpolation pick out of remembered values

The Arbitrary rotation dialog fills its interpolation row from Preferences >
General > Image Interpolation on every opening, but the row was an ordinary
choice row, so the framework remembered a confirmed pick and applied it over
the opening values on the next opening: a one-time Bilinear choice silently
resampled later rotations, and a changed preference never reached the dialog
again. The row now opts out of remembering, like the rows beside it that the
open document supplies (angle, direction) and like Lens Blur's depth map.
The dropdown itself goes away with #14462.

Red before green: the new ui-egui test
arbitrary_rotation_interpolation_reopens_at_the_preference failed on the head
without the fix (left bilinear, right bicubic) and passes with it.
This commit is contained in:
hnoerenberg committed 2026-11-19 09:00:55 +01:00
1 parent a37e9fc7a5
commit 213cd3470b
2 files changed
+36

No files matched your search

@@ -328,6 +328,12 @@ 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);
@@ -218,6 +218,36 @@ 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).
#[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");
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.
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");
cancel(&mut app, id);
}
/// A layer-id param has no number field: the Auto-Align dialog used to write `reference: 0`
/// back, which the engine rejects as not a selected layer (#674).
#[test]