Files
MeshCore/test/test_nrf52_tft_font_trim.py
T
mikecarper 8a69e73226 Reduce nRF52 infrastructure flash usage without trimming sensors
Keep Companion and Terminal Chat profiles unchanged; retain full-sensor and reduced-sensor OTA builds. Add compact crypto and OTA names, qualified display asset compression, font license packaging, and scope regression tests.
2026-10-02 15:52:23 -07:00

35 lines
1.3 KiB
Python

"""Unused TFT fonts are omitted without altering the selected hardware setup."""
import subprocess
import tempfile
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
FIXTURES = ROOT / "test" / "fixtures" / "nrf52_tft_trim"
class Nrf52TftFontTrimTest(unittest.TestCase):
def test_selected_setup_and_current_font_survive(self):
cases = (
([], False),
(["-DNRF52_PLATFORM=1"], False),
(["-DMESH_NRF52_FLASH_TRIM=1"], False),
(["-DNRF52_PLATFORM=1", "-DMESH_NRF52_FLASH_TRIM=0"], False),
(["-DNRF52_PLATFORM=1", "-DMESH_NRF52_FLASH_TRIM=1"], True),
)
with tempfile.TemporaryDirectory() as temp_dir:
for flags, trimmed in cases:
with self.subTest(flags=flags):
executable = Path(temp_dir) / "font_scope"
subprocess.run([
"c++", "-std=c++11", "-Wall", "-Wextra", "-Werror",
*flags, f"-DEXPECT_TRIM={int(trimmed)}",
f"-I{FIXTURES}", f"-I{ROOT / 'src'}",
str(FIXTURES / "test.cpp"), "-o", str(executable),
], check=True)
subprocess.run([str(executable)], check=True)
if __name__ == "__main__":
unittest.main()