sverweij/mscgen_js

View on GitHub
src/samples/smoketest.mscin

Summary

Maintainability
Test Coverage
msc {
  # options
  hscale="1.0", width="700", arcgradient="8";

  # entities
  a [label="Entity A", textbgcolor="pink"],
  b [textbgcolor="violet"],
  "entity c" [textbgcolor="purple",
              textcolor="yellow",
              linecolor="violet",
              arclinecolor="orange",
              arctextcolor="yellow",
              arctextbgcolor="purple"],
  "d" [textbgcolor="black", textcolor="white"];

  # arcs
  a =>> b [label="do magic",
           textcolor="cyan",
           textbgcolor="blue"];
  b -> "entity c" [label="doMagic()"];  

  "entity c" >> b[label="same line as response, note"],
  b >> a [label="response",
          linecolor="green",
          textcolor="green"],
  d note d [label="note with a link to the code of mscgen_js on github",
            url="https://github.com/sverweij/mscgen_js"];
  b :> "entity c" [label="with emphasis"];
  "entity c" :> "entity c"
      [label="emph selfie with arcskip", arcskip="2"];
  ... [label="More magic stuff will be happening here",
       textcolor="red", textbgcolor="gold"];
  |||;

  --- [label="When a signal appears to be lost, a calls d",
       id="*", textcolor="red", linecolor="red"];
  a-xb [label="lost:-/", linecolor="red", textcolor="blue"];
  a=>d[label="log this"];
  d =>> d [label="self reference",
           textbgcolor="red",
           textcolor="white",
           linecolor="green"];
  d >>a[label="this message skips an arc", arcskip="1"];
  |||;
  ---[label="Note tests",
      textcolor="green",
      linecolor="green"];
  "entity c" note "entity c" [label="conference!"],
  "entity c" <<=>> d,
  "entity c" <-> b;
  a box a  [label="Black box example",
            textcolor="red",
            textbgcolor="black",
            linecolor="yellow"],
  b rbox b [label="This is an 'rbox' example",
            textbgcolor="cyan"],

  d note d [label="Example of a note with a lot of text, wrapping over more than two lines, so the whole row is expanded.",
            linecolor="green",
            textcolor="green",
            textbgcolor="#0F0"];
  b abox d [label="This is an 'abox' spanning several lifelines. To get text to wrap you'd need to enter a LOT of it. Anyhoo, it's working.",
                              textcolor="white",
                              textbgcolor="brown",
                              linecolor="orange"],
  |||;
  ---[label="broadcast tests",
      textcolor="purple", linecolor="brown"];
  * <<= b [label="This is a broadcast message",
           linecolor="fuchsia"];
  "entity c" -x *
          [label="Broadcast, but lost to everyone :-(",
           textcolor="red", linecolor="red"];
  "entity c" :> *
          [label="emphasised broadcast. No color"];
  ...; # it goes on and on and on ...
}