From 00f6ae83915886c69d028b60a507b1a63bea2c7e Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Thu, 21 Jan 2021 21:18:20 +0100 Subject: [PATCH] Test colors and value_str --- test/test_colors.tavern.yaml | 167 ++++++++++++++++++++++++++++++++ test/test_value_str.tavern.yaml | 32 +++--- 2 files changed, 183 insertions(+), 16 deletions(-) create mode 100644 test/test_colors.tavern.yaml diff --git a/test/test_colors.tavern.yaml b/test/test_colors.tavern.yaml new file mode 100644 index 00000000..151d1655 --- /dev/null +++ b/test/test_colors.tavern.yaml @@ -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 diff --git a/test/test_value_str.tavern.yaml b/test/test_value_str.tavern.yaml index fbfe1198..7dff1c95 100644 --- a/test/test_value_str.tavern.yaml +++ b/test/test_value_str.tavern.yaml @@ -1,4 +1,4 @@ -# test_page.tavern.yaml +# test_value_str.tavern.yaml --- test_name: Obj Standard Properties @@ -53,23 +53,25 @@ marks: - ABC - huey - dewey + - "" - parametrize: key: str2 vals: - louie - fred - - "I danced." - - "Oak is strong and also gives shade." - - "Cats and dogs each hate the other." - - "The pipe began to rust while new." - - "Open the crate but don't break the glass." - - "Add the sum to the product of these three." - - "Thieves who rob friends deserve jail." - - "The ripe taste of cheese improves with age." - - "Act on these orders with great speed." - - "The hog crawled under the high fence." - - "Move the vat over the hot fire." + - " I danced." + - " Oak is strong and also gives shade." + - " Cats and dogs each hate the other." + - " The pipe began to rust while new." + - " Open the crate but don't break the glass." + - " Add the sum to the product of these three." + - " Thieves who rob friends deserve jail." + - " The ripe taste of cheese improves with age." + - " 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