Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

facett-korp/tests/render.rs

//! Real `egui_kittest` render-proof: the `ui()` path (roster rows + Run button)
//! actually paints, and the pane is drivable after a `update_json` select — the
//! visible (watch-on-DISPLAY) leg of the robot scenario the headless drive covers.

use egui_kittest::Harness;
use facett_core::Panel;
use facett_korp::IngestPane;

#[test]
fn ingest_pane_paints_the_roster() {
    let mut pane = IngestPane::demo();
    let mut harness = Harness::builder().build_ui(move |ui| {
        Panel::ui(&mut pane, ui);
    });
    harness.run();
    // Rendered a frame without panicking — the roster + Run button are on screen.
}

#[test]
fn ingest_pane_paints_after_json_select() {
    let mut pane = IngestPane::demo();
    Panel::update_json(&mut pane, r#"{"select":2}"#);
    Panel::update_json(&mut pane, "\"run\"");
    assert_eq!(Panel::state_json(&pane)["selected_name"], "entsoe");
    let mut harness = Harness::builder().build_ui(move |ui| {
        Panel::ui(&mut pane, ui);
    });
    harness.run();
}

#[test]
fn full_production_roster_paints_and_drives_ais() {
    let mut pane = IngestPane::demo_full();
    let ais = pane.index_of("ais").expect("boats (ais) feed in the production roster");
    Panel::update_json(&mut pane, &format!("{{\"select\":{ais}}}"));
    Panel::update_json(&mut pane, "\"run\"");
    assert_eq!(Panel::state_json(&pane)["selected_name"], "ais");
    let mut harness = Harness::builder().build_ui(move |ui| {
        Panel::ui(&mut pane, ui);
    });
    harness.run();
}