Skip to content

Commit dea78dd

Browse files
polyhedra okay
1 parent 1862954 commit dea78dd

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed
83.9 KB
Binary file not shown.

tests/integration/stores/data_style/mesh/polygons.nuxt.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ beforeEach(async () => {
2525
geode_object,
2626
object_type,
2727
))
28-
console.log("beforeEach points id", id)
28+
console.log("beforeEach polygons id", id)
2929
}, 25000)
3030

3131
afterEach(async () => {
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Node.js imports
2+
3+
// Third party imports
4+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
5+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
6+
7+
// Local imports
8+
import Status from "~/utils/status"
9+
import * as composables from "~/composables/viewer_call"
10+
import { useDataStyleStore } from "~/stores/data_style"
11+
import { useViewerStore } from "~/stores/viewer"
12+
import { kill_back, kill_viewer } from "~/utils/local"
13+
import { setupIntegrationTests } from "../../../setup.js"
14+
15+
// Local constants
16+
const mesh_polyhedra_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra
17+
let id, back_port, viewer_port
18+
const file_name = "test.og_rgd3d"
19+
const geode_object = "RegularGrid3D"
20+
const object_type = "mesh"
21+
22+
beforeEach(async () => {
23+
;({ id, back_port, viewer_port } = await setupIntegrationTests(
24+
file_name,
25+
geode_object,
26+
object_type,
27+
))
28+
console.log("beforeEach polyhedra id", id)
29+
}, 25000)
30+
31+
afterEach(async () => {
32+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
33+
})
34+
35+
describe("Mesh polyhedra", () => {
36+
describe("Polyhedra visibility", () => {
37+
test("Visibility true", async () => {
38+
const dataStyleStore = useDataStyleStore()
39+
const viewerStore = useViewerStore()
40+
await dataStyleStore.setMeshPolyhedraVisibility(id, true)
41+
expect(dataStyleStore.meshPolyhedraVisibility(id)).toBe(true)
42+
expect(viewerStore.status).toBe(Status.CONNECTED)
43+
})
44+
})
45+
describe("Polyhedra active coloring", () => {
46+
test("test coloring", async () => {
47+
const dataStyleStore = useDataStyleStore()
48+
const viewerStore = useViewerStore()
49+
const coloringTypes = ["color"]
50+
for (let i = 0; i < coloringTypes.length; i++) {
51+
dataStyleStore.setMeshPolyhedraActiveColoring(id, coloringTypes[i])
52+
expect(dataStyleStore.meshPolyhedraActiveColoring(id)).toBe(
53+
coloringTypes[i],
54+
)
55+
expect(viewerStore.status).toBe(Status.CONNECTED)
56+
}
57+
})
58+
})
59+
describe("Polyhedra color", () => {
60+
test("test red", async () => {
61+
const dataStyleStore = useDataStyleStore()
62+
const viewerStore = useViewerStore()
63+
const color = { r: 255, g: 0, b: 0 }
64+
const spy = vi.spyOn(composables, "viewer_call")
65+
await dataStyleStore.setMeshPolyhedraColor(id, color)
66+
expect(spy).toHaveBeenCalledWith(
67+
{
68+
schema: mesh_polyhedra_schemas.color,
69+
params: { id, color },
70+
},
71+
{
72+
response_function: expect.any(Function),
73+
},
74+
)
75+
expect(dataStyleStore.meshPolyhedraColor(id)).toStrictEqual(color)
76+
expect(viewerStore.status).toBe(Status.CONNECTED)
77+
})
78+
})
79+
})

0 commit comments

Comments
 (0)