|
1 | | -// 'use strict'; |
| 1 | +'use strict'; |
2 | 2 |
|
3 | 3 |
|
4 | | -// const assert = require('node:assert').strict; |
5 | | -// const { describe, it } = require('node:test'); |
| 4 | +const assert = require('node:assert').strict; |
| 5 | +const { describe, it } = require('node:test'); |
6 | 6 |
|
7 | | -// const inited = require('./init')(); |
8 | | -// const { QmlOverlay, QmlMaterial, QmlOverlayMaterial, loop, window } = inited; |
| 7 | +const inited = require('./init')(); |
| 8 | +const { QmlOverlay, QmlMaterial, QmlOverlayMaterial, loop, window } = inited; |
9 | 9 |
|
10 | | -// const initResults = [ |
11 | | -// 'QmlOverlay', 'QmlMaterial', 'QmlOverlayMaterial', |
12 | | -// 'Property', 'Method', 'View', |
13 | | -// 'loop', 'release', 'textureFromId', |
14 | | -// ]; |
| 10 | +const initResults = [ |
| 11 | + 'QmlOverlay', 'QmlMaterial', 'QmlOverlayMaterial', |
| 12 | + 'Property', 'Method', 'View', |
| 13 | + 'loop', 'release', 'textureFromId', |
| 14 | +]; |
15 | 15 |
|
16 | | -// const initedClasses = { |
17 | | -// QmlOverlay: { |
18 | | -// create() { |
19 | | -// return new QmlOverlay({ file: `${__dirname}/test.qml` }); |
20 | | -// }, |
21 | | -// props: ['isVisible', 'isDisabled', 'material', 'mesh'], |
22 | | -// }, |
23 | | -// QmlMaterial: { |
24 | | -// create() { |
25 | | -// return new QmlMaterial(); |
26 | | -// }, |
27 | | -// props: ['textureId'], |
28 | | -// }, |
29 | | -// QmlOverlayMaterial: { |
30 | | -// create() { |
31 | | -// return new QmlOverlayMaterial(); |
32 | | -// }, |
33 | | -// props: ['textureId'], |
34 | | -// }, |
35 | | -// }; |
| 16 | +const initedClasses = { |
| 17 | + QmlOverlay: { |
| 18 | + create() { |
| 19 | + return new QmlOverlay({ file: `${__dirname}/test.qml` }); |
| 20 | + }, |
| 21 | + props: ['isVisible', 'isDisabled', 'material', 'mesh'], |
| 22 | + }, |
| 23 | + QmlMaterial: { |
| 24 | + create() { |
| 25 | + return new QmlMaterial(); |
| 26 | + }, |
| 27 | + props: ['textureId'], |
| 28 | + }, |
| 29 | + QmlOverlayMaterial: { |
| 30 | + create() { |
| 31 | + return new QmlOverlayMaterial(); |
| 32 | + }, |
| 33 | + props: ['textureId'], |
| 34 | + }, |
| 35 | +}; |
36 | 36 |
|
37 | 37 |
|
38 | | -// const tested = describe('Qml 3D Inited', () => { |
39 | | -// it('returns all init results', () => { |
40 | | -// initResults.forEach( |
41 | | -// (name) => assert.strictEqual( |
42 | | -// typeof inited[name], |
43 | | -// 'function', |
44 | | -// `Init field "${name}" is missing.`, |
45 | | -// ), |
46 | | -// ); |
47 | | -// }); |
| 38 | +const tested = describe('Qml 3D Inited', () => { |
| 39 | + it('returns all init results', () => { |
| 40 | + initResults.forEach( |
| 41 | + (name) => assert.strictEqual( |
| 42 | + typeof inited[name], |
| 43 | + 'function', |
| 44 | + `Init field "${name}" is missing.`, |
| 45 | + ), |
| 46 | + ); |
| 47 | + }); |
48 | 48 |
|
49 | | -// Object.keys(initedClasses).forEach((c) => { |
50 | | -// it(`exports class "${c}"`, () => { |
51 | | -// assert.strictEqual(typeof inited[c], 'function'); |
52 | | -// }); |
| 49 | + Object.keys(initedClasses).forEach((c) => { |
| 50 | + it(`exports class "${c}"`, () => { |
| 51 | + assert.strictEqual(typeof inited[c], 'function'); |
| 52 | + }); |
53 | 53 |
|
54 | | -// const current = initedClasses[c]; |
55 | | -// const instance = current.create(); |
| 54 | + const current = initedClasses[c]; |
| 55 | + const instance = current.create(); |
56 | 56 |
|
57 | | -// it(`is valid instance of ${c}`, () => { |
58 | | -// assert.ok( |
59 | | -// instance instanceof inited[c], |
60 | | -// `Can't instantiate class "${c}".`, |
61 | | -// ); |
62 | | -// }); |
| 57 | + it(`is valid instance of ${c}`, () => { |
| 58 | + assert.ok( |
| 59 | + instance instanceof inited[c], |
| 60 | + `Can't instantiate class "${c}".`, |
| 61 | + ); |
| 62 | + }); |
63 | 63 |
|
64 | | -// it(`exposes properties of "${c}"`, () => { |
65 | | -// current.props.forEach((prop) => { |
66 | | -// assert.ok( |
67 | | -// typeof instance[prop] !== 'undefined', |
68 | | -// `Property "${c}.${prop}" not found.`, |
69 | | -// ); |
70 | | -// }); |
71 | | -// }); |
72 | | -// }); |
73 | | -// }); |
| 64 | + it(`exposes properties of "${c}"`, () => { |
| 65 | + current.props.forEach((prop) => { |
| 66 | + assert.ok( |
| 67 | + typeof instance[prop] !== 'undefined', |
| 68 | + `Property "${c}.${prop}" not found.`, |
| 69 | + ); |
| 70 | + }); |
| 71 | + }); |
| 72 | + }); |
| 73 | +}); |
74 | 74 |
|
75 | | -// (async () => { |
76 | | -// const stop = loop(() => { |
| 75 | +(async () => { |
| 76 | + const stop = loop(() => { |
77 | 77 |
|
78 | | -// }); |
79 | | -// await tested; |
80 | | -// stop(); |
81 | | -// window.destroy(); |
82 | | -// setTimeout(() => undefined, 500); |
83 | | -// })(); |
| 78 | + }); |
| 79 | + await tested; |
| 80 | + stop(); |
| 81 | + window.destroy(); |
| 82 | + setTimeout(() => undefined, 500); |
| 83 | +})(); |
0 commit comments