mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Test colors and value_str
This commit is contained in:
parent
551fd16101
commit
00f6ae8391
167
test/test_colors.tavern.yaml
Normal file
167
test/test_colors.tavern.yaml
Normal file
@ -0,0 +1,167 @@
|
||||
# test_value_str.tavern.yaml
|
||||
---
|
||||
test_name: Obj Standard Properties
|
||||
|
||||
includes:
|
||||
- !include config.yaml
|
||||
|
||||
paho-mqtt:
|
||||
client:
|
||||
transport: tcp
|
||||
client_id: tavern-tester
|
||||
connect:
|
||||
host: "{host}"
|
||||
port: !int "{port:d}"
|
||||
timeout: 3
|
||||
|
||||
marks:
|
||||
- parametrize:
|
||||
key:
|
||||
- color
|
||||
- hex
|
||||
- r
|
||||
- g
|
||||
- b
|
||||
- rgb565
|
||||
vals:
|
||||
- ["red", "#ff0000", 255, 0, 0, 63488]
|
||||
- ["tan", "#d5b68b", 213, 182, 139, 54705]
|
||||
- ["aqua", "#00ffff", 0, 255, 255, 2047]
|
||||
- ["blue", "#0000ff", 0, 0, 255, 31]
|
||||
- ["cyan", "#00ffff", 0, 255, 255, 2047]
|
||||
- ["gold", "#ffd600", 255, 214, 0, 65184]
|
||||
- ["gray", "#838183", 131, 129, 131, 33808]
|
||||
- ["grey", "#838183", 131, 129, 131, 33808]
|
||||
- ["lime", "#00ff00", 0, 255, 0, 2016]
|
||||
- ["navy", "#000083", 0, 0, 131, 16]
|
||||
- ["peru", "#cd8539", 205, 133, 57, 52263]
|
||||
- ["pink", "#ffc2cd", 255, 194, 205, 65049]
|
||||
- ["plum", "#dea1de", 222, 161, 222, 56603]
|
||||
- ["snow", "#fffaff", 255, 250, 255, 65503]
|
||||
- ["teal", "#008183", 0, 129, 131, 1040]
|
||||
- ["azure", "#f6ffff", 246, 255, 255, 63487]
|
||||
- ["beige", "#f6f6de", 246, 246, 222, 63419]
|
||||
- ["black", "#000000", 0, 0, 0, 0]
|
||||
- ["blush", "#b50000", 181, 0, 0, 45056]
|
||||
- ["brown", "#a42829", 164, 40, 41, 41285]
|
||||
- ["coral", "#ff7d52", 255, 125, 82, 64490]
|
||||
- ["green", "#008100", 0, 129, 0, 1024]
|
||||
- ["ivory", "#fffff6", 255, 255, 246, 65534]
|
||||
- ["khaki", "#f6e68b", 246, 230, 139, 63281]
|
||||
- ["linen", "#fff2e6", 255, 242, 230, 65436]
|
||||
- ["olive", "#838100", 131, 129, 0, 33792]
|
||||
- ["wheat", "#f6deb5", 246, 222, 181, 63222]
|
||||
- ["white", "#ffffff", 255, 255, 255, 65535]
|
||||
- ["bisque", "#ffe6c5", 255, 230, 197, 65336]
|
||||
- ["indigo", "#4a0083", 74, 0, 131, 18448]
|
||||
- ["maroon", "#830000", 131, 0, 0, 32768]
|
||||
- ["orange", "#ffa500", 255, 165, 0, 64800]
|
||||
- ["orchid", "#de71d5", 222, 113, 213, 56218]
|
||||
- ["purple", "#830083", 131, 0, 131, 32784]
|
||||
- ["salmon", "#ff8173", 255, 129, 115, 64526]
|
||||
- ["sienna", "#a45029", 164, 80, 41, 41605]
|
||||
- ["silver", "#c5c2c5", 197, 194, 197, 50712]
|
||||
- ["tomato", "#ff6141", 255, 97, 65, 64264]
|
||||
- ["violet", "#ee81ee", 238, 129, 238, 60445]
|
||||
- ["yellow", "#ffff00", 255, 255, 0, 65504]
|
||||
- ["fuchsia", "#ff00ff", 255, 0, 255, 63519]
|
||||
- ["magenta", "#ff00ff", 255, 0, 255, 63519]
|
||||
|
||||
- parametrize:
|
||||
key: obj
|
||||
vals:
|
||||
- label
|
||||
- cb
|
||||
- btn
|
||||
|
||||
stages:
|
||||
- name: Page 1
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "page 1"
|
||||
mqtt_response:
|
||||
topic: hasp/{plate}/state/page
|
||||
payload: "1"
|
||||
timeout: 5
|
||||
delay_after: 0
|
||||
|
||||
- name: Set bg_color
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "p[1].b[0].bg_color={color}"
|
||||
delay_after: 0.1
|
||||
|
||||
- name: Clear page
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command/clearpage
|
||||
payload: ""
|
||||
delay_after: 0.2
|
||||
|
||||
- name: Create object
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command/jsonl
|
||||
json:
|
||||
obj: "{obj}"
|
||||
id: 1
|
||||
txt: "{color}"
|
||||
x: 50
|
||||
y: 50
|
||||
w: 140
|
||||
delay_after: 0.1
|
||||
|
||||
- name: Set bg_color
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "p[1].b[0].bg_color={rgb565}"
|
||||
delay_after: 0.1
|
||||
|
||||
- name: Test named COLOR
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command/json
|
||||
payload: '["p[1].b[1].text_color={color}","p[1].b[1].text_color"]'
|
||||
mqtt_response:
|
||||
topic: hasp/{plate}/state/p1b1
|
||||
json:
|
||||
text_color: "{hex}"
|
||||
r: "{r}"
|
||||
g: "{g}"
|
||||
b: "{b}"
|
||||
timeout: 5
|
||||
|
||||
- name: Reset
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "p[1].b[1].text_color=123"
|
||||
delay_after: 0.02
|
||||
|
||||
- name: Test hex COLOR
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command/json
|
||||
payload: '["p[1].b[1].text_color={hex}","p[1].b[1].text_color"]'
|
||||
mqtt_response:
|
||||
topic: hasp/{plate}/state/p1b1
|
||||
json:
|
||||
text_color: "{hex}"
|
||||
r: "{r}"
|
||||
g: "{g}"
|
||||
b: "{b}"
|
||||
timeout: 5
|
||||
|
||||
- name: Reset
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "p[1].b[1].text_color=529"
|
||||
delay_after: 0.02
|
||||
|
||||
- name: Test rgb565 COLOR
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command/json
|
||||
payload: '["p[1].b[1].text_color={rgb565}","p[1].b[1].text_color"]'
|
||||
mqtt_response:
|
||||
topic: hasp/{plate}/state/p1b1
|
||||
json:
|
||||
text_color: "{hex}"
|
||||
r: "{r}"
|
||||
g: "{g}"
|
||||
b: "{b}"
|
||||
timeout: 5
|
@ -1,4 +1,4 @@
|
||||
# test_page.tavern.yaml
|
||||
# test_value_str.tavern.yaml
|
||||
---
|
||||
|
||||
test_name: Obj Standard Properties
|
||||
@ -53,6 +53,7 @@ marks:
|
||||
- ABC
|
||||
- huey
|
||||
- dewey
|
||||
- ""
|
||||
|
||||
- parametrize:
|
||||
key: str2
|
||||
@ -70,6 +71,7 @@ marks:
|
||||
- " Act on these orders with great speed."
|
||||
- " The hog crawled under the high fence."
|
||||
- " Move the vat over the hot fire."
|
||||
- ""
|
||||
|
||||
stages:
|
||||
- name: Page 1
|
||||
@ -82,12 +84,10 @@ stages:
|
||||
timeout: 5
|
||||
delay_after: 0
|
||||
|
||||
|
||||
|
||||
- name: Set value_str
|
||||
mqtt_publish:
|
||||
topic: hasp/{plate}/command
|
||||
payload: "p[1].b[1].value_str={objid} {str1} {str2}"
|
||||
payload: "p[1].b[1].value_str={str1}{str2}"
|
||||
delay_after: 0
|
||||
- name: Get value_str
|
||||
mqtt_publish:
|
||||
@ -96,5 +96,5 @@ stages:
|
||||
mqtt_response:
|
||||
topic: hasp/{plate}/state/p1b1
|
||||
json:
|
||||
value_str: "{objid} {str1} {str2}"
|
||||
value_str: "{str1}{str2}"
|
||||
timeout: 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user