mirror of
https://github.com/esphome/esphome.git
synced 2026-11-16 18:16:04 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec863f3a4a |
No files matched your search
@@ -1,82 +0,0 @@
|
||||
esphome:
|
||||
name: lvgl-color-picker-render
|
||||
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# A snapshot never writes over an existing file, so the test supplies a new name each time.
|
||||
- action: take_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: picker_display
|
||||
filename: !lambda return name;
|
||||
- action: set_orange
|
||||
then:
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_sliders
|
||||
color: 0xFF8800
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_wheel
|
||||
color: 0xFF8800
|
||||
# White has no saturation, which a hue-only picker could never change again
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_hue
|
||||
color: 0xFFFFFF
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
- platform: snapshot
|
||||
id: picker_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 680
|
||||
height: 480
|
||||
|
||||
lvgl:
|
||||
displays: picker_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x404040
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 4
|
||||
layout:
|
||||
type: flex
|
||||
flex_flow: row_wrap
|
||||
pad_row: 4
|
||||
pad_column: 4
|
||||
widgets:
|
||||
- color_picker:
|
||||
id: picker_sliders
|
||||
width: 196
|
||||
color: 0x3366CC
|
||||
- color_picker:
|
||||
id: picker_wheel
|
||||
width: 196
|
||||
wheel: true
|
||||
color: 0x3366CC
|
||||
# Sized from the text font
|
||||
- color_picker:
|
||||
id: picker_content
|
||||
color: 0x3366CC
|
||||
# No red, green and blue bars beside the swatch
|
||||
- color_picker:
|
||||
id: picker_hsv
|
||||
width: 196
|
||||
sliders: hsv
|
||||
color: 0x3366CC
|
||||
# Only the hue bar
|
||||
- color_picker:
|
||||
id: picker_hue
|
||||
width: 196
|
||||
sliders: hue
|
||||
color: 0x3366CC
|
||||
@@ -1,53 +0,0 @@
|
||||
esphome:
|
||||
name: lvgl-headless-render-test
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# The name comes from the test so it can capture more than once: a snapshot never writes over
|
||||
# a file that is already there, so a fixed name could only ever be captured once.
|
||||
- action: take_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: lvgl_display
|
||||
filename: !lambda return name;
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
# A display with no screen, so what LVGL draws depends on LVGL alone - nothing about the machine
|
||||
# running the test, and no graphics library outside this repository, can move the result.
|
||||
- platform: snapshot
|
||||
id: lvgl_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
# The widgets are spelled out here rather than left to the built in "Hello World" screen, which
|
||||
# LVGL builds when nothing is configured: that screen contains a spinner, and an animation cannot
|
||||
# produce the same picture twice.
|
||||
#
|
||||
# Everything that affects the rendered pixels is set explicitly, so the expected hash in the test
|
||||
# depends only on the drawing code and the built in font. In particular the background comes from a
|
||||
# full screen object rather than from the theme, so adjusting a theme default does not break this.
|
||||
lvgl:
|
||||
displays: lvgl_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x000080
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 0
|
||||
widgets:
|
||||
- label:
|
||||
align: center
|
||||
text: "Hello World!"
|
||||
text_color: 0xFFFFFF
|
||||
@@ -0,0 +1,126 @@
|
||||
# Shared by test_lvgl_headless_render.py and test_lvgl_color_picker_render.py, so LVGL is compiled
|
||||
# once for both. Each test draws on its own display, driven by its own LVGL instance, at the size
|
||||
# its expected hashes were taken at.
|
||||
esphome:
|
||||
name: lvgl-render-test
|
||||
host:
|
||||
|
||||
api:
|
||||
actions:
|
||||
# The name comes from the test so it can capture more than once: a snapshot never writes over
|
||||
# a file that is already there, so a fixed name could only ever be captured once.
|
||||
- action: take_hello_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: hello_display
|
||||
filename: !lambda return name;
|
||||
- action: take_picker_screenshot
|
||||
variables:
|
||||
name: string
|
||||
then:
|
||||
- snapshot.take:
|
||||
id: picker_display
|
||||
filename: !lambda return name;
|
||||
- action: set_orange
|
||||
then:
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_sliders
|
||||
color: 0xFF8800
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_wheel
|
||||
color: 0xFF8800
|
||||
# White has no saturation, which a hue-only picker could never change again
|
||||
- lvgl.color_picker.update:
|
||||
id: picker_hue
|
||||
color: 0xFFFFFF
|
||||
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
display:
|
||||
# Displays with no screen, so what LVGL draws depends on LVGL alone - nothing about the machine
|
||||
# running the test, and no graphics library outside this repository, can move the result.
|
||||
- platform: snapshot
|
||||
id: hello_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 300
|
||||
height: 300
|
||||
- platform: snapshot
|
||||
id: picker_display
|
||||
auto_clear_enabled: false
|
||||
dimensions:
|
||||
width: 680
|
||||
height: 480
|
||||
|
||||
lvgl:
|
||||
# The widgets are spelled out here rather than left to the built in "Hello World" screen, which
|
||||
# LVGL builds when nothing is configured: that screen contains a spinner, and an animation cannot
|
||||
# produce the same picture twice.
|
||||
#
|
||||
# Everything that affects the rendered pixels is set explicitly, so the expected hash in the test
|
||||
# depends only on the drawing code and the built in font. In particular the background comes from
|
||||
# a full screen object rather than from the theme, so adjusting a theme default does not break it.
|
||||
- id: hello_lvgl
|
||||
displays: hello_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x000080
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 0
|
||||
widgets:
|
||||
- label:
|
||||
align: center
|
||||
text: "Hello World!"
|
||||
text_color: 0xFFFFFF
|
||||
|
||||
- id: picker_lvgl
|
||||
displays: picker_display
|
||||
default_font: montserrat_14
|
||||
widgets:
|
||||
- obj:
|
||||
width: 100%
|
||||
height: 100%
|
||||
bg_color: 0x404040
|
||||
bg_opa: cover
|
||||
border_width: 0
|
||||
radius: 0
|
||||
pad_all: 4
|
||||
layout:
|
||||
type: flex
|
||||
flex_flow: row_wrap
|
||||
pad_row: 4
|
||||
pad_column: 4
|
||||
widgets:
|
||||
- color_picker:
|
||||
id: picker_sliders
|
||||
width: 196
|
||||
color: 0x3366CC
|
||||
- color_picker:
|
||||
id: picker_wheel
|
||||
width: 196
|
||||
wheel: true
|
||||
color: 0x3366CC
|
||||
# Sized from the text font
|
||||
- color_picker:
|
||||
id: picker_content
|
||||
color: 0x3366CC
|
||||
# No red, green and blue bars beside the swatch
|
||||
- color_picker:
|
||||
id: picker_hsv
|
||||
width: 196
|
||||
sliders: hsv
|
||||
color: 0x3366CC
|
||||
# Only the hue bar
|
||||
- color_picker:
|
||||
id: picker_hue
|
||||
width: 196
|
||||
sliders: hue
|
||||
color: 0x3366CC
|
||||
@@ -64,6 +64,7 @@ def _check(image: Bmp, capture: Path, expected: str, name: str) -> None:
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.shared_yaml("lvgl_render")
|
||||
async def test_lvgl_color_picker_render(
|
||||
yaml_config: str,
|
||||
run_compiled: RunCompiledFunction,
|
||||
@@ -77,7 +78,7 @@ async def test_lvgl_color_picker_render(
|
||||
|
||||
async with run_compiled(yaml_config), api_client_connected() as client:
|
||||
_, services = await client.list_entities_services()
|
||||
take_screenshot = require_service(services, "take_screenshot")
|
||||
take_screenshot = require_service(services, "take_picker_screenshot")
|
||||
set_orange = require_service(services, "set_orange")
|
||||
|
||||
async def take(name: str) -> None:
|
||||
|
||||
@@ -35,6 +35,7 @@ EXPECTED_LVGL_VERSION = "9.6.0"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.shared_yaml("lvgl_render")
|
||||
async def test_lvgl_headless_render(
|
||||
yaml_config: str,
|
||||
run_compiled: RunCompiledFunction,
|
||||
@@ -48,7 +49,7 @@ async def test_lvgl_headless_render(
|
||||
|
||||
async with run_compiled(yaml_config), api_client_connected() as client:
|
||||
_, services = await client.list_entities_services()
|
||||
service = require_service(services, "take_screenshot")
|
||||
service = require_service(services, "take_hello_screenshot")
|
||||
|
||||
async def take(name: str) -> None:
|
||||
await client.execute_service(service, {"name": name})
|
||||
|
||||
Reference in new issue
Block a user