Files
esphome/tests/component_tests/lvgl/test_keyboard_update_textarea.py

34 lines
918 B
Python

"""Regression test: lvgl.keyboard.update must be able to change which
textarea a keyboard is attached to.
"""
from __future__ import annotations
from pathlib import Path
import pytest
from esphome.__main__ import generate_cpp_contents
from esphome.config import read_config
from esphome.core import CORE
@pytest.fixture(scope="module")
def main_cpp(request: pytest.FixtureRequest) -> str:
config_path = (
Path(request.fspath).parent / "config" / "keyboard_update_textarea_test.yaml"
)
original_path = CORE.config_path
try:
CORE.config_path = config_path
CORE.config = read_config({})
generate_cpp_contents(CORE.config)
return CORE.cpp_main_section
finally:
CORE.config_path = original_path
CORE.reset()
def test_keyboard_update_changes_textarea(main_cpp: str) -> None:
assert "lv_keyboard_set_textarea(kb->obj, ta2);" in main_cpp