1a6308aba7
A test and code-analysis round of 0.2.72 to 0.2.76 (suites at every tag, sanitizers, ESP32 and GitHub builds, host harnesses on both boards, the editor in a browser, best practice checked against ESPHome, LVGL, Home Assistant and Vue) found these, fixed here with Max's choices for the product questions: - Firmware 0.2.65: the second hand of a single analog clock moves again; on a page that is one full on/off tile the waking push also switches it; on the Guition a flick is never a tap and a finger that slides off a tile doesn't tap it; Previous/Next react to a firm press; the same Go to page tile may sit on several pages; a layout the screen has no memory for is refused instead of crashing; 64-bit redraw mask for 48 tiles; Montserrat 14 no longer built. - App: Save refuses a layout too long for one message or too big for eight pages; an offline screen keeps its firmware version from the device registry; HA refusals reach the editor; 128 KB requests; changelog out of the live stream; cached hashed assets; tini as init and a clean stop; changelog parsing without asterisks or crashes. - Editor: clicking the open screen keeps unsaved edits, edits during a save stay unsaved, a Page row and phone dragging to other pages, repeated page tiles, limits from the server, HA's error messages, a type-checked build. - tools/check.sh + GitHub Actions + a CYD flash budget; docs match 48 tiles and the new editor. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
35 lines
1.9 KiB
Python
35 lines
1.9 KiB
Python
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
import sys
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
import test_portal
|
|
from core import validate_settings
|
|
|
|
class RotationTests(unittest.IsolatedAsyncioTestCase):
|
|
def test_only_quarter_turns(self):
|
|
for angle in (0,90,180,270):
|
|
self.assertEqual(validate_settings({'rotation':angle})['rotation'],angle)
|
|
for angle in (-90,45,360,True,90.0,'90'):
|
|
with self.assertRaises(ValueError):validate_settings({'rotation':angle})
|
|
|
|
async def test_legacy_wire_and_saved_rotation_survive_old_browser(self):
|
|
with tempfile.TemporaryDirectory() as tmp:
|
|
m=test_portal.ManagerTests().setup_manager(Path(tmp)/'screens.json')
|
|
layout={'title':'Home','tiles':[{'entity':'light.a'}],'settings':{'rotation':90}}
|
|
with self.assertRaises(ValueError):m.save('text.screen',layout)
|
|
m.ha.registry[0]['device_id']='guition'
|
|
m.ha.registry.append({'entity_id':'sensor.board','device_id':'guition','platform':'esphome','original_name':'Guition screen type'})
|
|
# Capability stays discoverable with the panel offline or renamed.
|
|
m.ha.states['sensor.board']={'state':'unavailable'}
|
|
m.save('text.screen',layout)
|
|
await m.sync_one('text.screen',m.layouts['text.screen'])
|
|
wire=m.ha.messages[0][1]
|
|
self.assertEqual(wire['rotation'],90)
|
|
self.assertEqual(len(wire['settings']),11)
|
|
self.assertNotIn('rotation',wire['settings'])
|
|
m.save('text.screen',{'title':'Different','tiles':layout['tiles'],'settings':{'brightness':80}})
|
|
self.assertEqual(m.layouts['text.screen']['settings']['rotation'],90)
|
|
fresh=test_portal.ManagerTests().setup_manager(m.path)
|
|
self.assertEqual(fresh.layouts['text.screen']['settings']['rotation'],90)
|