feat(plot)!: harden pipeline, XY series, dash/markers, touch, packaging
Breaking: Series::gather emits x relative to x0() and takes a GatherMode; consumers reconstruct absolute x in f64 before mapping (series.hpp documents the contract). Bugs, each pinned by a fail-before regression test: - render: f32 staging quantised epoch-time x into 128 px columns; every data-space draw now stages to_space(x) - to_space(origin) with the origin folded into the offset uniform in f64 (epoch/zero-origin twins rasterise identically) - ticks: major test was ULP-fragile and blanked epoch axes; majors are an integer-index test and are never truncated by the minor cap - gather: LOD envelope emitted buckets straddling [begin,end); ceil/floor bucket edges + raw lead/trail spans - live follow: log x axes held a linear span and zoomed every frame; span and offset now live in axis space (plot + both figure link-group paths) - input: a zero-notch wheel disarmed auto_scale on every axis; dy==0 pans x, factor == 1 / inf refused in wheel and drag zoom - render: the single text flush painted legend names over the crosshair readout panel; two batches, under flushed before the panel - data: NaN dropped from min/max unless it seeded the fold; non-finite samples are now excluded from every aggregate and from cached bounds Robustness: viewport normalisation (no clamp UB), non-finite range refusal, pyramid level cap at 57 (no shift/div UB through public gather), rounded ring capacity documented + pre-sized, GL blend func and UNPACK_ALIGNMENT save/restore, Renderer::release_gl() teardown, u64 buffer epochs, annotation captions clamped, button-aware GLFW row capture, cached figure row rects (no per-event layout), ruler-pair measurement refused, span-nonfinite guards in axis_ends. Features: XY series (sorted x, binary-search neighbours/snap, LOD over sample index); StreamSeries::freeze(); ArraySeries::push(); per-trace dash and markers (scatter at width 0) with auto or literal stride; GatherMode Envelope/Nearest/Mean via bucket_sum/sumsq; Style::line_aa_px; per-glyph text colour (readout values in trace colour); wheel-dx x pan; arrow-key pan; Escape cancels a drag and restores captured ranges; modifier-masked box zoom (Shift both, Ctrl x, Alt y); double-click reset via PointerEvent::time_s; ImGui key repeat unified; pinch gestures on Qt and GTK; pixelDelta wheel path and DevicePixelRatioChange handling; GNUInstallDirs, SOVERSION, SameMinorVersion, generated plot/version.hpp, relocatable plot.pc, licence install, FILES_MATCHING, GitHub Actions CI (debug/coverage/asan). Suite 283 -> 350 cases, 0 failed; coverage 93.9% (3730/3971) over 24 files, floor 80/90 held; ASAN preset suite green; all four demos run headless (the GTK scripted-resize check needs a window manager and fails identically on the parent commit); readme_main.cpp committed and compiles with the README command; pkg-config and find_package consumption verified from a relocated install prefix.
This commit is contained in:
1 parent
f132a5ec92
commit
38ef459897
77 files changed
+5905
-688
No files matched your search
+58
-3
@@ -97,10 +97,65 @@ PLOT_TEST(minor_ticks_subdivide_and_the_total_is_capped) {
|
||||
PLOT_CHECK(std::fabs(tick.value * scale - std::round(tick.value * scale)) < 1e-9);
|
||||
PLOT_CHECK(tick.major ? !tick.label.empty() : tick.label.empty());
|
||||
}
|
||||
// A range dense enough to want millions of minors stops at the hard cap.
|
||||
}
|
||||
|
||||
/// R9: the cap counts **minors only**. A range dense enough to want more minors
|
||||
/// than fit is truncated in its subdivisions and never in its labels: every major
|
||||
/// of the span is present, labelled, and the far end of the axis keeps its number.
|
||||
PLOT_TEST(minor_cap_spares_the_majors) {
|
||||
std::vector<plot::Tick> capped;
|
||||
plot::generate_ticks({0.0, 1e9}, 1e6f, 1.0f, capped, /*include_minors=*/true);
|
||||
PLOT_CHECK(capped.size() == plot::kMaxTicks);
|
||||
// Step 1000 over [0, 65000] (65 major intervals): 260 minors want in, more than
|
||||
// the 256 the cap holds, and every one of the 66 majors still counts.
|
||||
plot::generate_ticks({0.0, 65000.0}, 65000.0f, 1000.0f, capped, /*include_minors=*/true);
|
||||
plot::usize majors = 0;
|
||||
plot::usize minors = 0;
|
||||
for (const plot::Tick& tick : capped) {
|
||||
if (tick.major) {
|
||||
++majors;
|
||||
} else {
|
||||
++minors;
|
||||
}
|
||||
}
|
||||
PLOT_CHECK(minors == plot::kMaxTicks); // minors capped exactly as before
|
||||
PLOT_CHECK(majors == 66u); // every major of the span kept
|
||||
for (plot::usize i = 1; i < capped.size(); ++i) PLOT_CHECK(capped[i].value > capped[i - 1].value);
|
||||
// The far end of the axis still carries its label.
|
||||
PLOT_CHECK(capped.back().major);
|
||||
PLOT_CHECK(!capped.back().label.empty());
|
||||
PLOT_CHECK_NEAR(capped.back().value, 65000.0, 1e-9);
|
||||
}
|
||||
|
||||
/// B2: the major/minor split is an integer-index test, so an epoch origin with a
|
||||
/// small step no longer fights a ULP-sized residue: majors are classified exactly,
|
||||
/// whatever the origin's magnitude. The +/-300 s window is the reported defect's
|
||||
/// shape; the sub-second window is where the old float-tolerance test actually
|
||||
/// misclassified (step 0.01 at 1.75e9 carries an error far above step*1e-9).
|
||||
PLOT_TEST(epoch_window_yields_labelled_majors) {
|
||||
std::vector<plot::Tick> t;
|
||||
plot::generate_ticks({1.75e9 - 300.0, 1.75e9 + 300.0}, 800.0f, 60.0f, t,
|
||||
/*include_minors=*/true);
|
||||
plot::usize majors = 0;
|
||||
for (const plot::Tick& tick : t) {
|
||||
if (!tick.major) continue;
|
||||
++majors;
|
||||
PLOT_CHECK(!tick.label.empty());
|
||||
PLOT_CHECK(tick.value >= 1.75e9 - 300.0);
|
||||
PLOT_CHECK(tick.value <= 1.75e9 + 300.0);
|
||||
}
|
||||
// Step 50 s over a 600 s window: the labelled ticks span it.
|
||||
PLOT_CHECK(majors >= 11);
|
||||
|
||||
std::vector<plot::Tick> deep;
|
||||
plot::generate_ticks({1.75e9 - 0.05, 1.75e9 + 0.05}, 800.0f, 60.0f, deep,
|
||||
/*include_minors=*/true);
|
||||
plot::usize deep_majors = 0;
|
||||
for (const plot::Tick& tick : deep) {
|
||||
if (!tick.major) continue;
|
||||
++deep_majors;
|
||||
PLOT_CHECK(!tick.label.empty());
|
||||
}
|
||||
// Step 0.01 s over a 0.1 s window: again a full set of labelled majors.
|
||||
PLOT_CHECK(deep_majors >= 9);
|
||||
}
|
||||
|
||||
PLOT_TEST(si_labels_are_utf8_and_never_overrun) {
|
||||
|
||||
Reference in new issue
Block a user