Skip to content

Commit

Permalink
modif on example
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Aug 31, 2023
1 parent 9b0dacf commit 2472956
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
52 changes: 26 additions & 26 deletions test/functional/misc/misc_instancing.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
const assert = require('assert');

describe('misc_instancing', function _() {
let result;
before(async () => {
result = await loadExample(
'examples/misc_instancing.html',
this.fullTitle(),
);
});
let pageLoaded;
const title = this.fullTitle();

it('should run', async () => {
assert.ok(result);
it("should load 'misc_instancing' page", async function _it() {
pageLoaded = await loadExample('examples/misc_instancing.html', title);
assert.ok(pageLoaded);
});

it('should load the trees and lights objects', async () => {
const objects = await page.evaluate(
() => {
const res = [];
if (view.scene) {
const objects3d = view.scene;
objects3d.traverse((obj) => {
if (obj.isInstancedMesh) {
if (obj.parent && obj.parent.layer) {
res.push(obj.parent.layer.name);
it('should load the trees and lights objects', async function _it() {
if (pageLoaded) {
const objects = await page.evaluate(
() => {
const res = [];
if (view.scene) {
const objects3d = view.scene;
objects3d.traverse((obj) => {
if (obj.isInstancedMesh) {
if (obj.parent && obj.parent.layer) {
res.push(obj.parent.layer.name);
}
}
}
});
}
return res;
});
assert.ok(objects.indexOf('lights') >= 0);
assert.ok(objects.indexOf('trees') >= 0);
});
}
return res;
});
assert.ok(objects.indexOf('lights') >= 0);
assert.ok(objects.indexOf('trees') >= 0);
} else {
this.skip();
}
});
});
26 changes: 15 additions & 11 deletions test/functional/wfsSource/source_stream_wfs_3d.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
const assert = require('assert');

describe('source_stream_wfs_3d', function _() {
let result;
before(async () => {
result = await loadExample('examples/source_stream_wfs_3d.html', this.fullTitle());
});
let pageLoaded;
const title = this.fullTitle();

it('should run', async () => {
assert.ok(result);
it("should load 'source_stream_wfs_3d' page", async function _it() {
pageLoaded = await loadExample('examples/source_stream_wfs_3d.html', title);
assert.ok(pageLoaded);
});
it('should remove GeometryLayer', async () => {
const countGeometryLayerStart = await page.evaluate(() => view.getLayers(l => l.isGeometryLayer).length);
await page.evaluate(() => view.removeLayer('WFS Bus lines'));
const countGeometryLayerEnd = await page.evaluate(() => view.getLayers(l => l.isGeometryLayer).length);
assert.ok(countGeometryLayerStart - countGeometryLayerEnd === 1);

it('should remove GeometryLayer', async function _it() {
if (pageLoaded) {
const countGeometryLayerStart = await page.evaluate(() => view.getLayers(l => l.isGeometryLayer).length);
await page.evaluate(() => view.removeLayer('WFS Bus lines'));
const countGeometryLayerEnd = await page.evaluate(() => view.getLayers(l => l.isGeometryLayer).length);
assert.ok(countGeometryLayerStart - countGeometryLayerEnd === 1);
} else {
this.skip();
}
});
});

0 comments on commit 2472956

Please sign in to comment.