Automated HMI Verification: QTest, QSignalSpy & Headless Offscreen TAP 13
Execute deterministic QtWidgets regression suites inside headless Linux CI containers using QT_QPA_PLATFORM=offscreen, QTest::mouseClick/keyClicks, QSignalSpy::wait(), and -o -,tap TAP 13.
What you'll learn
- Drive interactive widgets headlessly under
QT_QPA_PLATFORM=offscreenusingQTest::mouseClick,QTest::keyClicks, and data-driven_data()/QFETCHtables. - Verify exact signal emission counts, argument payloads, and asynchronous timer slots using
QSignalSpyandspy.wait()/QTRY_COMPAREinstead of blockingsleep. - Emit machine-parsable
TAP version 13test transcripts via-o -,tapfor automated CI gating.
Headless Offscreen QPA Execution and Why Thread Sleeps Starve QTimers
Many embedded teams skip automated GUI testing because they assume QtWidgets binaries require an X11 or Wayland display server and a physical monitor. Qt 6 solves this natively through its built-in offscreen Qt Platform Abstraction (QPA) plugin: running QT_QPA_PLATFORM=offscreen ./tst_panel -o -,tap inside a minimal Linux container executes real QLayout geometry, QValidator filters, QPainter off-screen grab() rendering, and QTimer dispatch with zero display daemons!
When testing asynchronous HMI behavior—such as a 20 ms debounce QTimer after an operator clicks Arm—engineers coming from multi-threaded C++ often write std::this_thread::sleep_for(50ms) before asserting spy.count() == 1. That test ALWAYS fails! Why? Because the test function runs on the main GUI thread: putting that thread to sleep freezes QEventLoop so the QTimer timeout event can never be dispatched!
QSignalSpy::wait(200) and QTRY_COMPARE(spy.count(), 1) spin a nested QEventLoop until the signal arrives (returning in 20 ms, not waiting the full 200 ms timeout!) or failing cleanly if timed out.
Figure 6.3a. End-to-end headless QtWidgets verification from synthetic input injection to TAP 13 CI gates.
mental model: QTest + QSignalSpy under QT_QPA_PLATFORM=offscreen is an automated pneumatic fixture jig for your HMI: mechanical solenoids tap Arm, Start, and E-Stop across dozens of fault combinations in milliseconds while digital logic analyzers count exact output pulses into a TAP 13 test report.
Where it stops working: Headless offscreen proves C++20 state machines, QLayout geometry, QSignalSpy payloads, and software QPainter pixels, whereas physical DRM/KMS VSync tear, capacitive touch EMI noise, and optical sunlight contrast still require target hardware bench sign-off.
definition ( & Offscreen QPA Plugin): Qt Platform Abstraction (QPA) decouples QtGui/QtWidgets from windowing systems; the built-in offscreen QPA plugin backs windows with RAM QImage surfaces so CI containers need zero display servers. QSignalSpy attaches dynamically via QMetaObject (inheriting QList<QList<QVariant>>) to capture every signal emission and pump QEventLoop inside wait(timeoutMs).
- Step 1. Export QT_QPA_PLATFORM=offscreen and pass -o -,tap so headless CI runners parse TAP version 13 output.
- Step 2. Encode boundary vectors in companion _data() slots so every edge case reports an independent TAP line.
- Step 3. Simulate real operator clicks and typing via QTest::mouseClick and QTest::keyClicks rather than calling private slots.
- Step 4. Use QSignalSpy::wait() or QTRY_COMPARE so queued signals and QTimers dispatch on the test event loop.
Figure 6.3b. Run QT_QPA_PLATFORM=offscreen ./tst -o -,tap with _data(), mouseClick, and spy.wait().
Data-Driven _data Matrices, Synthetic Input Injection, and TAP 13 CI Gates
Qt6::Test pairs private test slots (void interlockMatrix()) with companion data-generator slots (void interlockMatrix_data()). Inside _data(), QTest::addColumn<T>(name) defines schema columns and QTest::newRow("case_name") << ... populates boundary vectors (below_limit, exact_limit, sustained_high_no_duplicate, estop_override), which QFETCH unpacks for each independent run.
Rather than calling internal helper methods directly, drive widgets through their public user surface with QTest::mouseClick(button, Qt::LeftButton) and QTest::keyClicks(lineEdit, "250"). That single habit tests isEnabled() gates, setAutoRepeat(false), QValidator states, and eventFilter hooks together—catching bugs where a slot works in isolation while its button was disabled or unparented!
Pass -o -,tap on the CI command line so QTest emits TAP version 13 (ok 1 - interlockMatrix(below_limit)), matching the exact TAP 13 harness contract used across every Kernel Systems Academy studio.
Figure 6.3b. Core Qt6::Test primitives for deterministic widget, signal, timer, and pixel regression suites.
| Verification Goal | Qt6::Test Primitive | Anti-Pattern to Ban | Why the Primitive Wins |
|---|---|---|---|
| Headless Docker/SSH execution | QT_QPA_PLATFORM=offscreen | Skipping GUI tests or spawning fragile Xvfb | Zero daemon dependencies; deterministic RAM surface |
| Simulate user button/key input | QTest::mouseClick / QTest::keyClicks | Calling private onArmClicked() slot directly | Verifies isEnabled(), QValidator, and eventFilter |
Await QTimer or queued signal | spy.wait(200) or QTRY_COMPARE | std::this_thread::sleep_for(200ms) | Pumps QEventLoop live; returns immediately on signal |
| Boundary & hysteresis coverage | slot_data() + QTest::newRow + QFETCH | Copy-pasting 6 nearly identical test methods | Reports exact failing row name in TAP version 13 |
learner@ksa:~/gl-q01/m06-l03$ bat -H 71 -H 85 tst_hmi_panel.cpp File: tst_hmi_panel.cpp #include <QLineEdit> #include <QPushButton> #include <QSignalSpy> #include <QTimer> #include <QtTest> class DebouncedSetpointBox final : public QWidget { Q_OBJECT public: explicit DebouncedSetpointBox(QWidget *parent = nullptr) : QWidget(parent) { m_edit = new QLineEdit(this); m_applyBtn = new QPushButton(tr("Apply"), this); m_applyBtn->setMinimumSize(44, 44); m_applyBtn->setAutoRepeat(false); connect(m_applyBtn, &QPushButton::clicked, this, [this] { bool ok = false; const int v = m_edit->text().toInt(&ok); if (!ok || v < 100 || v > 500) return; // Asynchronous 15 ms commit timer requiring an active QEventLoop! QTimer::singleShot(15, this, [this, v] { if (v >= 420 && !m_inAlarm) { m_inAlarm = true; emit alarmCrossed(v); } else if (v < 420) { m_inAlarm = false; } emit setpointApplied(v); }); }); } QLineEdit *editor() const noexcept { return m_edit; } QPushButton *applyButton() const noexcept { return m_applyBtn; } signals: void setpointApplied(int kpa); void alarmCrossed(int kpa); private: QLineEdit *m_edit = nullptr; QPushButton *m_applyBtn = nullptr; bool m_inAlarm = false; }; class TestHmiPanel final : public QObject { Q_OBJECT private slots: void alarmHysteresis_data() { QTest::addColumn<QString>("firstText"); QTest::addColumn<QString>("secondText"); QTest::addColumn<int>("expectedAlarms"); QTest::newRow("nominal_below_420") << QStringLiteral("250") << QStringLiteral("419") << 0; QTest::newRow("rising_edge_420") << QStringLiteral("419") << QStringLiteral("420") << 1; QTest::newRow("high_no_duplicate") << QStringLiteral("430") << QStringLiteral("460") << 1; } void alarmHysteresis() { QFETCH(QString, firstText); QFETCH(QString, secondText); QFETCH(int, expectedAlarms); DebouncedSetpointBox box; box.resize(240, 80); QSignalSpy appliedSpy(&box, &DebouncedSetpointBox::setpointApplied); QSignalSpy alarmSpy(&box, &DebouncedSetpointBox::alarmCrossed); QTest::keyClicks(box.editor(), firstText); QTest::mouseClick(box.applyButton(), Qt::LeftButton); QVERIFY(appliedSpy.wait(200)); // Pumps QEventLoop so 15 ms singleShot fires! box.editor()->clear(); QTest::keyClicks(box.editor(), secondText); QTest::mouseClick(box.applyButton(), Qt::LeftButton); QVERIFY(appliedSpy.wait(200)); QCOMPARE(appliedSpy.count(), 2); QCOMPARE(alarmSpy.count(), expectedAlarms); QCOMPARE(box.grab().toImage().size(), QSize(240, 80)); } }; // Run in CI: QT_QPA_PLATFORM=offscreen ./tst_hmi_panel -o -,tap QTEST_MAIN(TestHmiPanel) #include "tst_hmi_panel.moc"- appliedSpy.wait(200) pumps the thread event loop so QTimer::singleShot(15, ...) dispatches deterministically.
- Running with QT_QPA_PLATFORM=offscreen and -o -,tap executes headlessly and emits TAP version 13 lines.
QTest-QSignalSpy(3qt) GL-Q01 Quick Reference QTest-QSignalSpy(3qt) NAME QTest, QSignalSpy, QTRY_COMPARE - headless QtWidgets input simulation & TAP 13 CI SYNOPSIS QT_QPA_PLATFORM=offscreen ./tst_hmi_panel -o -,tap QSignalSpy spy(&widget, &Widget::alarmCrossed); QTest::keyClicks(lineEdit, "425"); QTest::mouseClick(applyBtn, Qt::LeftButton); QVERIFY(spy.wait(200)); // pumps QEventLoop; NEVER use sleep_for()! CI VERIFICATION RULES 1. Pair private slot foo() with foo_data() + QFETCH for table-driven edge cases. 2. Assert spy.count() and spy.at(0).at(0) payloads on rising-edge hysteresis transitions. 3. Include "tst_file.moc" when defining Q_OBJECT test classes inside a .cpp translation unit. Kernel Systems Academy Lesson 6.3 QTest-QSignalSpy(3qt) GL-Q01 quick reference · full manual page: man 3qt QTest-QSignalSpy Host C++20 Verifier for Event-Pumping SignalSpy::wait, Input Clicks, and Data Rows
In verify.cpp, we construct a C++20 MiniEventLoop, a DebouncedPanel scheduling asynchronous 15 ms commits, a variadic SignalSpy<int> implementing event-pumping wait(loop, timeout_ms), and a 4-row data-driven hysteresis runner.
Notice how verify.cpp also proves the thread-sleep anti-pattern directly: advancing wall wait WITHOUT pumping MiniEventLoop leaves applied_spy.count() == 0, whereas applied_spy.wait(loop, 200) pumps queued timers and wakes as soon as the 15 ms commit fires!
learner@ksa:~/gl-q01/m06-l03$ bat -H 42 -H 106 verify.cpp File: verify.cpp #include <algorithm> #include <cassert> #include <cstdio> #include <functional> #include <string> #include <tuple> #include <vector> class MiniEventLoop { public: void single_shot(int delay_ms, std::function<void()> cb) { m_timers.push_back({m_now_ms + delay_ms, std::move(cb)}); } void step_ms(int dt_ms) { m_now_ms += dt_ms; for (std::size_t i = 0; i < m_timers.size();) { if (m_timers[i].due_ms <= m_now_ms) { auto fn = std::move(m_timers[i].cb); m_timers.erase(m_timers.begin() + static_cast<std::ptrdiff_t>(i)); fn(); } else { ++i; } } } private: struct Timer { int due_ms; std::function<void()> cb; }; int m_now_ms = 0; std::vector<Timer> m_timers; }; template <typename... Args> class SignalSpy { public: void record(Args... a) { m_hits.emplace_back(a...); } std::size_t count() const noexcept { return m_hits.size(); } std::tuple<Args...> at(std::size_t i) const { return m_hits.at(i); } bool wait(MiniEventLoop &loop, int timeout_ms) { const std::size_t before = m_hits.size(); for (int elapsed = 0; elapsed < timeout_ms; elapsed += 5) { loop.step_ms(5); // Pumps event loop! if (m_hits.size() > before) return true; } return false; } private: std::vector<std::tuple<Args...>> m_hits; }; class DebouncedWidget { public: explicit DebouncedWidget(MiniEventLoop &loop, int alarm_kpa) : m_loop(loop), m_alarm(alarm_kpa) {} void key_clicks(std::string s) { m_text += s; } void clear_text() { m_text.clear(); } void mouse_click_apply() { if (!m_enabled) return; const int v = std::stoi(m_text); if (v < 100 || v > 500) return; m_loop.single_shot(15, [this, v] { if (v >= m_alarm && !m_in_alarm) { m_in_alarm = true; if (on_alarm) on_alarm(v); } else if (v < m_alarm) { m_in_alarm = false; } if (on_applied) on_applied(v); }); } std::function<void(int)> on_applied; std::function<void(int)> on_alarm; private: MiniEventLoop &m_loop; int m_alarm; bool m_enabled = true; bool m_in_alarm = false; std::string m_text; }; struct DataRow { const char *tag; std::vector<const char *> inputs; std::size_t exp_alarms; int first_alarm_val; }; int main() { const std::vector<DataRow> rows = { {"nominal_below", {"250", "419"}, 0U, 0}, {"exact_crossing", {"419", "420"}, 1U, 420}, {"sustained_high_no_dup", {"430", "460", "490"}, 1U, 430}, {"drop_and_recross", {"430", "380", "445"}, 2U, 430}, }; int ok_rows = 0; for (const auto &r : rows) { MiniEventLoop loop; DebouncedWidget w(loop, 420); SignalSpy<int> applied_spy, alarm_spy; w.on_applied = [&](int v) { applied_spy.record(v); }; w.on_alarm = [&](int v) { alarm_spy.record(v); }; for (const char *txt : r.inputs) { w.clear_text(); w.key_clicks(txt); w.mouse_click_apply(); // Without pumping loop, queued 15ms timer has NOT fired yet: assert(applied_spy.wait(loop, 200)); } assert(alarm_spy.count() == r.exp_alarms); if (r.exp_alarms > 0U) assert(std::get<0>(alarm_spy.at(0)) == r.first_alarm_val); ++ok_rows; } assert(ok_rows == 4); std::printf("qtest_audit: tap_rows=%d/4 spy_wait_pumped=1 platform=offscreen\n", ok_rows); return 0; }- SignalSpy::wait() steps the event loop incrementally and returns immediately as soon as a new emission arrives.
- Each _data() row runs in an isolated widget/loop instance, proving rising-edge hysteresis and re-crossing.
Verifying Data-Driven Hysteresis Rows and Event-Pumping SignalSpy Output
Confirm ./verify prints qtest_audit: tap_rows=4/4 spy_wait_pumped=1 platform=offscreen. Every single boundary vector—nominal below-alarm, exact 420 crossing, sustained high without duplicate spam, and drop-below-then-recross—matched its exact SignalSpy count and argument payload.
You are ready for the Module 6 Capstone Studio lab_m06_qpainter_gauge_qtest, uniting crash-atomic calibration persistence, premultiplied ARGB32 gauge rasterization + batched waveform replacement, and rising-edge SignalSpy verification into one end-to-end subsystem.
learner@ksa:~/gl-q01/m06-l03g++ -std=c++20 -Wall -Wextra -Werror -pedantic verify.cpp -o verifylearner@ksa:~/gl-q01/m06-l03./verifyqtest_audit: tap_rows=4/4 spy_wait_pumped=1 platform=offscreenlearner@ksa:~/gl-q01/m06-l03learner@ksa:~/gl-q01/m06-l03strace -e trace=write,exit_group ./verifywrite(1, "qtest_audit: tap_rows=4/4 spy_wa"..., 63) = 63exit_group(0) = ?+++ exited with 0 +++CI Test Flakiness: Sleeping the GUI Thread and Missing Local .moc Includes
Across the six modules of GL-Q01, you have built a complete engineering foundation in ISO C++20 and Qt 6.8 QtWidgets: and QObject trees, CMake AUTOMOC and moc void ** metacalls, PMF signal lifetimes and eventFilter chains, two-step button interlocks and integer layout solvers, 50,000-row QAbstractTableModel + proxy views, QSaveFile atomicity, premultiplied ARGB32 gauges + batched QtCharts, and headless QTest TAP 13 automation.
Next in the series, GL-Q02 (linux-qt-io-concurrency) scales your HMIs across QThread worker pipelines, lock-free SPSC rings, QTcpSocket/QSerialPort/SocketCAN buses, SQLite WAL storage, and cross-compiled ARMv7-A CMake sysroots.
Calling std::this_thread::sleep_for or QThread::msleep Inside a QTest Slot:
- Symptom: QTimer::singleShot and queued signals never fire during the sleep, causing QCOMPARE(spy.count(), 1) to fail 100% of the time.
- Root Cause: QTest slots execute on the main thread; sleeping that thread halts QEventDispatcher so timers and posted events cannot run.
- Fix: Replace thread sleeps with QVERIFY(spy.wait(timeoutMs)), QTRY_COMPARE(expr, expected), or QTest::qWait().
Defining a Q_OBJECT Test Class Inside tst_panel.cpp Without #include 'tst_panel.':
- Symptom: Linker fails with 'undefined reference to for TestHmiPanel' or QTest executes 0 private test slots.
- Root Cause: generates tst_panel.moc for Q_OBJECT classes declared inside a .cpp file rather than compiling a separate mocs_compilation entry.
- Fix: Place #include "tst_panel.moc" at the very bottom of tst_panel.cpp right after QTEST_MAIN(TestHmiPanel).
Guided Practice
Add a fifth row "invalid_out_of_range" (inputs = {"999", "50"}) to rows in verify.cpp where mouse_click_apply() rejects out-of-range strings without scheduling the 15 ms timer, and assert that !applied_spy.wait(loop, 50) times out cleanly with applied_spy.count() == 0.
Independent Practice
Complete the GL-Q01 Capstone Project (lab_m06_qpainter_gauge_qtest) by repairing the three starter defects across atomic calibration fsync + rename rollback, premultiplied ARGB32 SourceOver blending, and rising-edge GaugeController alarm hysteresis.
Verification Checks
→ open standalone lab workbench
1. Motivation
Integrate and verify an end-to-end C++20 HMI Gauge Capstone uniting QSaveFile-style fsync + rename calibration persistence, clipped premultiplied ARGB32 SourceOver rasterization, ring-buffered waveform snapshots, and QSignalSpy-style rising-edge hysteresis tests.
2. Learning objectives
- Guarantee crash-atomic configuration saves via
openat(.tmp) -> write -> fsync -> renameand clean.tmpunlinking on abort. - Enforce dirty-region
ClipRectboundaries and premultiplied ARGB32 Porter-DuffSourceOvercompositing on custom gauge needles. - Verify tare-compensated rising-edge alarm hysteresis and chronological ring-buffer waveform batches for
QLineSeries::replace().
3. Environment requirements
All automated verification steps run in unprivileged user space on a POSIX Linux host using g++ -std=c++20 -Wall -Wextra -Werror -pedantic and clock_gettime(CLOCK_MONOTONIC). Recorded transcripts in captures.json were generated on x86_64 running kernel 7.0.0-42-generic and prove protocol, state-machine, and memory invariants only. Physical bus timing, DMA cache coherency, and board peripheral behavior require target validation on Linux kernel 6.12 LTS (ARMv7-A Cortex-A7).
4. Required software and hardware
- Host workstation:
g++(-std=c++20 -Wall -Wextra -Werror -pedantic), GNUmake,ar(binutils), and POSIX/bin/sh. - Target environment (optional hardware step, Section 13):
ARMv7-ACortex-A7industrial HMI panel (800x480RGB LCD,8 GBeMMC) runningLinux kernel6.12 LTS, Qt 6.8QtWidgets+QtCharts, and headless CI gates underQT_QPA_PLATFORM=offscreen -o -,tap.
5. Complete executable commands
learner@ksa:~/gl-q01/m06-l03$ bat script.sh File: script.sh make -B -C files ./files/lab_cli ./files/lab_cli --bench sh check.sh6. Annotated source code
files/core.cpp enforces the production invariants that starter/core.cpp breaks:
learner@ksa:~/gl-q01/m06-l03$ bat example.cpp File: example.cpp void GaugeController::set_raw_kpa(int raw_sensor_kpa) { const int comp = std::clamp(raw_sensor_kpa + m_cal.zero_offset_kpa, 0, 500); m_ring[m_head] = comp; m_head = (m_head + 1U) % m_ring.size(); if (m_count < m_ring.size()) ++m_count; if (comp == m_compensated_kpa) return; const bool was_alarm = (m_compensated_kpa >= m_cal.alarm_kpa); m_compensated_kpa = comp; const bool now_alarm = (m_compensated_kpa >= m_cal.alarm_kpa); if (now_alarm && !was_alarm && on_alarm) { on_alarm(m_compensated_kpa); // Rising-edge hysteresis only! } }starter/core.cpp contains three realistic capstone bugs: save_calibration_atomic leaks .tmp on abort, ArgbCanvas::put_pixel ignores m_clip.contains(x, y), and GaugeController::set_raw_kpa fires on_alarm on every sample while high instead of only on rising-edge crossings.
7. Expected output
Passing files/ run (sh check.sh, exit code 0):
learner@ksa:~/gl-q01/m06-l03$ bat listing.txt File: listing.txt TAP version 13 1..5 ok 1 - builds libcore.a and lab_cli cleanly with -std=c++20 -Wall -Wextra -Werror -pedantic ok 2 - archives core.o into libcore.a and links independent TAP verifier ok 3 - commits calibration atomically via fsync+rename and unlinks .tmp cleanly on abort ok 4 - composites premultiplied ARGB32 SourceOver strokes strictly inside dirty ClipRect bounds ok 5 - applies zero-offset tare, latches rising-edge alarm spy counts, and batches ring waveforms # pass 5/5CLI verification output (./files/lab_cli):
learner@ksa:~/gl-q01/m06-l03$ bat listing.txt File: listing.txt capstone_gauge: comp_kpa=430 alarms=1 center_argb=0xFFDC2626 wave_pts=3Defective starter/ run (exit code 1): emits FAIL: diagnostics on the broken contract assertions.
8. Explanation of observed behavior
Check 3 commits {-15, 380} via fsync + rename, triggers a simulated abort on {+99, 450}, confirms .tmp was unlinked, and reloads intact {-15, 380}. Check 4 draws a 50% translucent stroke across {10, 10, 40, 40}, proving premultiplied blending inside the clip and untouched background at (60, 20). Check 5 drives GaugeController across five tare-compensated readings, asserting rising-edge spy hits {405, 410}, 4-point chronological ring ordering, and alarm-crimson (220) needle rendering.
9. Experiment variations
- Near transfer: Add a falling-edge hysteresis deadband (
clear_alarm_kpa = alarm_kpa - 15) som_in_alarmstays latched until pressure drops at least15 kPabelowalarm_kpa, preventing alarm chatter at399 <-> 400 kPa. - Far transfer: Port
GaugeControllerandTestHmiPanelinto a CMakeQt6::Widgets+Qt6::Charts+Qt6::Testtarget and executeQT_QPA_PLATFORM=offscreen ctest --output-on-failurein your CI container.
10. Performance measurements
Recorded host benchmark (./files/lab_cli --bench, CLOCK_MONOTONIC, warmup=5, N=40 batches):
learner@ksa:~/gl-q01/m06-l03$ bat listing.txt File: listing.txt bench_gauge_render_ns: p50=1123 p95=1464 p99=1964 (sink=0)The CLOCK_MONOTONIC benchmark measures combined host C++20 set_raw_kpa + 160x160 software Bresenham needle rasterization + 256-sample waveform batch snapshot latency in DRAM. Target 60 Hz frame budgets (16.67 ms) on Cortex-A7 hardware must also include QChart polyline rasterization and DRM scanout.
11. Troubleshooting
| Symptom | Root cause | Fix |
|---|---|---|
| Check 3 fails with aborted save leaked .tmp file | simulate_abort closed fd without calling ::unlink(tmp.c_str()) | Call ::unlink(tmp.c_str()) on every error and abort path before returning false |
| Check 4 fails with dirty clip violated at (60,20) | ArgbCanvas::put_pixel bypassed !m_clip.contains(x, y) | Restore !m_clip.contains(x, y) in the early-return guard of put_pixel() |
| Check 5 fails with rising-edge alarm spy count=3 (expected 2) | on_alarm emitted whenever now_alarm was true without checking !was_alarm | Emit on_alarm only when (now_alarm && !was_alarm) |
12. Guided questions
- Why does snapshot_waveform_batch() copy ring elements starting at m_head once m_count == m_ring.size()?
- *Hint 1:* Trace where the oldest sample sits in a circular buffer after wrap-around.
- *Hint 2:* Once full, m_head points to the next slot to be overwritten—which is the oldest surviving sample—so reading (m_head + i) % N yields chronological left-to-right chart order.
- Why is rising-edge + deadband hysteresis essential when wiring a gauge threshold signal to a FaultLogModel?
- *Hint 1:* Imagine ADC thermal noise oscillating 399 -> 400 -> 399 -> 400 kPa at 500 Hz.
- *Hint 2:* Without rising-edge gating and hysteresis, 1-LSB ADC noise floods the fault log and operator buzzer with 250 duplicate alarms per second.
13. Independent challenges
Extend ArgbCanvas with Wu anti-aliased line rasterization (pack_premul_argb32 fractional coverage alphas) and verify every blended pixel across a 360-degree sweep maintains the premultiplied invariant R', G', B' <= A.
14. Solutions and explanations
Transactional fsync + rename + unlink persistence, dirty-clipped premultiplied ARGB32 compositing, batched ring-buffer waveform snapshots, and rising-edge SignalSpy tests complete a production-grade Qt 6 HMI.
Run locally in your terminal and check off each verification milestone.
Not started
Key takeaways
- Setting
QT_QPA_PLATFORM=offscreenruns fullQtWidgetslayouts, input dispatch, andQPaintergrab()rasterization in headless Linux CI containers without X11 or Wayland. QTest::mouseClickandQTest::keyClickssynthesize realistic user events throughQWidgetevent filters and button interlocks, paired with_data()/QFETCHboundary matrices.QSignalSpyrecords emitted signal argument lists (spy.count(),spy.at(i)), whilespy.wait()andQTRY_COMPAREpump the thread event loop instead of deadlocking timers withsleep.- Passing
-o -,tapto a compiledQTestbinary formats stdout as standardTAP version 13(ok/not ok+ YAML diagnostics) for CI pipelines.