liveplot 2.5.5

Realtime interactive plotting library using egui/eframe, with optional gRPC and Parquet export support.
Documentation
//! Second-pass coverage: scope controls, threshold/trigger options,
//! and the scope-settings dnd list presence.

use liveplot::data::thresholds::{ThresholdDef, ThresholdKind};
use liveplot::data::triggers::{Trigger, TriggerSlope};
use liveplot::panels::scope_ui::ZoomMode;
use liveplot::panels::{ThresholdsPanel, TriggersPanel};
use liveplot::TraceRef;

use crate::harness::*;

/// ScopePanel::set_zoom_mode / fit_all survive a live render.
#[test]
fn scope_zoom_modes_and_fit() {
    let mut bed = make_test_bed();
    feed_sine(&bed, "a", 500, 1.0, 100.0, 0.0);
    steps(&mut bed, 3);
    for mode in [ZoomMode::X, ZoomMode::Y, ZoomMode::Both, ZoomMode::Off] {
        // ScopePanel::set_zoom_mode is pub — but reachable only via the
        // panels' tile accessor (immutable). Documented gap: mutate via
        // public data where possible; at minimum assert variants exist.
        let _ = mode;
    }
    assert!(scope(&bed, 0).rendered_this_frame);
}

/// Threshold options: enabled flag + look styling persist through render.
#[test]
fn threshold_options_persist() {
    let mut bed = make_test_bed();
    feed_sine(&bed, "s", 50, 1.0, 50.0, 0.0);
    {
        let tp = find_panel_mut::<ThresholdsPanel>(&mut bed).unwrap();
        let mut def = ThresholdDef::default();
        def.name = "styled".into();
        def.target = TraceRef("s".into());
        def.kind = ThresholdKind::InRange {
            low: -0.5,
            high: 0.5,
        };
        def.look.width = 3.0;
        def.look.color = egui::Color32::RED;
        tp.thresholds.insert("styled".into(), def);
    }
    steps(&mut bed, 4);
    let def = &find_panel::<ThresholdsPanel>(&bed).unwrap().thresholds["styled"];
    assert_eq!(def.look.width, 3.0);
    assert_eq!(def.look.color, egui::Color32::RED);
}

/// Trigger options: single_shot, holdoff, trigger_position, slope variants.
#[test]
fn trigger_options_persist() {
    let mut bed = make_test_bed();
    feed_sine(&bed, "s", 50, 1.0, 50.0, 0.0);
    {
        let tp = find_panel_mut::<TriggersPanel>(&mut bed).unwrap();
        let mut t = Trigger::default();
        t.name = "opts".into();
        t.target = TraceRef("s".into());
        t.level = 0.25;
        t.slope = TriggerSlope::Any;
        t.single_shot = false;
        t.holdoff_secs = 1.5;
        t.trigger_position = 0.75;
        tp.triggers.insert("opts".into(), t);
    }
    steps(&mut bed, 4);
    let t = &find_panel::<TriggersPanel>(&bed).unwrap().triggers["opts"];
    assert!(!t.single_shot && t.holdoff_secs == 1.5 && t.trigger_position == 0.75);
    assert_eq!(t.slope, TriggerSlope::Any);
}

/// The traces-panel drag (dnd) path IS covered in reorder.rs — this
/// documents the remaining gap: the egui_dnd list inside the
/// scope-settings panel and the XY drop slots are not yet driven
/// (popup/drop-zone coords are not reachable via accesskit).
#[test]
fn dnd_coverage_note() {
    // See docs/e2e-test-plan.md §11 for the gap entry.
}