-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
241 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,9 @@ jobs: | |
- name: Install Modules | ||
run: npm ci | ||
|
||
- name: Run Unit Tests | ||
if: matrix.os == 'ubuntu-22.04' | ||
run: xvfb-run --auto-servernum npm run test-ci | ||
- uses: openrndr/[email protected] | ||
- run: xvfb-run glxinfo | ||
|
||
# - name: Run Unit Tests | ||
# if: matrix.os == 'ubuntu-22.04' | ||
# run: xvfb-run --auto-servernum npm run test-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
node_modules/ | ||
examples/3d-core/*.jpg | ||
*.log | ||
test/__diff__ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const assert = require('node:assert').strict; | ||
const { describe, it } = require('node:test'); | ||
const three = require('three'); | ||
|
||
const { screenshot } = require('./screenshot'); | ||
const { window, document } = require('./init'); | ||
|
||
|
||
const loadBox = () => { | ||
return new Promise((res) => { | ||
let mesh = null; | ||
const texture = new three.TextureLoader().load( | ||
__dirname + '/../examples/three/textures/crate.gif', | ||
() => res(mesh), | ||
); | ||
texture.colorSpace = three.SRGBColorSpace; | ||
const geometry = new three.BoxGeometry(); | ||
const material = new three.MeshBasicMaterial({ map: texture }); | ||
mesh = new three.Mesh(geometry, material); | ||
mesh.rotation.x = Math.PI / 7; | ||
mesh.rotation.y = Math.PI / 5; | ||
}); | ||
}; | ||
|
||
describe('Screenshots', () => { | ||
it('matches box screenshot', async () => { | ||
const camera = new three.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); | ||
camera.position.z = 2; | ||
const scene = new three.Scene(); | ||
|
||
const mesh = await loadBox(); | ||
scene.add(mesh); | ||
|
||
const renderer = new three.WebGLRenderer(); | ||
renderer.setPixelRatio(window.devicePixelRatio); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
document.body.appendChild(renderer.domElement); | ||
|
||
renderer.render(scene, camera); | ||
|
||
assert.ok(await screenshot('box')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const three = require('three'); | ||
|
||
const { init, addThreeHelpers } = require('..'); | ||
|
||
const inited = init({ | ||
isGles3: true, | ||
isWebGL2: true, | ||
}); | ||
addThreeHelpers(three, inited.gl); | ||
|
||
module.exports = inited; |
Oops, something went wrong.