Skip to content

Commit

Permalink
Added some test for mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsmalm committed Mar 14, 2023
1 parent a20dee5 commit 275a7f8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/browser-test-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import "./custom-geometry.test.mjs"
import "./composite-sprite.test.mjs"
import "./sprite.test.mjs"
import "./model-animation.test.mjs"
import "./mesh.test.mjs"
import "./camera.test.mjs"
import "./camera-orbit-control.test.mjs"
import "./interaction.test.mjs"
Expand Down
44 changes: 44 additions & 0 deletions test/mesh.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { expect } from "chai"

describe("Mesh", () => {

it("should render cylinder correctly using pixi *.*.*", async () => {
let render = (renderer, resources) => {
let lightingEnvironment = new PIXI3D.LightingEnvironment(renderer)
lightingEnvironment.imageBasedLighting = new PIXI3D.ImageBasedLighting(
resources["assets/chromatic/diffuse.cubemap"].cubemap,
resources["assets/chromatic/specular.cubemap"].cubemap
)
let mesh = PIXI3D.Mesh3D.createCylinder()
mesh.material.lightingEnvironment = lightingEnvironment
mesh.rotationQuaternion.setEulerAngles(15, 35, 0)
renderer.render(mesh)
}
await expect(render).to.match("snapshots/cibey.png", {
resources: [
"assets/chromatic/specular.cubemap",
"assets/chromatic/diffuse.cubemap"
]
})
})

it("should render circle correctly using pixi *.*.*", async () => {
let render = (renderer, resources) => {
let lightingEnvironment = new PIXI3D.LightingEnvironment(renderer)
lightingEnvironment.imageBasedLighting = new PIXI3D.ImageBasedLighting(
resources["assets/chromatic/diffuse.cubemap"].cubemap,
resources["assets/chromatic/specular.cubemap"].cubemap
)
let mesh = PIXI3D.Mesh3D.createCircle()
mesh.material.lightingEnvironment = lightingEnvironment
renderer.render(mesh)
}
await expect(render).to.match("snapshots/npswr.png", {
resources: [
"assets/chromatic/specular.cubemap",
"assets/chromatic/diffuse.cubemap"
]
})
})

})
1 change: 1 addition & 0 deletions test/puppeteer-test-context.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import "./custom-geometry.test.mjs"
import "./composite-sprite.test.mjs"
import "./sprite.test.mjs"
import "./model-animation.test.mjs"
import "./mesh.test.mjs"
import "./camera.test.mjs"
import "./camera-orbit-control.test.mjs"
// import "./interaction.test.mjs"
Expand Down
Binary file added test/snapshots/cibey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/snapshots/npswr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 275a7f8

Please sign in to comment.