Tests: run the profile-assigning status bar and Assign rows tests in their own process

Assigning a profile to the front document changes the process's active
color settings (`cms::active`). The status bar readout test assigned
ProPhoto RGB, and the Separations Preview Assign rows test assigned other
RGB and CMYK profiles, in the shared test process. A test that converted
a color while either profile was active got that profile's values: under
plain `cargo test`, `an_artboard_shows_its_background_color_live` read
sRGB red as #b3461a, its ProPhoto RGB value.

Both tests now start with `testing::in_own_process`, as the crate's
other tests that assign profiles or change Color Settings do, and that
helper's doc names these cases.
This commit is contained in:
dotCooCoo committed 2026-11-28 01:26:44 -08:00
1 parent 3c7a3c7904
commit 789fbb6994
3 files changed
+13 -2

No files matched your search

+4
View File
@@ -772,6 +772,10 @@ fn current_tool_names_the_selection_tool_cmd_lends() {
/// color profile.
#[test]
fn the_status_bar_info_field_shows_the_chosen_readout() {
// Assigning a profile to the front document changes the process's active color settings.
if !crate::testing::in_own_process("chrome::tests::the_status_bar_info_field_shows_the_chosen_readout") {
return;
}
let mut bar = status_readout_app();
let texts = status_readout_frame(&mut bar);
assert!(texts.iter().any(|t| t.text == "Selection"), "Current Tool by default: {texts:?}");
+4
View File
@@ -546,6 +546,10 @@ mod tests {
/// model's profile stays as it was.
#[test]
fn assign_rows_follow_the_document_color_mode() {
// Assigning a profile to the front document changes the process's active color settings.
if !crate::testing::in_own_process("panels::separations::tests::assign_rows_follow_the_document_color_mode") {
return;
}
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.run("file.new", json!({})).unwrap();
for (mode, key, kind, other) in [("rgb", "rgb", ProfileKind::Rgb, "cmyk"), ("cmyk", "cmyk", ProfileKind::Cmyk, "rgb")] {
+5 -2
View File
@@ -94,8 +94,11 @@ pub(crate) fn custom_dictionary() -> std::sync::MutexGuard<'static, ()> {
/// Runs the test `name` (its path in the crate, such as `canvas::tests::a_test`) alone in a child test process, for a
/// test that loads or removes a color profile. The loaded profiles are the whole process's, and the canvas's frame key
/// holds their generation ([`vectorcraft_color::cms::profiles_generation`]), so a profile loaded in this process while
/// another test renders changes that test's keys. In the child it returns `true`, and the test goes on. Here it waits
/// for the child, fails when the child's test fails, and returns `false`.
/// another test renders changes that test's keys. A test that assigns a profile to its front document, or changes
/// Color Settings, also runs here: the active color settings ([`vectorcraft_color::cms::active`]) are the whole
/// process's too, and another test converting a color while they are changed gets that profile's values. In the child
/// it returns `true`, and the test goes on. Here it waits for the child, fails when the child's test fails, and returns
/// `false`.
pub(crate) fn in_own_process(name: &str) -> bool {
const CHILD: &str = "VECTORCRAFT_TEST_OWN_PROCESS";
if std::env::var_os(CHILD).is_some_and(|v| v == name) {