diff --git a/crates/ui-egui/src/caches.rs b/crates/ui-egui/src/caches.rs index ec50e4c8a4..244f69f9df 100644 --- a/crates/ui-egui/src/caches.rs +++ b/crates/ui-egui/src/caches.rs @@ -225,11 +225,14 @@ pub struct CacheKey { /// The paper under the art that translucent art is blended with before the conversion /// ([`crate::display_profile::convert_over`]). None without a display profile, and in Outline. pub backdrop: Option>, - /// The active color settings ([`vectorcraft_color::cms::active_settings`]) and the loaded - /// profiles' generation ([`vectorcraft_color::cms::profiles_generation`]) the frame's colors - /// were converted with: Edit › Color Settings, a profile loaded again under its name or removed, - /// and the front document's assigned profiles change them without changing the document. - pub color: (vectorcraft_color::cms::ColorSettings, u64), + /// The active color settings ([`vectorcraft_color::cms::active_settings`]), the working color + /// settings ([`vectorcraft_color::cms::working_settings`]) and the loaded profiles' generation + /// ([`vectorcraft_color::cms::profiles_generation`]) the frame's colors were converted with: + /// Edit › Color Settings, a profile loaded again under its name or removed, and the front + /// document's assigned profiles change them without changing the document. A proof of the + /// working CMYK space converts through the working settings, which can change while the active + /// settings stay the same. + pub color: (vectorcraft_color::cms::ColorSettings, vectorcraft_color::cms::ColorSettings, u64), } impl CacheKey { diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index f9a49a3e18..dc422b125c 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -923,7 +923,7 @@ fn cache_key( // Preferences › Performance › Use Monitor Profile for Canvas. display: app.display_profile.key(app.session.prefs.monitor_profile_display), backdrop: backdrop(app, st, app.outline_view()), - color: (vectorcraft_color::cms::active_settings(), vectorcraft_color::cms::profiles_generation()), + color: (vectorcraft_color::cms::active_settings(), vectorcraft_color::cms::working_settings(), vectorcraft_color::cms::profiles_generation()), } } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index fa9a6b813e..c80546d29c 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -4882,7 +4882,7 @@ fn color_settings_and_a_reloaded_profile_render_the_canvas_again() { }; load(&mut app, cms::GENERIC_CMYK); app.run("edit.assignProfile", json!({"cmyk": name})).unwrap(); - let assigned = middle(&mut app).unwrap_or(first); + let assigned = middle(&mut app).expect("assigning a profile re-renders the canvas"); assert!(near(assigned, generic), "through the assigned copy of the working space: {assigned:?}, not {generic:?}"); assert_eq!(middle(&mut app), None, "nothing changed: no re-render"); // The same name, the settings as they were: only the profile's file is new. @@ -4890,6 +4890,20 @@ fn color_settings_and_a_reloaded_profile_render_the_canvas_again() { let reloaded = middle(&mut app).expect("the profile loaded again re-renders the canvas"); assert!(near(reloaded, device), "through the profile's new file: {reloaded:?}, not {device:?}"); assert_eq!(middle(&mut app), None, "nothing changed since: no re-render"); + + // A proof of the working CMYK space converts through the working settings. With the document's + // assigned profile in place of the working CMYK space, a new working CMYK space leaves the + // active settings as they were and changes only the proof. + app.run("view.proofSetup", json!({"target": "workingCmyk"})).unwrap(); + app.run("view.proofColors", json!({"on": true})).unwrap(); + let proofed = middle(&mut app).expect("Proof Colors re-renders the canvas"); + assert_eq!(middle(&mut app), None, "nothing changed: no re-render"); + let active = cms::active_settings(); + app.run("edit.colorSettings", json!({"cmyk": cms::DEVICE_CMYK})).unwrap(); + let reproofed = middle(&mut app).expect("a new working CMYK space re-renders the proof"); + assert_eq!(cms::active_settings(), active, "the assigned profile keeps the active settings"); + assert!(!near(reproofed, [proofed[0], proofed[1], proofed[2]]), "the proof through the new working CMYK space: {reproofed:?}, not {proofed:?}"); + assert_eq!(middle(&mut app), None, "nothing changed since: no re-render"); } /// Guides & Grid › Show Pixel Grid (Above 600% Zoom) (#394): in Pixel Preview at 600% zoom and