#!/usr/bin/env python3 """Run native UI integration tests against the project's actual LVGL sources.""" from pathlib import Path import subprocess import tempfile import sys firmware = Path(__file__).resolve().parents[2] lvgl = firmware / 'managed_components/lvgl__lvgl' ui = firmware / 'components/eez_gui' with tempfile.TemporaryDirectory(prefix='nanopsx-ui-') as directory: build = Path(directory) (build / 'esp_log.h').write_text('#pragma once\n#define ESP_LOGI(...) ((void)0)\n') sources = list((lvgl / 'src').rglob('*.c')) sources += [ui / name for name in ['ui.c', 'screens.c', 'ui_navigation.c', 'ui_dashboard.c', 'ui_model.c', 'ui_font_ubuntu_16.c', 'ui_font_ubuntu_24.c', 'ui_font_pigiarniq_italic_34.c']] sources += list(ui.glob('ui_image_*.c')) sources += [Path(__file__).with_name('test_navigation.c')] subprocess.run(['cc', '-std=c99', '-O0', '-g', '-DLV_CONF_SKIP', '-DLV_MEM_SIZE=49152', '-I', str(build), '-I', str(lvgl), '-I', str(ui), *map(str, sources), '-lm', '-o', str(build / 'test_navigation')], check=True) subprocess.run([str(build / 'test_navigation'), *sys.argv[1:]], check=True)