From 39a7ddf9d3bc29fa85320f12be1112a70f2b6c6f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 21 Nov 2026 17:15:04 -0800 Subject: [PATCH] Form dialogs: a color row can carry opacity (ParamKind::color_with_alpha) ParamKind::Color gains an `alpha` field. ParamKind::color_with_alpha takes an RGBA default and makes a row that holds a four-component FieldValue::Rgba (a `#rrggbbaa` value). The row shows an opacity field in percent beside the swatch, held to 0 to 100 and disabled while the row has no color. The picker and the eyedropper set the color and keep the opacity, and a color picked into an unset row starts at the row's opacity. ParamKind::color keeps three components. - DialogFields::rgba reads a Rgba value, a Color as opaque, or four stored integers (`[1, 0, 0, 1]`, which an untagged read keeps as a grid). - Automation sets take four components with an opacity in 0 to 1 and refuse three, or an opacity outside that range. - A remembering dialog reads a stored four-integer array under a row with opacity (`[1, 0, 0, 1]`) back as a color, not a grid. - The parameter rows story gains a color row with opacity. --- .../src/patterns/form_dialogs/dialog.rs | 12 +++- .../src/patterns/form_dialogs/fields.rs | 27 ++++++-- .../src/patterns/form_dialogs/param.rs | 41 +++++++++-- .../src/patterns/form_dialogs/rows.rs | 30 +++++++- .../src/patterns/form_dialogs/rows/stories.rs | 3 +- .../src/patterns/form_dialogs/words.rs | 1 + .../tests/it/form_dialogs/params.rs | 69 ++++++++++++++++++- 7 files changed, 166 insertions(+), 17 deletions(-) diff --git a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs index 69d9af12a1..cce1535752 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/dialog.rs @@ -380,6 +380,15 @@ impl<'a> ParamDialog<'a> { let units = params.iter().filter(|param| param.is_remembered()).filter_map(Param::unit_key); let keys: Vec<&str> = params.iter().filter(|param| kept(param)).map(|param| param.key.as_str()).chain(units).collect(); let mut values = fields.clone(); + // A color with opacity stored as four integers (`[1, 0, 0, 1]`, opaque red) reads back as a grid. + for param in params { + if let ParamKind::Color { alpha: Some(_), .. } = param.kind + && let Some(FieldValue::Grid(_)) = values.get(¶m.key) + && let Some(rgba) = values.rgba(¶m.key) + { + values.set(param.key.as_str(), FieldValue::Rgba(rgba)); + } + } values.retain_fitting(&keys, |key, value| params.iter().any(|param| param.accepts(key, value))); values } @@ -1073,7 +1082,8 @@ fn read_value(kind: &ParamKind, value: Value) -> Option { ParamKind::Int { .. } | ParamKind::Channel { .. } => FieldValue::Int(value.as_i64()?), ParamKind::Bool { .. } => FieldValue::Bool(value.as_bool()?), ParamKind::Choice { .. } | ParamKind::Radio { .. } | ParamKind::Text { .. } => FieldValue::Text(value.as_str()?.to_owned()), - ParamKind::Color { .. } => FieldValue::Color(serde_json::from_value(value).ok()?), + ParamKind::Color { alpha: None, .. } => FieldValue::Color(serde_json::from_value(value).ok()?), + ParamKind::Color { alpha: Some(_), .. } => FieldValue::Rgba(serde_json::from_value(value).ok()?), ParamKind::Point { .. } => FieldValue::Point(serde_json::from_value(value).ok()?), ParamKind::Grid { .. } => FieldValue::Grid(serde_json::from_value(value).ok()?), ParamKind::Blend { .. } | ParamKind::Pattern { .. } => FieldValue::Text(value.as_str()?.to_owned()), diff --git a/crates/ui-patterns/src/patterns/form_dialogs/fields.rs b/crates/ui-patterns/src/patterns/form_dialogs/fields.rs index b5f292a886..6cc859e4f7 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/fields.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/fields.rs @@ -27,10 +27,14 @@ pub enum FieldValue { Point([f64; 2]), /// A row-major grid of integers (Custom filter's 5×5 kernel). Grid(Vec), + /// sRGB components and opacity in 0..=1, as a color parameter with opacity is kept (`#rrggbbaa` is these times + /// 255). After `Grid` so an untagged read keeps four integers a grid; a remembering dialog reads four integers + /// under a color row with opacity back as this. + Rgba([f32; 4]), /// A list of values of any kind: Color Table's colours, Replace Color's sampled points. Last - /// so an untagged read keeps the fixed-shape variants above; a list of integers or of two or - /// three numbers reads back as `Grid`, `Point` or `Color`, which [`DialogFields::list`] turns - /// back into the list. + /// so an untagged read keeps the fixed-shape variants above; a list of integers or of two, + /// three or four numbers reads back as `Grid`, `Point`, `Color` or `Rgba`, which + /// [`DialogFields::list`] turns back into the list. List(Vec), /// Any JSON value: what a [`ParamKind::Custom`](super::ParamKind::Custom) row keeps under its key when its value is /// structured (Blur Gallery's pins, `[{x, y, blur, …}]`). Last so an untagged read keeps the fixed-shape variants @@ -179,6 +183,20 @@ impl DialogFields { } } + /// `Rgba` as RGB and opacity in 0–1, a `Color` as opaque, or a `Grid` of four cells (the shape an untagged read + /// gives a color stored as four integers, `[1, 0, 0, 1]`), else `None`. + pub fn rgba(&self, key: &str) -> Option<[f32; 4]> { + match self.values.get(key)? { + FieldValue::Rgba(c) => Some(*c), + FieldValue::Color([r, g, b]) => Some([*r, *g, *b, 1.0]), + FieldValue::Grid(cells) => match cells[..] { + [r, g, b, a] => Some([r as f32, g as f32, b as f32, a as f32]), + _ => None, + }, + _ => None, + } + } + /// `Point` as `[x, y]`, else `None`. pub fn point(&self, key: &str) -> Option<[f64; 2]> { match self.values.get(key)? { @@ -195,7 +213,7 @@ impl DialogFields { } } - /// A `List`, or a `Grid`, `Point` or `Color` as the list of its numbers (the shapes an + /// A `List`, or a `Grid`, `Point`, `Color` or `Rgba` as the list of its numbers (the shapes an /// untagged read gives a stored list of numbers, and an empty list), or a `Json` array read as /// those values. The key may have no parameter row: a host keeps its own data under it (a key /// without a row is not remembered). @@ -205,6 +223,7 @@ impl DialogFields { FieldValue::Grid(cells) => Cow::Owned(cells.iter().map(|c| FieldValue::Int(*c)).collect()), FieldValue::Point(p) => Cow::Owned(p.iter().map(|n| FieldValue::Number(*n)).collect()), FieldValue::Color(c) => Cow::Owned(c.iter().map(|n| FieldValue::Number(f64::from(*n))).collect()), + FieldValue::Rgba(c) => Cow::Owned(c.iter().map(|n| FieldValue::Number(f64::from(*n))).collect()), FieldValue::Json(serde_json::Value::Array(items)) => { Cow::Owned(items.iter().map(|item| serde_json::from_value(item.clone())).collect::>().ok()?) } diff --git a/crates/ui-patterns/src/patterns/form_dialogs/param.rs b/crates/ui-patterns/src/patterns/form_dialogs/param.rs index f3918c6a26..1c8029fa35 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/param.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/param.rs @@ -94,11 +94,16 @@ pub enum ParamKind { /// The digits after the decimal point the field keeps; 0 takes whole degrees. decimals: u32, }, - /// A colour the host's picker chooses; `None`: unset until picked. + /// A color the host's picker chooses; `None`: unset until picked. Without `alpha` the field holds a + /// [`FieldValue::Color`]. With it the row adds an opacity field in percent beside the swatch and the field holds a + /// [`FieldValue::Rgba`]; the picker and the eyedropper set the color and keep the opacity. #[non_exhaustive] Color { /// The colour as RGB in 0 to 1; `None` leaves it unset. default: Option<[f32; 3]>, + /// The opacity in 0 to 1 that the default opens with and that a color picked into an unset row takes; `None` + /// for a row without opacity. + alpha: Option, }, /// A grid of `cells` integer fields, [`grid_side`](ParamKind::grid_side) per row (`int[25]` is 5×5). A `cells` /// that is not square wraps every `round(sqrt(cells))` fields and the last row is short. @@ -225,7 +230,14 @@ impl ParamKind { /// A colour the host's picker chooses. pub fn color(default: Option<[f32; 3]>) -> Self { - ParamKind::Color { default } + ParamKind::Color { default, alpha: None } + } + + /// A color the host's picker chooses, with an opacity field beside it: a `#rrggbbaa` value. `default` is RGBA in + /// 0 to 1; `None` leaves the color unset, and a color picked into it starts opaque. + pub fn color_with_alpha(default: Option<[f32; 4]>) -> Self { + let alpha = default.map_or(1.0, |[_, _, _, a]| a.clamp(0.0, 1.0)); + ParamKind::Color { default: default.map(|[r, g, b, _]| [r, g, b]), alpha: Some(alpha) } } /// A grid of `cells` integer fields. @@ -279,7 +291,11 @@ impl ParamKind { let initial = default.as_deref().or_else(|| options.first().map(|(id, _)| id.as_str())); FieldValue::Text(initial.unwrap_or_default().to_owned()) } - ParamKind::Color { default } => FieldValue::Color((*default)?), + ParamKind::Color { default, alpha: None } => FieldValue::Color((*default)?), + ParamKind::Color { default, alpha: Some(alpha) } => { + let [r, g, b] = (*default)?; + FieldValue::Rgba([r, g, b, *alpha]) + } ParamKind::Grid { cells: count, default } => { let mut cells = vec![*default; *count]; // A grid that starts at 0 is a kernel: the identity, 1 in the centre. @@ -323,7 +339,10 @@ impl ParamKind { (ParamKind::Choice { options, .. } | ParamKind::Radio { options, .. }, FieldValue::Text(id)) => { options.iter().any(|(option, _)| option == id) } - (ParamKind::Color { .. }, FieldValue::Color(c)) => c.iter().all(|v| v.is_finite()), + (ParamKind::Color { alpha: None, .. }, FieldValue::Color(c)) => c.iter().all(|v| v.is_finite()), + (ParamKind::Color { alpha: Some(_), .. }, FieldValue::Rgba([r, g, b, a])) => { + [r, g, b].iter().all(|v| v.is_finite()) && (0.0..=1.0).contains(a) + } (ParamKind::Grid { cells: count, .. }, FieldValue::Grid(cells)) => cells.len() == *count, (ParamKind::Point { .. }, FieldValue::Point(p)) => p.iter().all(|v| v.is_finite()), (ParamKind::Channel { names, .. }, FieldValue::Int(i)) => usize::try_from(*i).is_ok_and(|i| i < names.len()), @@ -1110,10 +1129,18 @@ pub fn encode(component: f32) -> u8 { } /// Writes `color` into the colour parameter `key` of `params`, or into a key no parameter has when a -/// [`Param::custom`] row can have asked for it; other keys are ignored. +/// [`Param::custom`] row can have asked for it; other keys are ignored. A row with opacity takes the color's RGB and +/// keeps its opacity, or takes the row's starting opacity when it had no color; `color`'s alpha is not read. pub fn set_color_field(params: &[Param], fields: &mut DialogFields, key: &str, color: Srgba) { - let colour_row = params.iter().any(|param| param.key == key && matches!(param.kind, ParamKind::Color { .. })); - let custom_request = params.iter().any(|param| matches!(param.kind, ParamKind::Custom(_))) && params.iter().all(|param| param.key != key); + let row = params.iter().find(|param| param.key == key); + if let Some(ParamKind::Color { alpha: Some(start), .. }) = row.map(|param| ¶m.kind) { + let alpha = fields.rgba(key).map_or(*start, |[_, _, _, a]| a); + let [r, g, b] = color.to_rgb_array(); + fields.set(key, FieldValue::Rgba([r, g, b, alpha])); + return; + } + let colour_row = row.is_some_and(|param| matches!(param.kind, ParamKind::Color { .. })); + let custom_request = params.iter().any(|param| matches!(param.kind, ParamKind::Custom(_))) && row.is_none(); if colour_row || custom_request { fields.set(key, FieldValue::Color(color.to_rgb_array())); } diff --git a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs index 33a6edb216..5d4ee772b6 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/rows.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/rows.rs @@ -63,7 +63,8 @@ pub struct ParamRowsOutput { /// A binding that writes through has them already; a given one applies them. pub values: Option, /// The colour parameter whose button was pressed this pass: the host opens its colour picker for the request and - /// writes the answer into the request's key as a [`FieldValue::Color`]. + /// writes the answer into the request's key as a [`FieldValue::Color`], or with `set_color_field`, which keeps a + /// row's opacity in a [`FieldValue::Rgba`]. pub pick_color: Option, /// The Browse button pressed this pass: the host picks a path and writes it into the request's key as a /// [`FieldValue::Text`]. @@ -793,7 +794,14 @@ impl<'p> Pass<'p> { /// A colour row: a swatch that asks the host's picker (mixed while the row has no colour), and the eyedropper /// toggle when the row has one. fn color(&mut self, ui: &mut Ui, line: &Line<'_>) { - let color = self.work.color(line.key); + let alpha = match line.param.kind { + ParamKind::Color { alpha, .. } => alpha, + _ => None, + }; + let color = match alpha { + Some(_) => self.work.rgba(line.key), + None => self.work.color(line.key).map(|[r, g, b]| [r, g, b, 1.0]), + }; let option = line.param.option(); if option.eyedropper() && self.memo.declared.insert(line.key.to_owned(), option.armed()) != Some(option.armed()) { if option.armed() { @@ -804,9 +812,12 @@ impl<'p> Pass<'p> { } let armed = self.memo.armed.as_deref() == Some(line.key); let previewed = self.previews.iter().find(|(key, _)| key == line.key).map(|(_, color)| *color); + // A previewed color shows at the row's opacity: the picker sets the color, and the opacity field sets the alpha. + let opacity = color.map_or(alpha.unwrap_or(1.0), |[_, _, _, a]| a); let shown = match previewed { + Some(color) if alpha.is_some() => Mixed::Same(Srgba { a: opacity, ..color }), Some(color) => Mixed::Same(color), - None => color.map_or(Mixed::Mixed, |rgb| Mixed::Same(Srgba::from_rgb_array(rgb))), + None => color.map_or(Mixed::Mixed, |rgba| Mixed::Same(Srgba::from_array(rgba))), }; line.show(ui, |ui| { beside(ui, |ui| { @@ -814,6 +825,19 @@ impl<'p> Pass<'p> { if let Some(request) = swatch.pick_color { self.color = Some(request); } + if alpha.is_some() { + let name = Label::from(self.words.opacity.fill(&[("name", line.name.as_str())])); + let percent = color.map(|[_, _, _, a]| (f64::from(a) * 100.0).round()); + let field = number_field(self.units, name, percent, WHOLE, Some(UnitKind::Percent)) + .range(PERCENT) + .enabled(color.is_some()) + .id_salt("opacity"); + let shown = field.show(ui); + self.alert(shown.out_of_range); + if let (Some([r, g, b, _]), Some(percent)) = (color, shown.edit.value().cloned().flatten()) { + self.work.set(line.key, FieldValue::Rgba([r, g, b, (percent / 100.0) as f32])); + } + } if option.eyedropper() { let toggle = ToggleButton::new(self.words.eyedropper.clone(), Bind::given(armed)) .icon(IconId::new("eyedropper")) diff --git a/crates/ui-patterns/src/patterns/form_dialogs/rows/stories.rs b/crates/ui-patterns/src/patterns/form_dialogs/rows/stories.rs index 7e209b2873..e75356fe24 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/rows/stories.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/rows/stories.rs @@ -28,7 +28,7 @@ fn patterns() -> PresetSource<'static, String> { /// One row of every kind the rows show, a section, a row that waits for a check box, a row with a unit menu, a /// multi-line text row, a text row forty characters wide, a searchable choice, a radio row with a disabled option, a radio row with its options in a row, -/// a blend row, a pattern row, a files row in folder mode and a section of read-only rows. +/// a blend row, a pattern row, a files row in folder mode, a color row with opacity and a section of read-only rows. fn params() -> Vec { let mut params = Param::parse_list(SPEC); let blend = vec![ @@ -45,6 +45,7 @@ fn params() -> Vec { params.push(Param::new("fit", "Fit", ParamKind::radio(sizes(), Some("medium".to_owned()))).options_in_row()); params.push(Param::new("angle", "Angle", ParamKind::angle(30.0))); params.push(Param::new("centre", "Centre", ParamKind::point([50.0, 50.0]))); + params.push(Param::new("shadow", "Shadow", ParamKind::color_with_alpha(Some([0.0, 0.0, 0.0, 0.5])))); params.push(Param::section("Output")); params.push(Param::number("width", "Width", 640.0, 1.0, 0).bounds(Some(1.0), None).unit(UnitKind::Pixels)); params.push(Param::number_with_units( diff --git a/crates/ui-patterns/src/patterns/form_dialogs/words.rs b/crates/ui-patterns/src/patterns/form_dialogs/words.rs index fa0ed248a8..533161ac9a 100644 --- a/crates/ui-patterns/src/patterns/form_dialogs/words.rs +++ b/crates/ui-patterns/src/patterns/form_dialogs/words.rs @@ -12,6 +12,7 @@ craft_ui::words! { point_x: template "param.pointX" = "{name} X"; point_y: template "param.pointY" = "{name} Y"; grid_cell: template "param.gridCell" = "{name} {row}, {column}"; + opacity: template "param.opacity" = "{name} opacity"; choose_color: "param.chooseColor" = "Choose…"; } } diff --git a/crates/ui-patterns/tests/it/form_dialogs/params.rs b/crates/ui-patterns/tests/it/form_dialogs/params.rs index 90ec7fd5a3..c26e4b4b79 100644 --- a/crates/ui-patterns/tests/it/form_dialogs/params.rs +++ b/crates/ui-patterns/tests/it/form_dialogs/params.rs @@ -3,7 +3,9 @@ use craft_ui::contract::{Bind, Role}; use craft_ui::patterns::blend_keys::{BlendKeyEntry, BlendShortcut}; -use craft_ui::patterns::form_dialogs::{DialogFields, FieldValue, NumberUnit, Param, ParamDialog, ParamKind, ParamRows, set_param_field}; +use craft_ui::patterns::form_dialogs::{ + DialogFields, FieldValue, NumberUnit, Param, ParamDialog, ParamKind, ParamRows, open_fields, set_color_field, set_param_field, +}; use craft_ui::patterns::presets::{PresetFns, PresetRow, PresetSource}; use craft_ui::runtime::env::{Label, Scale, UnitKind}; use craft_ui::testing::{Fixture, trial}; @@ -388,6 +390,71 @@ fn a_pattern_row_picks_its_pattern() { assert_eq!(held().as_deref(), Some("sand"), "a group header writes nothing"); } +/// A color row with opacity holds four components: its default, an automation set and a picked color carry the +/// opacity, a row without opacity keeps three, and stored values read back in their own shapes. +#[trial] +fn a_color_row_with_opacity_holds_four_components() { + let params = vec![ + Param::new("fill", "Fill", ParamKind::color_with_alpha(Some([1.0, 0.0, 0.0, 0.5]))), + Param::new("stroke", "Stroke", ParamKind::color_with_alpha(None)), + Param::new("tint", "Tint", ParamKind::color(Some([0.0, 0.0, 1.0]))), + ]; + let mut fields = DialogFields::new(); + open_fields(¶ms, &mut fields); + assert_eq!(fields.get("fill"), Some(&FieldValue::Rgba([1.0, 0.0, 0.0, 0.5])), "the default opens with its opacity"); + assert_eq!(fields.get("stroke"), None, "a row without a default stays unset"); + assert_eq!(fields.get("tint"), Some(&FieldValue::Color([0.0, 0.0, 1.0])), "a row without opacity keeps three components"); + assert!(!params[0].accepts("fill", &FieldValue::Color([1.0, 0.0, 0.0])), "a row with opacity refuses three components"); + assert!(!params[2].accepts("tint", &FieldValue::Rgba([0.0, 0.0, 1.0, 0.5])), "a row without opacity refuses four"); + + set_param_field(¶ms, &mut fields, "fill", json!([0.0, 1.0, 0.0, 0.25])).expect("the row takes four components"); + assert_eq!(fields.rgba("fill"), Some([0.0, 1.0, 0.0, 0.25])); + assert!(set_param_field(¶ms, &mut fields, "fill", json!([0.0, 1.0, 0.0])).is_err(), "three components are refused"); + assert!(set_param_field(¶ms, &mut fields, "fill", json!([0.0, 1.0, 0.0, 1.5])).is_err(), "an opacity over 1 is refused"); + assert!(set_param_field(¶ms, &mut fields, "fill", json!([0.0, 1.0, 0.0, -0.5])).is_err(), "a negative opacity is refused"); + + set_color_field(¶ms, &mut fields, "fill", craft_theme::Srgba::rgb(0.0, 0.0, 1.0)); + assert_eq!(fields.rgba("fill"), Some([0.0, 0.0, 1.0, 0.25]), "a picked color keeps the row's opacity"); + set_color_field(¶ms, &mut fields, "stroke", craft_theme::Srgba::new(1.0, 1.0, 1.0, 0.1)); + assert_eq!(fields.rgba("stroke"), Some([1.0, 1.0, 1.0, 1.0]), "an unset row takes its starting opacity, not the picker's"); + + fields.set("kernel", FieldValue::Grid(vec![1, 0, 0, 1])); + let stored = serde_json::to_string(&fields).expect("the fields serialize"); + let read: DialogFields = serde_json::from_str(&stored).expect("the fields read back"); + assert_eq!(read, fields, "four components read back as a color with opacity, four integers as a grid"); + + let written: DialogFields = serde_json::from_str(r#"{"fill": [1, 0, 0, 1], "stroke": [0, 0, 1, 2]}"#).expect("the map reads"); + assert_eq!(written.rgba("fill"), Some([1.0, 0.0, 0.0, 1.0]), "four integers read as a color with opacity"); + let kept = ParamDialog::remembered(¶ms, &written); + assert_eq!(kept.get("fill"), Some(&FieldValue::Rgba([1.0, 0.0, 0.0, 1.0])), "a stored opaque color written as integers is kept"); + assert_eq!(kept.get("stroke"), None, "a stored opacity over 1 is dropped"); +} + +/// The opacity field beside a color row with opacity sets the alpha and keeps the color, held to 0 to 100 percent; +/// it takes no input while the row has no color, and a row without opacity has no such field. +#[trial] +fn the_opacity_field_of_a_color_row_sets_its_alpha() { + let params = vec![ + Param::new("fill", "Fill", ParamKind::color_with_alpha(Some([1.0, 0.0, 0.0, 0.5]))), + Param::new("stroke", "Stroke", ParamKind::color_with_alpha(None)), + Param::new("tint", "Tint", ParamKind::color(Some([0.0, 0.0, 1.0]))), + ]; + let values = Rc::new(RefCell::new(DialogFields::new())); + let mut fixture = rows(params, &values); + let enter = |fixture: &mut Fixture, label: &str, text: &str| { + let field = fixture.by_label(label).expect("the opacity field"); + fixture.click(&field).settle(); + fixture.key(Key::A, Modifiers::COMMAND).type_text(text).key(Key::Tab, Modifiers::NONE).settle(); + }; + enter(&mut fixture, "Fill opacity", "25"); + assert_eq!(values.borrow().rgba("fill"), Some([1.0, 0.0, 0.0, 0.25]), "the typed opacity sets the alpha"); + enter(&mut fixture, "Fill opacity", "150"); + assert_eq!(values.borrow().rgba("fill"), Some([1.0, 0.0, 0.0, 1.0]), "an opacity over 100 percent is held to opaque"); + enter(&mut fixture, "Stroke opacity", "40"); + assert_eq!(values.borrow().get("stroke"), None, "an unset row takes no opacity"); + assert!(fixture.by_label("Tint opacity").is_none(), "a row without opacity has no opacity field"); +} + /// Rows that follow one unit choice show the same base value in the chosen unit and store the base value; a typed /// zero on a row with no lower bound reaches the value. #[trial]