fn register_after_adding_child() {
    let [id_1, id_2, id_3, id_4, id_5, id_6, id_7] = widget_ids();

    let replacer = ReplaceChild::new(Slider::new().with_id(id_1), move || {
        Split::columns(Slider::new().with_id(id_2), Slider::new().with_id(id_3)).with_id(id_7)
    })
    .with_id(id_6);

    let widget = Split::columns(Label::new("hi").with_id(id_4), replacer).with_id(id_5);

    Harness::create_simple(0.0, widget, |harness| {
        harness.send_initial_events();

        assert!(harness.get_state(id_5).children.may_contain(&id_6));
        assert!(harness.get_state(id_5).children.may_contain(&id_1));
        assert!(harness.get_state(id_5).children.may_contain(&id_4));
        assert_eq!(harness.get_state(id_5).children.entry_count(), 3);

        harness.submit_command(REPLACE_CHILD);

        assert!(harness.get_state(id_5).children.may_contain(&id_6));
        assert!(harness.get_state(id_5).children.may_contain(&id_4));
        assert!(harness.get_state(id_5).children.may_contain(&id_7));
        assert!(harness.get_state(id_5).children.may_contain(&id_2));
        assert!(harness.get_state(id_5).children.may_contain(&id_3));
        assert_eq!(harness.get_state(id_5).children.entry_count(), 5);
    })
}
/// Test that all children are registered correctly after a child is replaced.
Test that all children are registered correctly after a child is replaced.
Test that all children are registered correctly after a child is replaced .
fn register_after_adding_child() {
    let [id_1, id_2, id_3, id_4, id_5, id_6, id_7] = widget_ids();
    let replacer = ReplaceChild::new(Slider::new().with_id(id_1), move || {
        Split::columns(Slider::new().with_id(id_2), Slider::new().with_id(id_3)).with_id(id_7)
    })
    .with_id(id_6);
    let widget = Split::columns(Label::new("hi").with_id(id_4), replacer).with_id(id_5);
    Harness::create_simple(0.0, widget, |harness| {
        harness.send_initial_events();
        assert!(harness.get_state(id_5).children.may_contain(&id_6));
        assert!(harness.get_state(id_5).children.may_contain(&id_1));
        assert!(harness.get_state(id_5).children.may_contain(&id_4));
        assert_eq!(harness.get_state(id_5).children.entry_count(), 3);
        harness.submit_command(REPLACE_CHILD);
        assert!(harness.get_state(id_5).children.may_contain(&id_6));
        assert!(harness.get_state(id_5).children.may_contain(&id_4));
        assert!(harness.get_state(id_5).children.may_contain(&id_7));
        assert!(harness.get_state(id_5).children.may_contain(&id_2));
        assert!(harness.get_state(id_5).children.may_contain(&id_3));
        assert_eq!(harness.get_state(id_5).children.entry_count(), 5);
    })
}
fn register_after_adding_child ( ) { let [ id_1 , id_2 , id_3 , id_4 , id_5 , id_6 , id_7 ] = widget_ids ( ) ; let replacer = ReplaceChild :: new ( Slider :: new ( ) . with_id ( id_1 ) , move | | { Split :: columns ( Slider :: new ( ) . with_id ( id_2 ) , Slider :: new ( ) . with_id ( id_3 ) ) . with_id ( id_7 ) } ) . with_id ( id_6 ) ; let widget = Split :: columns ( Label :: new ( " " ) . with_id ( id_4 ) , replacer ) . with_id ( id_5 ) ; Harness :: create_simple ( 0.0 , widget , | harness | { harness . send_initial_events ( ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_6 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_1 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_4 ) ) ; assert_eq ! ( harness get_state ( id_5 ) children entry_count ( ) 3 ) ; harness . submit_command ( REPLACE_CHILD ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_6 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_4 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_7 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_2 ) ) ; assert ! ( harness get_state ( id_5 ) children may_contain ( id_3 ) ) ; assert_eq ! ( harness get_state ( id_5 ) children entry_count ( ) 5 ) ; } ) }
Test that all children are registered correctly after a child is replaced.
Test that all children are registered correctly after a child is replaced .