152 lines
2.6 KiB
Text
152 lines
2.6 KiB
Text
# smoke.txt - a scripted session for ludic ui-preview (protocol-v1.md), to be run by hand or by a
|
|
# small driver: `bin/ludic-ui-preview < requests` where the requests are the `> ` lines below, in order.
|
|
#
|
|
# > LINE a request, sent as it stands (without the "> ")
|
|
# < TEXT some reply line of that request contains TEXT (in order within the reply)
|
|
# <= LINE the request's terminal line is exactly LINE
|
|
# <! TEXT no reply line of that request contains TEXT
|
|
#
|
|
# No font is loaded, so a character measures half the font size, and the viewport is 1920 x 1080, so
|
|
# a design pixel is a screen pixel and the default text is 16 px (a 4-letter word is 32 wide).
|
|
|
|
> hello
|
|
<= ok ui-preview 1 "" ""
|
|
|
|
> viewport 1920 1080
|
|
<= ok
|
|
|
|
> native "dial" 40 40
|
|
<= ok
|
|
|
|
> load "Pill" "<row id=\"root\" class=\"pill\">\n <p id=\"label\">{label}</p>\n <p id=\"pct\">{pct(0)}</p>\n <button id=\"go\" on-press=\"pick(3)\">Go</button>\n <button id=\"set\" on-press=\"set n = 2\">Set</button>\n <button id=\"close\" on-press=\"emit close\">Shut</button>\n <dial id=\"d\"/>\n <Badge id=\"badge\"/>\n</row>" ".pill {\n background: #203040;\n padding: 8;\n gap: 4;\n}\np { color: #ff0000; }"
|
|
<! err
|
|
<= ok
|
|
|
|
> model "Pill" {"label": "Food", "n": 0}
|
|
<= ok
|
|
|
|
> show Pill
|
|
<= ok
|
|
|
|
> frame 0
|
|
< frame 0
|
|
< rect
|
|
< #203040 1
|
|
< text
|
|
< 16 32 #ff0000 1 "Food"
|
|
< round
|
|
< #3a3f46 1
|
|
< "Go"
|
|
< native "dial"
|
|
< end
|
|
< miss "Pill" "pct"
|
|
<= ok
|
|
|
|
> calls "Pill" {"pct": [80, 20], "pick": true}
|
|
<= ok
|
|
|
|
> frame 0.5
|
|
< frame 0.5
|
|
< "80"
|
|
< end
|
|
<! miss
|
|
<= ok
|
|
|
|
> input key tab
|
|
<= ok
|
|
|
|
> frame 1
|
|
< end
|
|
<= ok
|
|
|
|
> input key enter
|
|
<= ok
|
|
|
|
> frame 1.1
|
|
< end
|
|
< call "Pill" "pick" [3]
|
|
<= ok
|
|
|
|
> input key tab
|
|
<= ok
|
|
|
|
> frame 1.2
|
|
<= ok
|
|
|
|
> input key enter
|
|
<= ok
|
|
|
|
> frame 1.3
|
|
< set "Pill" "n" 2
|
|
<= ok
|
|
|
|
> input key tab
|
|
<= ok
|
|
|
|
> frame 1.4
|
|
<= ok
|
|
|
|
> input key enter
|
|
<= ok
|
|
|
|
> frame 1.5
|
|
< emit "close"
|
|
<= ok
|
|
|
|
> load "Badge" "<span class=\"b\">new</span>" ".b { color: #00ff00; }"
|
|
<= ok
|
|
|
|
> frame 2
|
|
< #00ff00 1 "new"
|
|
<= ok
|
|
|
|
> tree
|
|
< node 0
|
|
< "root"
|
|
< "Food"
|
|
< "go"
|
|
<= ok
|
|
|
|
> box label
|
|
< box "
|
|
< style font-size 16
|
|
< style color #ff0000 1
|
|
<= ok
|
|
|
|
> rules label
|
|
< rule "Pill.lss" 6
|
|
< "p"
|
|
< decl "color" "#ff0000"
|
|
<= ok
|
|
|
|
> box nosuch
|
|
<= fail "box nosuch: no element has that id or key"
|
|
|
|
> load "Bad" "<row>\n <nosuch/>\n</row>" ""
|
|
< err "Bad.xml" 2 0 "<nosuch>: there is no such element
|
|
<= ok
|
|
|
|
> atlas "icon" "icons" 4 2 ["tent", "fish"]
|
|
<= ok
|
|
|
|
> load "Pic" "<row><img src=\"icon:fish\"/><img src=\"photo.png\"/></row>" ""
|
|
<= ok
|
|
|
|
> show Pic
|
|
<= ok
|
|
|
|
> frame 3
|
|
< image atlas "icons" 1
|
|
< 0.25 0 0.5 0.5
|
|
< image path "photo.png"
|
|
< 0 0 1 1 #ffffff 1
|
|
<= ok
|
|
|
|
> frobnicate
|
|
<= fail "unknown request frobnicate"
|
|
|
|
>
|
|
<= ok
|
|
|
|
> quit
|
|
<= ok
|