Skip to content

Commit

Permalink
Update Graphviz to 10.0.1
Browse files Browse the repository at this point in the history
- Fix usage of TRUE and FALSE
- Remove test that depended on Graphviz exiting for invalid HTML labels
- Add svg_inline to tests that check the list of formats
  • Loading branch information
mdaines committed Feb 26, 2024
1 parent 4824c37 commit 1d2ce2d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
2 changes: 2 additions & 0 deletions packages/viz/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* Update Graphviz to 10.0.1.

## 3.3.1

* Accept "images" entries with duplicate names.
Expand Down
2 changes: 1 addition & 1 deletion packages/viz/src/module/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN mkdir -p expat && tar -zxf ./expat.tar.gz --strip-components 1 --directory e
RUN cd expat && emconfigure ./configure --host=wasm32 --disable-shared --prefix="${PREFIX}" --libdir="${PREFIX}/lib" CFLAGS="-Oz" CXXFLAGS="-Oz"
RUN cd expat/lib && emmake make all install

ADD "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/9.0.0/graphviz-9.0.0.tar.gz" ./graphviz.tar.gz
ADD "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/10.0.1/graphviz-10.0.1.tar.gz" ./graphviz.tar.gz

RUN mkdir -p graphviz && tar -zxf ./graphviz.tar.gz --strip-components 1 --directory graphviz
RUN cd graphviz && emconfigure ./configure --host=wasm32 --disable-ltdl --prefix="${PREFIX}" --libdir="${PREFIX}/lib" EXPAT_CFLAGS="-I${PREFIX}/include" EXPAT_LIBS="-L${PREFIX}/lib -lexpat" CFLAGS="-Oz" CXXFLAGS="-Oz"
Expand Down
11 changes: 6 additions & 5 deletions packages/viz/src/module/viz.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gvc.h>
#include <emscripten.h>
#include <stdbool.h>

extern int Y_invert;
extern unsigned char Reduce;
Expand Down Expand Up @@ -116,19 +117,19 @@ int viz_string_free(Agraph_t * g, const char *s) {

EMSCRIPTEN_KEEPALIVE
Agnode_t *viz_add_node(Agraph_t *g, char *name) {
return agnode(g, name, TRUE);
return agnode(g, name, true);
}

EMSCRIPTEN_KEEPALIVE
Agedge_t *viz_add_edge(Agraph_t *g, char *uname, char *vname) {
Agnode_t *u = agnode(g, uname, TRUE);
Agnode_t *v = agnode(g, vname, TRUE);
return agedge(g, u, v, NULL, TRUE);
Agnode_t *u = agnode(g, uname, true);
Agnode_t *v = agnode(g, vname, true);
return agedge(g, u, v, NULL, true);
}

EMSCRIPTEN_KEEPALIVE
Agraph_t *viz_add_subgraph(Agraph_t *g, char *name) {
return agsubg(g, name, TRUE);
return agsubg(g, name, true);
}

EMSCRIPTEN_KEEPALIVE
Expand Down
3 changes: 2 additions & 1 deletion packages/viz/test/context-info.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("Viz", function() {

describe("graphvizVersion", function() {
it("returns the Graphviz version", function() {
assert.strictEqual(viz.graphvizVersion, "9.0.0");
assert.strictEqual(viz.graphvizVersion, "10.0.1");
});
});

Expand Down Expand Up @@ -39,6 +39,7 @@ describe("Viz", function() {
"ps",
"ps2",
"svg",
"svg_inline",
"tk",
"xdot",
"xdot1.2",
Expand Down
15 changes: 1 addition & 14 deletions packages/viz/test/render.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ stop
status: "failure",
output: undefined,
errors: [
{ level: "error", message: "Format: \"invalid\" not recognized. Use one of: canon cmap cmapx cmapx_np dot dot_json eps fig gv imap imap_np ismap json json0 mp pic plain plain-ext pov ps ps2 svg tk xdot xdot1.2 xdot1.4 xdot_json" }
{ level: "error", message: "Format: \"invalid\" not recognized. Use one of: canon cmap cmapx cmapx_np dot dot_json eps fig gv imap imap_np ismap json json0 mp pic plain plain-ext pov ps ps2 svg svg_inline tk xdot xdot1.2 xdot1.4 xdot_json" }
]
});
});
Expand Down Expand Up @@ -296,19 +296,6 @@ stop
});
});

it("returns an error if exit() is called", function() {
const result = viz.render("graph { a[label=<>] }");

assert.deepStrictEqual(result,{
status: "failure",
output: undefined,
errors: [
{ level: "error", message: "syntax error in line 1" },
{ level: "error", message: "... <HTML></HTML> ..." }
]
});
});

it("the graph is read with the default node label set", function() {
const result = viz.render("graph { a; b[label=test] }");

Expand Down
3 changes: 2 additions & 1 deletion packages/viz/test/standalone.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Viz from "../src/viz.mjs";

describe("graphvizVersion", function() {
it("returns the Graphviz version", function() {
assert.strictEqual(VizPackage.graphvizVersion, "9.0.0");
assert.strictEqual(VizPackage.graphvizVersion, "10.0.1");
});
});

Expand Down Expand Up @@ -33,6 +33,7 @@ describe("formats", function() {
"ps",
"ps2",
"svg",
"svg_inline",
"tk",
"xdot",
"xdot1.2",
Expand Down

0 comments on commit 1d2ce2d

Please sign in to comment.