Skip to content
Snippets Groups Projects
Commit 26e14e47 authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add test for VisB rendering

parent 37fd5e0a
Branches
No related tags found
No related merge requests found
Pipeline #117192 passed
%% Cell type:markdown id:c91030ef tags:
# Test VisB Rendering
%% Cell type:code id:30b8bf50 tags:
``` prob
::load
MACHINE button_def
// An example that uses VisB DEFINITIONS instead of a JSON and SVG file
DEFINITIONS
VISB_JSON_FILE == ""; // "button.svg";
VISB_SVG_BOX == rec(height:200, width:240);
VISB_SVG_CONTENTS == '''
<defs>
<marker id="arrowhead" markerWidth="10" markerHeight="7"
refX="0" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" />
</marker>
</marker>
</defs>
''';
VISB_SVG_OBJECTS == rec(`id`:"button", svg_class:"circle",
cx:"100",cy:"100", r:"80",
stroke:"black", `stroke-width`:"2");
VISB_SVG_UPDATES == rec(`id`:"button",
fill: IF button=TRUE THEN "green" ELSE "red" END);
VISB_SVG_HOVERS == rec(`id`:"button",
stroke:"gray", `stroke-width`:"5");
VISB_SVG_OBJECTS_ARROW == rec( svg_class:"line",
`id`: "arrow",
stroke:"gray",
`stroke-width`:2.0,
x1:100, y1:100,
`marker-end`: "url(#arrowhead)");
VISB_SVG_UPDATES2 == rec(`id`:"arrow",
visible:"TRUE",
y2:IF button=TRUE THEN 180.0 ELSE 20.0 END,
x2:100.0);
VARIABLES button
INVARIANT button:BOOL
INITIALISATION button := FALSE
OPERATIONS
toggle_button /* desc change status of button */ = BEGIN
button:= bool(button=FALSE)
END
END
```
%% Output
Loaded machine: button_def
%% Cell type:code id:91082d92 tags:
``` prob
:init
```
%% Output
Executed operation: INITIALISATION()
%% Cell type:code id:7eee20b7 tags:
``` prob
:show
```
%% Output
<VisB visualization>
%% Cell type:code id:0e4f3287 tags:
``` prob
:exec toggle_button
```
%% Output
Executed operation: toggle_button()
%% Cell type:code id:1d766206 tags:
``` prob
:show
```
%% Output
<VisB visualization>
%% Cell type:code id:a921eeea tags:
``` prob
:exec toggle_button
```
%% Output
Executed operation: toggle_button()
%% Cell type:code id:15eedcc6 tags:
``` prob
:show
```
%% Output
<VisB visualization>
%% Cell type:code id:8e25955c tags:
``` prob
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment