#!/usr/bin/env python3 """Yellow outlines must describe real touch actions, not a second guessed UI.""" from pathlib import Path import subprocess import tempfile import unittest from test_reader_touch_coordinates import PREAMBLE from test_replay_reset_integration import extract_braced ROOT = Path(__file__).resolve().parents[1] TEST = r''' #include using namespace mesh::ui; struct DebugDisplay : LGFXDisplay { ColorVal color=0; std::vector pixels=std::vector(160*160,0); void setColor(ColorVal c) override { color=c; } void fillRect(int x,int y,int w,int h) override { LGFXDisplay::fillRect(x,y,w,h); for(int py=y;py=r.x && x=r.y && y=r.x && x=r.y && y100 && empty_edges>dots); // dotted, not solid or filled for(int i=0;irender(*_display);") outline = loop.index("mesh::ui::drawTouchDebugAreas", render) present = loop.index("_display->endFrame();", outline) self.assertLess(render, outline) self.assertLess(outline, present) self.assertIn("if (_touch_debug_enabled && !isPairingScreenActive())", loop[render:outline]) feedback = extract_braced(loop, "if (_touch_debug_enabled)") self.assertIn("mesh::ui::touchDebugAreaAt", feedback) profile = (ROOT / "variants/sensecap_indicator-espnow/platformio.ini").read_text() self.assertNotIn("UI_TOUCH_DEBUG_OUTLINES", profile) self.assertIn("TOUCH_MIRROR_TAP_X_ENABLED ? _display->width() - 1 - touch_x : touch_x", loop) self.assertIn("if (debug_area != _touch_debug_area || curr != _touch_debug_screen) _next_refresh = 0;", loop) self.assertIn("_touch_debug_screen == curr ? _touch_debug_x : -1", loop) if __name__ == "__main__": unittest.main()