Skip to content

Commit

Permalink
hdri: Add screenshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPeicho committed May 3, 2024
1 parent 4662707 commit 3213573
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hdri/config.screenshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scenarios": {
"readyEvent": "HDRI.bin",
"reference": "./test/reference.png"
}
}
47 changes: 47 additions & 0 deletions hdri/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* wle:auto-imports:start */
import {MouseLookComponent} from '@wonderlandengine/components';
import {WasdControlsComponent} from '@wonderlandengine/components';
/* wle:auto-imports:end */

import {loadRuntime} from '@wonderlandengine/api';

/* wle:auto-constants:start */
const Constants = {
ProjectName: 'HDRI',
RuntimeBaseName: 'WonderlandRuntime',
WebXRRequiredFeatures: ['local',],
WebXROptionalFeatures: ['local','hand-tracking','hit-test',],
};
const RuntimeOptions = {
physx: false,
loader: false,
xrFramebufferScaleFactor: 1,
xrOfferSession: {
mode: 'auto',
features: Constants.WebXRRequiredFeatures,
optionalFeatures: Constants.WebXROptionalFeatures,
},
canvas: 'canvas',
};
/* wle:auto-constants:end */

const engine = await loadRuntime(Constants.RuntimeBaseName, RuntimeOptions);

/* wle:auto-register:start */
engine.registerComponent(MouseLookComponent);
engine.registerComponent(WasdControlsComponent);
/* wle:auto-register:end */

await engine.scene.load(`${Constants.ProjectName}.bin`);

document.getElementById('version')?.remove();
document.getElementById('ar-button')?.remove();
document.getElementById('vr-button')?.remove();

/* Dispatch scene ready event once the image is loaded.
* This ensure the test suite takes a screenshot after
* all resources are available. */

await engine.imagesPromise;

engine.scene.dispatchReadyEvent();
3 changes: 3 additions & 0 deletions hdri/test/reference.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 3213573

Please sign in to comment.