mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-07-21 02:05:52 +00:00
* feat: migrate firmware to xiaozhi-fonts 2.0.0 * fix: restart scrolling subtitles on text change * docs: add AGENTS.md for project overview, architecture, rules, and commands - Introduced AGENTS.md to document the XiaoZhi voice-assistant firmware architecture, required rules for development, board configuration process, and validation steps. - Included detailed sections on project structure, commands for building and testing, and authoritative documentation references. * feat: finalize glyph push protocol * fix: remove stale emoji font include * build: use xiaozhi-fonts 2.0.0 * fix: decouple custom fonts from glyph push * refactor: improve wake word invocation handling - Introduced BeginWakeWordInvoke method to streamline the wake word processing flow. - Updated HandleWakeWordDetectedEvent to utilize the new method, ensuring proper state transitions and scheduling. - Enhanced error handling to prevent the device from getting stuck in the connecting state. - Refactored audio channel management to improve responsiveness during wake word detection. --------- Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import importlib.util
|
|
import json
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SPEC = importlib.util.spec_from_file_location(
|
|
"build_default_assets", ROOT / "scripts" / "build_default_assets.py"
|
|
)
|
|
BUILD = importlib.util.module_from_spec(SPEC)
|
|
SPEC.loader.exec_module(BUILD)
|
|
|
|
|
|
class BuildDefaultAssetsTest(unittest.TestCase):
|
|
def test_text_font_metadata_uses_bundle_charset_size_and_bpp(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
assets = Path(directory)
|
|
BUILD.generate_index_json(
|
|
str(assets),
|
|
None,
|
|
"font_noto_sans_common_20_4.bin",
|
|
None,
|
|
font_bundle_id="noto-v1",
|
|
)
|
|
index = json.loads((assets / "index.json").read_text(encoding="utf-8"))
|
|
self.assertEqual(
|
|
index["text_font_meta"],
|
|
{"charset": "common", "size": 20, "bpp": 4, "bundle": "noto-v1"},
|
|
)
|
|
|
|
def test_text_font_requires_bundle(self):
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
with self.assertRaises(ValueError):
|
|
BUILD.generate_index_json(
|
|
directory, None, "font_noto_sans_common_20_4.bin", None
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|