Build and Test the Simulator

The simulator displays the U8g2 framebuffer through Qt6. It is the fastest way to visually check App, Widget, and animation changes.

Prerequisites

1
git submodule update --init --recursive

You need CMake, a C++20 compiler, and Qt6 Core, Gui, and Widgets. If CMake cannot find Qt, provide its prefix explicitly:

1
2
3
4
cmake -S . -B build \
-DBUILD_SIMULATOR=ON \
-DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt
cmake --build build -j

Run the simulator with:

1
./build/simulator/u8g2_emulator

Regression tests

1
ctest --test-dir build --output-on-failure

Current tests cover the App arena and ViewManager lifecycle, numeric ranges/formatters/edit sessions, Chart buffers, component-owned Animations, Popup FIFO and all three request payloads, PopupProgress, PopupValueDigits, NumScroll, ListView menu/toggle identity, IconView layouts at 128x64 and non-standard display sizes, FocusManager transitions, Canvas camera behavior, rendering schedules, and the Widget tree.

AddressSanitizer

1
2
3
4
5
6
cmake -S . -B build-asan \
-DBUILD_SIMULATOR=ON \
-DENABLE_ASAN=ON \
-DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt
cmake --build build-asan -j
ctest --test-dir build-asan --output-on-failure

ASan is particularly useful for finding Widget, callback, or Animation references to destroyed App members.

Memory report

1
./build/tests/memory_metrics

sizeof results apply only to the current compiler, ABI, and configuration. Measure again after porting to an MCU and inspect the linker map for RAM and flash use.

Minimum pre-commit checks

1
2
3
4
5
git diff --check
rg -n "std::|#include <(vector|string|memory|functional|map|queue)>" \
include src examples tests
rg -n -i '\b(float|double|snprintf|sprintf|sin|cos)\b' include src
./build/tests/memory_metrics

The source scans should produce no matches; rg exits with status 1 when that is the case. Keep the simulator’s Qt/STL boundary separate from PixelUI core findings. memory_metrics reports host ABI sizes only, so compare results using the same compiler and configuration.

avatar
Link0327
汪🐱me0w, but furry wolf. 尝试变得毛茸茸
Link's Github