Skip to content

Commit

Permalink
Create component_dir substitution for local files to be included …
Browse files Browse the repository at this point in the history
…in… (esphome#6575)
  • Loading branch information
jesserockz authored Apr 21, 2024
1 parent 655dbc4 commit 45ae78d
Show file tree
Hide file tree
Showing 21 changed files with 87 additions and 128 deletions.
2 changes: 1 addition & 1 deletion script/ci-custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def find_all(a_str, sub):
)
cpp_include = ("*.h", "*.c", "*.cpp", "*.tcc")
py_include = ("*.py",)
ignore_types = (".ico", ".png", ".woff", ".woff2", "")
ignore_types = (".ico", ".png", ".woff", ".woff2", "", ".ttf", ".otf")

LINT_FILE_CHECKS = []
LINT_CONTENT_CHECKS = []
Expand Down
Binary file added tests/components/font/Monocraft.ttf
Binary file not shown.
38 changes: 38 additions & 0 deletions tests/components/font/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
glyphs: "0123456789."
extras:
- file: "gfonts://Roboto"
glyphs: ["\u00C4", "\u00C5", "\U000000C7"]
- file: "gfonts://Roboto"
id: roboto_web
size: 20
- file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft
size: 20
- file:
type: web
url: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft2
size: 24
- file: $component_dir/Monocraft.ttf
id: monocraft3
size: 28

i2c:
scl: ${i2c_scl}
sda: ${i2c_sda}

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: ${display_reset_pin}
lambda: |-
it.print(0, 0, id(roboto), "Hello, World!");
it.print(0, 20, id(roboto_web), "Hello, World!");
it.print(0, 40, id(monocraft), "Hello, World!");
it.print(0, 60, id(monocraft2), "Hello, World!");
it.print(0, 80, id(monocraft3), "Hello, World!");
24 changes: 6 additions & 18 deletions tests/components/font/test.esp32-c3-idf.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
i2c:
- id: i2c_font
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
display_reset_pin: GPIO3

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: 3
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
packages:
common: !include common.yaml
24 changes: 6 additions & 18 deletions tests/components/font/test.esp32-c3.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
i2c:
- id: i2c_font
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
display_reset_pin: GPIO3

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: 3
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
packages:
common: !include common.yaml
24 changes: 6 additions & 18 deletions tests/components/font/test.esp32-idf.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
i2c:
- id: i2c_font
scl: 16
sda: 17
substitutions:
i2c_scl: GPIO16
i2c_sda: GPIO17
display_reset_pin: GPIO13

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: 13
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
packages:
common: !include common.yaml
43 changes: 6 additions & 37 deletions tests/components/font/test.esp32.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
glyphs: "0123456789."
extras:
- file: "gfonts://Roboto"
glyphs: ["\u00C4", "\u00C5", "\U000000C7"]
- file: "gfonts://Roboto"
id: roboto_web
size: 20
- file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft
size: 20
- file:
type: web
url: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft2
size: 24

spi:
clk_pin: 14
mosi_pin: 13

display:
- id: my_display
platform: ili9xxx
dimensions: 480x320
model: ST7796
cs_pin: 15
dc_pin: 21
reset_pin: 22
transform:
swap_xy: true
mirror_x: true
mirror_y: true
auto_clear_enabled: false
substitutions:
i2c_scl: GPIO16
i2c_sda: GPIO17
display_reset_pin: GPIO13

packages:
common: !include common.yaml
24 changes: 6 additions & 18 deletions tests/components/font/test.esp8266.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
i2c:
- id: i2c_font
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
display_reset_pin: GPIO3

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: 3
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
packages:
common: !include common.yaml
24 changes: 6 additions & 18 deletions tests/components/font/test.rp2040.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
i2c:
- id: i2c_font
scl: 5
sda: 4
substitutions:
i2c_scl: GPIO5
i2c_sda: GPIO4
display_reset_pin: GPIO3

display:
- platform: ssd1306_i2c
id: ssd1306_display
model: SSD1306_128X64
reset_pin: 3
pages:
- id: page1
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
packages:
common: !include common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ packages:
test_name: $test_name
target_platform: $target_platform
component_test_file: $component_test_file
component_dir: "../../components/$component_name"

0 comments on commit 45ae78d

Please sign in to comment.