layout::{LayoutDisplay, LayoutFlexDirection, LayoutAlignItems, LayoutAlignSelf, LayoutFlexGrow, LayoutJustifyContent, LayoutPaddingTop, LayoutPaddingBottom, LayoutPaddingLeft, LayoutPaddingRight},
style::{StyleBackgroundContent, StyleBackgroundContentVec, LayoutBorderTopWidth, LayoutBorderBottomWidth, LayoutBorderRightWidth, StyleBorderTopStyle, BorderStyle, StyleBorderBottomStyle, StyleBorderRightStyle, StyleBorderTopColor, StyleBorderBottomColor, StyleBorderRightColor, StyleCursor, StyleTextAlign, StyleUserSelect, StyleTextColor, LayoutBorderLeftWidth, StyleBorderLeftStyle, StyleBorderLeftColor, StyleBorderTopLeftRadius, StyleBorderBottomLeftRadius, StyleBorderTopRightRadius, StyleBorderBottomRightRadius},
#[allow(clippy::too_many_lines)] // large but cohesive: single-purpose layout/render/parse routine (one branch per case)
fn build_segment_style(selected: bool, is_first: bool, is_last: bool) -> CssPropertyWithConditionsVec {
CssPropertyWithConditions::simple(CssProperty::const_align_items(LayoutAlignItems::Center)),
CssPropertyWithConditions::simple(CssProperty::const_padding_top(LayoutPaddingTop::const_px(
CssPropertyWithConditions::simple(CssProperty::const_border_top_style(StyleBorderTopStyle {
CssPropertyWithConditions::simple(CssProperty::const_border_top_color(StyleBorderTopColor {
CssPropertyWithConditions::simple(CssProperty::const_font_size(StyleFontSize::const_px(13))),
extern "C" fn record_index(mut data: RefAny, _: CallbackInfo, state: SegmentedState) -> Update {
assert_eq!(background_color(&style), Some(bg), "selected={selected}: background moved with position");
assert_eq!(text_color(&style), Some(fg), "selected={selected}: text colour moved with position");
assert_eq!(background_color(&build_segment_style(true, false, false)), Some(SEG_SELECTED_BG_COLOR));
assert_eq!(background_color(&build_segment_style(false, false, false)), Some(SEG_UNSELECTED_BG_COLOR));
assert_eq!(installed.callback.cb as usize, change_refresh_all as usize, "the last setter must win");
assert_eq!(seg.segmented_state.inner.selected_index, 2, "installing a callback moved the selection");
assert!(dom.root.get_callbacks().as_ref().is_empty(), "the container itself is not clickable");
assert_eq!(radii_of(&children[0]), (Some(r), None, Some(r), None), "first: left corners only");