2022-11-12 01:31:08PM
This commit is contained in:
parent
3f653beb1c
commit
6abbab5a7e
7 changed files with 244 additions and 0 deletions
|
|
@ -500,9 +500,11 @@ func drawShape(writer io.Writer, targetShape d2target.Shape) error {
|
|||
switch targetShape.Type {
|
||||
case d2target.ShapeClass:
|
||||
drawClass(writer, targetShape)
|
||||
fmt.Fprintf(writer, `</g>`)
|
||||
return nil
|
||||
case d2target.ShapeSQLTable:
|
||||
drawTable(writer, targetShape)
|
||||
fmt.Fprintf(writer, `</g>`)
|
||||
return nil
|
||||
case d2target.ShapeOval:
|
||||
if targetShape.Multiple {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package e2etests
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -127,6 +128,11 @@ func run(t *testing.T, tc testCase) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var xmlParsed interface{}
|
||||
if err := xml.Unmarshal(svgBytes, &xmlParsed); err != nil {
|
||||
t.Fatalf("invalid SVG: %v", err)
|
||||
}
|
||||
|
||||
err = diff.Testdata(filepath.Join(dataPath, "board"), diagram)
|
||||
if err != nil {
|
||||
ioutil.WriteFile(pathGotSVG, svgBytes, 0600)
|
||||
|
|
|
|||
|
|
@ -816,6 +816,20 @@ a line of text and an
|
|||
|
||||
|
|
||||
a -> md -> b
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "class",
|
||||
script: `manager: BatchManager {
|
||||
shape: class
|
||||
-num: int
|
||||
-timeout: int
|
||||
-pid
|
||||
|
||||
+getStatus(): Enum
|
||||
+getJobs(): "Job[]"
|
||||
+setTimeout(seconds int)
|
||||
}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
75
e2etests/testdata/stable/class/dagre/board.exp.json
vendored
Normal file
75
e2etests/testdata/stable/class/dagre/board.exp.json
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"name": "",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "manager",
|
||||
"type": "class",
|
||||
"pos": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"width": 339,
|
||||
"height": 368,
|
||||
"level": 1,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#FFFFFF",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"fields": [
|
||||
{
|
||||
"name": "num",
|
||||
"type": "int",
|
||||
"visibility": "private"
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "int",
|
||||
"visibility": "private"
|
||||
},
|
||||
{
|
||||
"name": "pid",
|
||||
"type": "",
|
||||
"visibility": "private"
|
||||
}
|
||||
],
|
||||
"methods": [
|
||||
{
|
||||
"name": "getStatus()",
|
||||
"return": "Enum",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"name": "getJobs()",
|
||||
"return": "Job[]",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"name": "setTimeout(seconds int)",
|
||||
"return": "void",
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"columns": null,
|
||||
"label": "BatchManager",
|
||||
"fontSize": 20,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 150,
|
||||
"labelHeight": 36
|
||||
}
|
||||
],
|
||||
"connections": []
|
||||
}
|
||||
36
e2etests/testdata/stable/class/dagre/sketch.exp.svg
vendored
Normal file
36
e2etests/testdata/stable/class/dagre/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 327 KiB |
75
e2etests/testdata/stable/class/elk/board.exp.json
vendored
Normal file
75
e2etests/testdata/stable/class/elk/board.exp.json
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"name": "",
|
||||
"shapes": [
|
||||
{
|
||||
"id": "manager",
|
||||
"type": "class",
|
||||
"pos": {
|
||||
"x": 12,
|
||||
"y": 12
|
||||
},
|
||||
"width": 339,
|
||||
"height": 368,
|
||||
"level": 1,
|
||||
"opacity": 1,
|
||||
"strokeDash": 0,
|
||||
"strokeWidth": 2,
|
||||
"borderRadius": 0,
|
||||
"fill": "#FFFFFF",
|
||||
"stroke": "#0A0F25",
|
||||
"shadow": false,
|
||||
"3d": false,
|
||||
"multiple": false,
|
||||
"tooltip": "",
|
||||
"link": "",
|
||||
"icon": null,
|
||||
"iconPosition": "",
|
||||
"fields": [
|
||||
{
|
||||
"name": "num",
|
||||
"type": "int",
|
||||
"visibility": "private"
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "int",
|
||||
"visibility": "private"
|
||||
},
|
||||
{
|
||||
"name": "pid",
|
||||
"type": "",
|
||||
"visibility": "private"
|
||||
}
|
||||
],
|
||||
"methods": [
|
||||
{
|
||||
"name": "getStatus()",
|
||||
"return": "Enum",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"name": "getJobs()",
|
||||
"return": "Job[]",
|
||||
"visibility": "public"
|
||||
},
|
||||
{
|
||||
"name": "setTimeout(seconds int)",
|
||||
"return": "void",
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"columns": null,
|
||||
"label": "BatchManager",
|
||||
"fontSize": 20,
|
||||
"fontFamily": "DEFAULT",
|
||||
"language": "",
|
||||
"color": "#0A0F25",
|
||||
"italic": false,
|
||||
"bold": true,
|
||||
"underline": false,
|
||||
"labelWidth": 150,
|
||||
"labelHeight": 36
|
||||
}
|
||||
],
|
||||
"connections": []
|
||||
}
|
||||
36
e2etests/testdata/stable/class/elk/sketch.exp.svg
vendored
Normal file
36
e2etests/testdata/stable/class/elk/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 327 KiB |
Loading…
Reference in a new issue