tft: MCP tool build_tft, skill note, sample generator, notes for the next types

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Fable 5.2 committed 2026-11-16 18:25:18 +01:00
1 parent 99a5240af0
commit 0532a59120
7 files changed
+1194 -1

No files matched your search

+18
View File
@@ -77,6 +77,24 @@ class Tools(unittest.TestCase):
self.assertTrue(r["result"]["isError"])
self.assertIn("pages: home", r["result"]["content"][0]["text"])
def test_build_tft(self):
from nxhmi import project, tft, tft_build
for i, n in enumerate(tft_build.FIRMWARE_FILES): # stand-ins for the Editor's files
with open(os.path.join(self.tmp, n), "wb") as f:
f.write(bytes([i]) * 50)
p, out = os.path.join(self.tmp, "min.HMI"), os.path.join(self.tmp, "min.tft")
project.new_project("NX4832T035_011").save(p)
r = self.j("build_tft", path=p, tft_path=out, editor_dir=self.tmp)
with open(out, "rb") as f:
data = f.read()
self.assertEqual(r["bytes"], len(data))
self.assertTrue(tft.verify_header(data) and tft.verify_trailer(data))
# the demo uses component types that cannot be compiled yet: a tool error, not a crash
r = M.handle({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": "build_tft", "arguments": {"path": self.hmi, "tft_path": out,
"editor_dir": self.tmp}}})
self.assertTrue(r["result"]["isError"])
def test_schema(self):
s = self.j("schema", kind="text")
xcen = next(a for a in s["attributes"] if a["name"] == "xcen")