xbintsc 0.5.31 → 0.5.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -16
- package/README.zh-CN.md +10 -8
- package/dist/scripts/check-version.d.ts +27 -0
- package/dist/scripts/check-version.js +71 -0
- package/dist/scripts/check-version.js.map +1 -0
- package/dist/scripts/package-platform.d.ts +58 -0
- package/dist/scripts/package-platform.js +142 -0
- package/dist/scripts/package-platform.js.map +1 -0
- package/dist/scripts/verify-platform-package.d.ts +34 -0
- package/dist/scripts/verify-platform-package.js +161 -0
- package/dist/scripts/verify-platform-package.js.map +1 -0
- package/dist/src/binder/references.js +14 -1
- package/dist/src/binder/references.js.map +1 -1
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/cli/main.js +3 -1
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/codegen/generator/module.d.ts +1 -0
- package/dist/src/codegen/generator/module.js +54 -0
- package/dist/src/codegen/generator/module.js.map +1 -1
- package/dist/src/codegen/generator/statements/variables.js +6 -4
- package/dist/src/codegen/generator/statements/variables.js.map +1 -1
- package/dist/src/driver/runtime-lib.d.ts +29 -4
- package/dist/src/driver/runtime-lib.js +68 -10
- package/dist/src/driver/runtime-lib.js.map +1 -1
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/gui/css.d.ts +26 -0
- package/dist/src/extensions/gui/css.js +100 -0
- package/dist/src/extensions/gui/css.js.map +1 -0
- package/dist/src/extensions/gui/html.js +9 -2
- package/dist/src/extensions/gui/html.js.map +1 -1
- package/dist/src/extensions/gui/index.js +22 -7
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/gui/three.d.ts +16 -0
- package/dist/src/extensions/gui/three.js +22 -0
- package/dist/src/extensions/gui/three.js.map +1 -0
- package/dist/src/extensions/media/index.d.ts +6 -5
- package/dist/src/extensions/media/index.js +15 -16
- package/dist/src/extensions/media/index.js.map +1 -1
- package/dist/src/parser/context.d.ts +41 -0
- package/dist/src/parser/context.js +89 -4
- package/dist/src/parser/context.js.map +1 -1
- package/dist/src/parser/literals.js +6 -12
- package/dist/src/parser/literals.js.map +1 -1
- package/dist/tests/driver/platform-package.test.d.ts +1 -0
- package/dist/tests/driver/platform-package.test.js +49 -0
- package/dist/tests/driver/platform-package.test.js.map +1 -0
- package/dist/tests/driver/runtime-lib.test.js +51 -4
- package/dist/tests/driver/runtime-lib.test.js.map +1 -1
- package/dist/tests/e2e/compile-builtins.test.js +24 -0
- package/dist/tests/e2e/compile-builtins.test.js.map +1 -1
- package/dist/tests/e2e/compile-objects-classes.test.js +23 -0
- package/dist/tests/e2e/compile-objects-classes.test.js.map +1 -1
- package/dist/tests/e2e/gui-audio.test.d.ts +14 -0
- package/dist/tests/e2e/gui-audio.test.js +287 -0
- package/dist/tests/e2e/gui-audio.test.js.map +1 -0
- package/dist/tests/e2e/gui-browser.test.js +1 -1
- package/dist/tests/e2e/gui-browser.test.js.map +1 -1
- package/dist/tests/e2e/gui-effects.test.d.ts +6 -0
- package/dist/tests/e2e/gui-effects.test.js +262 -0
- package/dist/tests/e2e/gui-effects.test.js.map +1 -0
- package/dist/tests/e2e/gui-example-webgl.test.d.ts +10 -0
- package/dist/tests/e2e/gui-example-webgl.test.js +75 -0
- package/dist/tests/e2e/gui-example-webgl.test.js.map +1 -0
- package/dist/tests/e2e/gui-example-webgl2.test.d.ts +8 -0
- package/dist/tests/e2e/gui-example-webgl2.test.js +72 -0
- package/dist/tests/e2e/gui-example-webgl2.test.js.map +1 -0
- package/dist/tests/e2e/gui-helpers.d.ts +7 -0
- package/dist/tests/e2e/gui-helpers.js +1 -0
- package/dist/tests/e2e/gui-helpers.js.map +1 -1
- package/dist/tests/e2e/gui-layout.test.js +48 -0
- package/dist/tests/e2e/gui-layout.test.js.map +1 -1
- package/dist/tests/e2e/gui-media.test.js +83 -4
- package/dist/tests/e2e/gui-media.test.js.map +1 -1
- package/dist/tests/e2e/gui-style.test.js +55 -0
- package/dist/tests/e2e/gui-style.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl.test.d.ts +11 -0
- package/dist/tests/e2e/gui-webgl.test.js +437 -0
- package/dist/tests/e2e/gui-webgl.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-3d.test.d.ts +4 -0
- package/dist/tests/e2e/gui-webgl2-3d.test.js +264 -0
- package/dist/tests/e2e/gui-webgl2-3d.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.d.ts +10 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.js +262 -0
- package/dist/tests/e2e/gui-webgl2-blit.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.d.ts +6 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.js +395 -0
- package/dist/tests/e2e/gui-webgl2-formats.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.d.ts +4 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.js +105 -0
- package/dist/tests/e2e/gui-webgl2-mrt.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.d.ts +8 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.js +112 -0
- package/dist/tests/e2e/gui-webgl2-ubo.test.js.map +1 -0
- package/dist/tests/e2e/gui-webgl2.test.d.ts +10 -0
- package/dist/tests/e2e/gui-webgl2.test.js +282 -0
- package/dist/tests/e2e/gui-webgl2.test.js.map +1 -0
- package/dist/tests/extensions/gui-index.test.js +1 -0
- package/dist/tests/extensions/gui-index.test.js.map +1 -1
- package/dist/tests/extensions/gui.test.js +41 -0
- package/dist/tests/extensions/gui.test.js.map +1 -1
- package/dist/tests/extensions/media.test.js +8 -3
- package/dist/tests/extensions/media.test.js.map +1 -1
- package/dist/tests/parser/expressions.test.js +30 -0
- package/dist/tests/parser/expressions.test.js.map +1 -1
- package/dist/tests/platform-tarball.test.d.ts +1 -0
- package/dist/tests/platform-tarball.test.js +111 -0
- package/dist/tests/platform-tarball.test.js.map +1 -0
- package/dist/tests/version.test.js +6 -0
- package/dist/tests/version.test.js.map +1 -1
- package/doc/ai/contributing.md +11 -0
- package/doc/ai/extensions.md +35 -12
- package/doc/ai/troubleshooting.md +17 -11
- package/doc/ai/zh-CN/contributing.md +9 -0
- package/doc/ai/zh-CN/extensions.md +30 -10
- package/doc/ai/zh-CN/troubleshooting.md +14 -8
- package/doc/gui/api.md +63 -14
- package/doc/gui/build.md +79 -16
- package/doc/gui/canvas.md +11 -3
- package/doc/gui/dom.md +35 -17
- package/doc/gui/known-issues.md +57 -24
- package/doc/gui/layout.md +18 -0
- package/doc/gui/media.md +21 -13
- package/doc/gui/rendering.md +50 -3
- package/doc/gui/webgl.md +315 -0
- package/doc/gui.md +113 -18
- package/doc/npm-package.md +59 -29
- package/doc/requirements.md +24 -11
- package/doc/zh-CN/gui/api.md +53 -11
- package/doc/zh-CN/gui/build.md +70 -16
- package/doc/zh-CN/gui/canvas.md +9 -2
- package/doc/zh-CN/gui/dom.md +22 -7
- package/doc/zh-CN/gui/known-issues.md +45 -19
- package/doc/zh-CN/gui/layout.md +14 -0
- package/doc/zh-CN/gui/media.md +18 -11
- package/doc/zh-CN/gui/rendering.md +41 -4
- package/doc/zh-CN/gui/webgl.md +121 -0
- package/doc/zh-CN/gui.md +91 -15
- package/doc/zh-CN/npm-package.md +48 -24
- package/doc/zh-CN/requirements.md +16 -7
- package/llms.txt +2 -0
- package/package.json +17 -1
- package/runtime/ext_gui/audio.cpp +365 -153
- package/runtime/ext_gui/audio_buffer.cpp +166 -0
- package/runtime/ext_gui/audio_buffer.h +37 -0
- package/runtime/ext_gui/audio_decode.cpp +219 -0
- package/runtime/ext_gui/audio_decode.h +39 -0
- package/runtime/ext_gui/audio_device.cpp +87 -0
- package/runtime/ext_gui/audio_effects.cpp +163 -0
- package/runtime/ext_gui/audio_effects.h +25 -0
- package/runtime/ext_gui/audio_internal.h +30 -0
- package/runtime/ext_gui/audio_mixer.cpp +494 -0
- package/runtime/ext_gui/audio_mixer.h +238 -0
- package/runtime/ext_gui/audio_param.cpp +104 -0
- package/runtime/ext_gui/audio_param_object.cpp +155 -0
- package/runtime/ext_gui/browser.cpp +50 -14
- package/runtime/ext_gui/canvas.cpp +3 -18
- package/runtime/ext_gui/canvas_internal.h +10 -0
- package/runtime/ext_gui/canvas_raster.cpp +60 -0
- package/runtime/ext_gui/clip_values.cpp +246 -0
- package/runtime/ext_gui/css.cpp +94 -0
- package/runtime/ext_gui/css.h +22 -1
- package/runtime/ext_gui/css_match.cpp +3 -0
- package/runtime/ext_gui/css_selector.cpp +30 -3
- package/runtime/ext_gui/css_sheet.cpp +89 -45
- package/runtime/ext_gui/document.cpp +4 -1
- package/runtime/ext_gui/document.h +2 -0
- package/runtime/ext_gui/dom.h +16 -0
- package/runtime/ext_gui/dom_api.cpp +1 -0
- package/runtime/ext_gui/dom_api_canvas.cpp +17 -80
- package/runtime/ext_gui/dom_api_canvas_extra.cpp +130 -1
- package/runtime/ext_gui/dom_api_canvas_pending.cpp +41 -0
- package/runtime/ext_gui/dom_api_internal.h +275 -0
- package/runtime/ext_gui/dom_api_webgl.cpp +383 -0
- package/runtime/ext_gui/dom_api_webgl2.cpp +549 -0
- package/runtime/ext_gui/dom_api_webgl2_draw.cpp +269 -0
- package/runtime/ext_gui/dom_api_webgl_buffer.cpp +216 -0
- package/runtime/ext_gui/dom_api_webgl_compressed.cpp +167 -0
- package/runtime/ext_gui/dom_api_webgl_framebuffer.cpp +160 -0
- package/runtime/ext_gui/dom_api_webgl_rt.h +30 -0
- package/runtime/ext_gui/dom_api_webgl_shader.cpp +443 -0
- package/runtime/ext_gui/dom_api_webgl_source.cpp +161 -0
- package/runtime/ext_gui/dom_api_webgl_state.cpp +590 -0
- package/runtime/ext_gui/dom_api_webgl_texture.cpp +485 -0
- package/runtime/ext_gui/dom_api_webgl_ubo.cpp +81 -0
- package/runtime/ext_gui/effect_values.cpp +312 -0
- package/runtime/ext_gui/gradient_values.cpp +476 -0
- package/runtime/ext_gui/grid_values.cpp +230 -0
- package/runtime/ext_gui/gui.cpp +44 -9
- package/runtime/ext_gui/gui_canvas.cpp +50 -2
- package/runtime/ext_gui/gui_engine.h +36 -4
- package/runtime/ext_gui/gui_events.cpp +4 -1
- package/runtime/ext_gui/gui_media.cpp +1 -1
- package/runtime/ext_gui/gui_webgl.cpp +83 -0
- package/runtime/ext_gui/image_bitmap.cpp +28 -0
- package/runtime/ext_gui/image_bitmap.h +26 -0
- package/runtime/ext_gui/image_bitmap_browser.cpp +136 -0
- package/runtime/ext_gui/layout.cpp +21 -0
- package/runtime/ext_gui/layout_flow.cpp +81 -4
- package/runtime/ext_gui/layout_flow_internal.h +31 -0
- package/runtime/ext_gui/layout_grid.cpp +374 -0
- package/runtime/ext_gui/media.cpp +32 -0
- package/runtime/ext_gui/media.h +14 -1
- package/runtime/ext_gui/media_api.h +25 -2
- package/runtime/ext_gui/media_query.cpp +211 -0
- package/runtime/ext_gui/paint.cpp +111 -77
- package/runtime/ext_gui/paint.h +33 -3
- package/runtime/ext_gui/paint_background.cpp +229 -0
- package/runtime/ext_gui/paint_clip.cpp +268 -0
- package/runtime/ext_gui/paint_effects.cpp +324 -0
- package/runtime/ext_gui/paint_internal.h +85 -0
- package/runtime/ext_gui/renderer.cpp +8 -31
- package/runtime/ext_gui/renderer_clip.cpp +196 -0
- package/runtime/ext_gui/renderer_image.cpp +13 -8
- package/runtime/ext_gui/renderer_internal.h +15 -8
- package/runtime/ext_gui/renderer_text.cpp +6 -31
- package/runtime/ext_gui/style.cpp +343 -20
- package/runtime/ext_gui/style.h +144 -3
- package/runtime/ext_gui/style_print.cpp +134 -1
- package/runtime/ext_gui/style_values.cpp +152 -126
- package/runtime/ext_gui/style_values_internal.h +35 -0
- package/runtime/ext_gui/webgl.h +600 -0
- package/runtime/ext_gui/webgl2_constants.h +274 -0
- package/runtime/ext_gui/webgl_blit.cpp +95 -0
- package/runtime/ext_gui/webgl_buffer.cpp +480 -0
- package/runtime/ext_gui/webgl_buffer_objects.cpp +270 -0
- package/runtime/ext_gui/webgl_clear.cpp +142 -0
- package/runtime/ext_gui/webgl_compressed.cpp +180 -0
- package/runtime/ext_gui/webgl_constants.h +317 -0
- package/runtime/ext_gui/webgl_context.cpp +551 -0
- package/runtime/ext_gui/webgl_draw.cpp +560 -0
- package/runtime/ext_gui/webgl_draw_buffers.cpp +75 -0
- package/runtime/ext_gui/webgl_glsl.h +165 -0
- package/runtime/ext_gui/webgl_glsl_compile.cpp +437 -0
- package/runtime/ext_gui/webgl_glsl_rewrite.cpp +367 -0
- package/runtime/ext_gui/webgl_glsl_scan.cpp +590 -0
- package/runtime/ext_gui/webgl_glsl_scan_block.cpp +126 -0
- package/runtime/ext_gui/webgl_glsl_tokens.h +28 -0
- package/runtime/ext_gui/webgl_msl.cpp +62 -0
- package/runtime/ext_gui/webgl_msl.h +33 -0
- package/runtime/ext_gui/webgl_pipeline.cpp +326 -0
- package/runtime/ext_gui/webgl_program_blocks.cpp +58 -0
- package/runtime/ext_gui/webgl_program_internal.h +24 -0
- package/runtime/ext_gui/webgl_shader.cpp +594 -0
- package/runtime/ext_gui/webgl_state.cpp +228 -0
- package/runtime/ext_gui/webgl_texture.cpp +420 -0
- package/runtime/ext_gui/webgl_texture_3d.cpp +215 -0
- package/runtime/ext_gui/webgl_uniform.cpp +167 -0
- package/runtime/ext_gui/webgl_uniform_block.h +31 -0
- package/runtime/ext_gui/webgl_webgl2.cpp +277 -0
- package/runtime/ext_media/decode_audio.cpp +308 -0
- package/runtime/ext_media/media.cpp +1 -1
- package/runtime/ext_media/media_bridge.c +11 -3
- package/runtime/rt.h +17 -0
- package/runtime/rt_internal.h +1 -0
- package/runtime/xt_array_buffer.c +30 -0
- package/runtime/xt_containers/access.inc +8 -0
- package/runtime/xt_regex/api.inc +2 -0
- package/runtime/xt_regex/matcher.inc +16 -3
- package/runtime/xt_regex/parser.inc +8 -2
- package/runtime/xt_regex/types.inc +3 -0
- package/runtime/xt_stdlib2/regexp-match.inc +60 -21
- package/runtime/xt_stdlib2/regexp.inc +1 -0
- package/runtime/xt_typed_array/elements.inc +13 -0
- package/runtime/xt_typed_array.c +1 -1
- package/scripts/build-gui.ts +90 -3
- package/scripts/build-media.ts +335 -62
- package/scripts/build-runtime.ts +21 -16
- package/scripts/check-version.ts +39 -9
- package/scripts/package-platform.ts +183 -0
- package/scripts/set-platform-version.ts +62 -0
- package/scripts/setup-vs-toolchain.ps1 +152 -0
- package/scripts/verify-platform-package.ts +182 -0
- package/src/binder/references.ts +13 -1
- package/src/cli/main.ts +5 -1
- package/src/codegen/generator/module.ts +50 -0
- package/src/codegen/generator/statements/variables.ts +6 -3
- package/src/driver/runtime-lib.ts +73 -9
- package/src/driver/version.ts +1 -1
- package/src/extensions/gui/css.ts +113 -0
- package/src/extensions/gui/html.ts +9 -2
- package/src/extensions/gui/index.ts +22 -7
- package/src/extensions/gui/three.ts +25 -0
- package/src/extensions/media/index.ts +16 -18
- package/src/parser/context.ts +99 -4
- package/src/parser/literals.ts +6 -12
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end tests for Web Audio in the `gui` extension.
|
|
3
|
+
*
|
|
4
|
+
* The context is created with the private `{ __offline: true }` option, which
|
|
5
|
+
* keeps SDL out of the test and makes `ctx.__render(frames)` return the mixed
|
|
6
|
+
* audio synchronously. That is the same graph and renderer the SDL callback
|
|
7
|
+
* drives, so these tests pin the DSP (sources, gain, AudioParam automation,
|
|
8
|
+
* mixing) without needing an audio device.
|
|
9
|
+
*
|
|
10
|
+
* `decodeAudioData` is exercised with a WAV generated inside the program, both
|
|
11
|
+
* to prove the in-engine decoder and to feed a decoded buffer back into the
|
|
12
|
+
* mixer.
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
18
|
+
import { findRuntimeLibrary } from "../../src/driver/runtime-lib.js";
|
|
19
|
+
import { mediaExtension } from "../../src/extensions/media/index.js";
|
|
20
|
+
import { nodeExtension } from "../../src/extensions/node/index.js";
|
|
21
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
22
|
+
const harness = createGuiHarness();
|
|
23
|
+
/* A 20 ms 440 Hz Ogg/Vorbis tone. The engine's WAV decoder rejects it, so the
|
|
24
|
+
* test exercises the FFmpeg memory decoder behind the optional media extension.
|
|
25
|
+
* Stored as base64 because the test work directory only takes text files. */
|
|
26
|
+
const fixtureDir = join(dirname(fileURLToPath(import.meta.url)), "fixtures");
|
|
27
|
+
const oggFixture = join(fixtureDir, "tiny-ogg.b64");
|
|
28
|
+
const OGG_BASE64 = existsSync(oggFixture) ? readFileSync(oggFixture, "utf8").trim() : "";
|
|
29
|
+
const mediaAvailable = findRuntimeLibrary("media") !== undefined;
|
|
30
|
+
const WAV_HELPERS = `
|
|
31
|
+
function makeWav(samples: number[]): ArrayBuffer {
|
|
32
|
+
const frames = samples.length;
|
|
33
|
+
const dataBytes = frames * 2;
|
|
34
|
+
const buffer = new ArrayBuffer(44 + dataBytes);
|
|
35
|
+
const bytes = new Uint8Array(buffer);
|
|
36
|
+
const view = new DataView(buffer);
|
|
37
|
+
const tag = (offset: number, text: string): void => {
|
|
38
|
+
for (let i = 0; i < text.length; i++) bytes[offset + i] = text.charCodeAt(i);
|
|
39
|
+
};
|
|
40
|
+
tag(0, "RIFF");
|
|
41
|
+
view.setUint32(4, 36 + dataBytes, true);
|
|
42
|
+
tag(8, "WAVE");
|
|
43
|
+
tag(12, "fmt ");
|
|
44
|
+
view.setUint32(16, 16, true);
|
|
45
|
+
view.setUint16(20, 1, true); // PCM
|
|
46
|
+
view.setUint16(22, 1, true); // mono
|
|
47
|
+
view.setUint32(24, 48000, true); // sample rate
|
|
48
|
+
view.setUint32(28, 96000, true); // byte rate
|
|
49
|
+
view.setUint16(32, 2, true); // block align
|
|
50
|
+
view.setUint16(34, 16, true); // bits per sample
|
|
51
|
+
tag(36, "data");
|
|
52
|
+
view.setUint32(40, dataBytes, true);
|
|
53
|
+
for (let i = 0; i < frames; i++) {
|
|
54
|
+
view.setInt16(44 + i * 2, Math.round(samples[i] * 32767), true);
|
|
55
|
+
}
|
|
56
|
+
return buffer;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
describe.skipIf(!guiAvailable)("gui extension — Web Audio", () => {
|
|
60
|
+
beforeAll(() => harness.setup());
|
|
61
|
+
afterAll(() => harness.cleanup());
|
|
62
|
+
it("exposes the standard AudioContext surface", () => {
|
|
63
|
+
const { value } = harness.compileAndRun("audio-surface", `
|
|
64
|
+
async function main(): Promise<void> {
|
|
65
|
+
const ctx = new AudioContext({ __offline: true });
|
|
66
|
+
const factories = ["createGain", "createOscillator", "createBufferSource",
|
|
67
|
+
"createBiquadFilter", "createDynamicsCompressor", "createStereoPanner",
|
|
68
|
+
"createConstantSource", "createDelay", "createBuffer", "decodeAudioData",
|
|
69
|
+
"resume", "suspend", "close"];
|
|
70
|
+
let present = 0;
|
|
71
|
+
for (const name of factories) if (typeof ctx[name] === "function") present += 1;
|
|
72
|
+
console.log("api=" + ctx.sampleRate + ":" + ctx.state + ":" +
|
|
73
|
+
(ctx.destination != null) + ":" + present + "/" + factories.length);
|
|
74
|
+
|
|
75
|
+
const gain = ctx.createGain();
|
|
76
|
+
const methods = ["setValueAtTime", "linearRampToValueAtTime",
|
|
77
|
+
"exponentialRampToValueAtTime", "setTargetAtTime",
|
|
78
|
+
"cancelScheduledValues", "cancelAndHoldAtTime"];
|
|
79
|
+
let paramMethods = 0;
|
|
80
|
+
for (const name of methods) if (typeof gain.gain[name] === "function") paramMethods += 1;
|
|
81
|
+
console.log("param=" + gain.gain.value + ":" + gain.gain.defaultValue + ":" +
|
|
82
|
+
paramMethods + "/" + methods.length + ":" + (typeof gain.connect) + ":" +
|
|
83
|
+
(typeof gain.disconnect) + ":" + (typeof gain.start) + ":" + (typeof gain.stop));
|
|
84
|
+
|
|
85
|
+
const before = ctx.currentTime;
|
|
86
|
+
await ctx.suspend();
|
|
87
|
+
console.log("suspend=" + ctx.state);
|
|
88
|
+
await ctx.resume();
|
|
89
|
+
console.log("resume=" + ctx.state);
|
|
90
|
+
await ctx.close();
|
|
91
|
+
console.log("close=" + ctx.state + ":" + (ctx.currentTime === before));
|
|
92
|
+
}
|
|
93
|
+
main();
|
|
94
|
+
`, { console: true });
|
|
95
|
+
expect(value("api")).toBe("48000:running:true:13/13");
|
|
96
|
+
expect(value("param")).toBe("1:1:6/6:function:function:function:function");
|
|
97
|
+
expect(value("suspend")).toBe("suspended");
|
|
98
|
+
expect(value("resume")).toBe("running");
|
|
99
|
+
expect(value("close")).toBe("closed:true");
|
|
100
|
+
});
|
|
101
|
+
it("renders constant sources, stereo panners and delays", () => {
|
|
102
|
+
const { value } = harness.compileAndRun("audio-nodes", `
|
|
103
|
+
const ctx = new AudioContext({ __offline: true });
|
|
104
|
+
const constant = ctx.createConstantSource();
|
|
105
|
+
constant.offset.value = 0.5;
|
|
106
|
+
constant.connect(ctx.destination);
|
|
107
|
+
constant.start();
|
|
108
|
+
const body = ctx.__render(4);
|
|
109
|
+
console.log("constant=" + body[0].toFixed(3) + ":" + body[1].toFixed(3));
|
|
110
|
+
|
|
111
|
+
const panned = new AudioContext({ __offline: true });
|
|
112
|
+
const left = panned.createConstantSource();
|
|
113
|
+
left.offset.value = 0.5;
|
|
114
|
+
const panner = panned.createStereoPanner();
|
|
115
|
+
panner.pan.value = -1;
|
|
116
|
+
left.connect(panner);
|
|
117
|
+
panner.connect(panned.destination);
|
|
118
|
+
left.start();
|
|
119
|
+
const pan = panned.__render(4);
|
|
120
|
+
console.log("panner=" + pan[0].toFixed(3) + ":" + pan[1].toFixed(3));
|
|
121
|
+
|
|
122
|
+
const delayed = new AudioContext({ __offline: true });
|
|
123
|
+
const source = delayed.createConstantSource();
|
|
124
|
+
source.offset.value = 0.5;
|
|
125
|
+
const delay = delayed.createDelay(1);
|
|
126
|
+
delay.delayTime.value = 1 / 48000;
|
|
127
|
+
source.connect(delay);
|
|
128
|
+
delay.connect(delayed.destination);
|
|
129
|
+
source.start();
|
|
130
|
+
const echo = delayed.__render(8);
|
|
131
|
+
console.log("delay=" + echo[0].toFixed(3) + ":" + echo[2].toFixed(3));
|
|
132
|
+
`, { console: true });
|
|
133
|
+
expect(value("constant")).toBe("0.500:0.500");
|
|
134
|
+
expect(value("panner")).toBe("0.500:0.000");
|
|
135
|
+
expect(value("delay")).toBe("0.000:0.500");
|
|
136
|
+
});
|
|
137
|
+
it("decodes a WAV into a real AudioBuffer", () => {
|
|
138
|
+
const { value } = harness.compileAndRun("audio-decode", `
|
|
139
|
+
${WAV_HELPERS}
|
|
140
|
+
|
|
141
|
+
async function main(): Promise<void> {
|
|
142
|
+
const ctx = new AudioContext({ __offline: true });
|
|
143
|
+
const decoded = await ctx.decodeAudioData(makeWav([0.5, -0.5, 0.25, 0.25]));
|
|
144
|
+
const channel = decoded.getChannelData(0);
|
|
145
|
+
console.log("format=" + decoded.numberOfChannels + ":" + decoded.length + ":" +
|
|
146
|
+
decoded.sampleRate + ":" + Math.round(decoded.duration * 48000));
|
|
147
|
+
console.log("samples=" + channel[0].toFixed(3) + "," + channel[1].toFixed(3) +
|
|
148
|
+
"," + channel[2].toFixed(3));
|
|
149
|
+
console.log("channel=" + (channel instanceof Float32Array) + ":" + channel.length);
|
|
150
|
+
|
|
151
|
+
// A typed-array view (not just a bare ArrayBuffer) is accepted too.
|
|
152
|
+
const view = new Uint8Array(makeWav([0.5, -0.5, 0.25, 0.25]));
|
|
153
|
+
const fromView = await ctx.decodeAudioData(view);
|
|
154
|
+
console.log("view=" + fromView.length + ":" +
|
|
155
|
+
fromView.getChannelData(0)[0].toFixed(3));
|
|
156
|
+
}
|
|
157
|
+
main();
|
|
158
|
+
`, { console: true });
|
|
159
|
+
expect(value("format")).toBe("1:4:48000:4");
|
|
160
|
+
expect(value("samples")).toBe("0.500,-0.500,0.250");
|
|
161
|
+
expect(value("channel")).toBe("true:4");
|
|
162
|
+
expect(value("view")).toBe("4:0.500");
|
|
163
|
+
});
|
|
164
|
+
it("mixes sources and a gain into the destination", () => {
|
|
165
|
+
const { value } = harness.compileAndRun("audio-mix", `
|
|
166
|
+
function constantSource(ctx: any, value: number): any {
|
|
167
|
+
const buffer = ctx.createBuffer(1, 256, 48000);
|
|
168
|
+
const data = buffer.getChannelData(0);
|
|
169
|
+
for (let i = 0; i < data.length; i++) data[i] = value;
|
|
170
|
+
const source = ctx.createBufferSource();
|
|
171
|
+
source.buffer = buffer;
|
|
172
|
+
return source;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// One source through a gain: 0.5 * 0.25 = 0.125 in both channels.
|
|
176
|
+
const ctx = new AudioContext({ __offline: true });
|
|
177
|
+
const source = constantSource(ctx, 0.5);
|
|
178
|
+
const gain = ctx.createGain();
|
|
179
|
+
gain.gain.value = 0.25;
|
|
180
|
+
source.connect(gain);
|
|
181
|
+
gain.connect(ctx.destination);
|
|
182
|
+
source.start(0);
|
|
183
|
+
const soft = ctx.__render(64);
|
|
184
|
+
console.log("gain=" + soft.length + ":" + soft[0].toFixed(3) + ":" +
|
|
185
|
+
soft[1].toFixed(3) + ":" + soft[126].toFixed(3));
|
|
186
|
+
|
|
187
|
+
// Two sources sum at the destination: 0.5 + 0.5 = 1.0.
|
|
188
|
+
const sum = new AudioContext({ __offline: true });
|
|
189
|
+
const first = constantSource(sum, 0.5);
|
|
190
|
+
first.connect(sum.destination);
|
|
191
|
+
first.start(0);
|
|
192
|
+
const second = constantSource(sum, 0.5);
|
|
193
|
+
second.connect(sum.destination);
|
|
194
|
+
second.start(0);
|
|
195
|
+
const both = sum.__render(8);
|
|
196
|
+
console.log("sum=" + both[0].toFixed(3) + ":" + both[14].toFixed(3));
|
|
197
|
+
|
|
198
|
+
// Stereo buffer: left 0.5, right -0.25.
|
|
199
|
+
const stereo = new AudioContext({ __offline: true });
|
|
200
|
+
const buffer = stereo.createBuffer(2, 64, 48000);
|
|
201
|
+
const left = buffer.getChannelData(0);
|
|
202
|
+
const right = buffer.getChannelData(1);
|
|
203
|
+
for (let i = 0; i < left.length; i++) { left[i] = 0.5; right[i] = -0.25; }
|
|
204
|
+
const player = stereo.createBufferSource();
|
|
205
|
+
player.buffer = buffer;
|
|
206
|
+
player.connect(stereo.destination);
|
|
207
|
+
player.start(0);
|
|
208
|
+
const channels = stereo.__render(4);
|
|
209
|
+
console.log("stereo=" + channels[0].toFixed(3) + ":" + channels[1].toFixed(3));
|
|
210
|
+
`, { console: true });
|
|
211
|
+
expect(value("gain")).toBe("128:0.125:0.125:0.125");
|
|
212
|
+
expect(value("sum")).toBe("1.000:1.000");
|
|
213
|
+
expect(value("stereo")).toBe("0.500:-0.250");
|
|
214
|
+
});
|
|
215
|
+
it("renders oscillator waveforms and AudioParam automation", () => {
|
|
216
|
+
const { value } = harness.compileAndRun("audio-params", `
|
|
217
|
+
// A 480 Hz sine at 48 kHz advances by 1/100 of a cycle per frame.
|
|
218
|
+
const ctx = new AudioContext({ __offline: true });
|
|
219
|
+
const osc = ctx.createOscillator();
|
|
220
|
+
osc.type = "sine";
|
|
221
|
+
osc.frequency.value = 480;
|
|
222
|
+
osc.connect(ctx.destination);
|
|
223
|
+
osc.start();
|
|
224
|
+
const sine = ctx.__render(4);
|
|
225
|
+
console.log("sine=" + sine[0].toFixed(4) + ":" + sine[2].toFixed(4) + ":" +
|
|
226
|
+
sine[4].toFixed(4) + ":" + sine[6].toFixed(4));
|
|
227
|
+
|
|
228
|
+
// A linear ramp from 0 to 1 over 48 frames, on a constant 0.5 source.
|
|
229
|
+
const rampCtx = new AudioContext({ __offline: true });
|
|
230
|
+
const buffer = rampCtx.createBuffer(1, 128, 48000);
|
|
231
|
+
const data = buffer.getChannelData(0);
|
|
232
|
+
for (let i = 0; i < data.length; i++) data[i] = 0.5;
|
|
233
|
+
const source = rampCtx.createBufferSource();
|
|
234
|
+
source.buffer = buffer;
|
|
235
|
+
const gain = rampCtx.createGain();
|
|
236
|
+
gain.gain.setValueAtTime(0, 0);
|
|
237
|
+
gain.gain.linearRampToValueAtTime(1, 48 / 48000);
|
|
238
|
+
source.connect(gain);
|
|
239
|
+
gain.connect(rampCtx.destination);
|
|
240
|
+
source.start(0);
|
|
241
|
+
const ramp = rampCtx.__render(64);
|
|
242
|
+
console.log("ramp=" + ramp[0].toFixed(3) + ":" + ramp[96].toFixed(3) + ":" +
|
|
243
|
+
ramp[126].toFixed(3));
|
|
244
|
+
|
|
245
|
+
// currentTime follows the rendered quanta (128-frame granularity).
|
|
246
|
+
console.log("clock=" + rampCtx.currentTime.toFixed(4));
|
|
247
|
+
`, { console: true });
|
|
248
|
+
expect(value("sine")).toBe("0.0000:0.0628:0.1253:0.1874");
|
|
249
|
+
expect(value("ramp")).toBe("0.000:0.500:0.500");
|
|
250
|
+
expect(value("clock")).toBe("0.0027");
|
|
251
|
+
});
|
|
252
|
+
it.skipIf(!mediaAvailable || OGG_BASE64.length === 0)("decodes compressed audio through the media extension", () => {
|
|
253
|
+
const { value } = harness.compileAndRun("audio-media", `
|
|
254
|
+
import { Buffer } from "buffer";
|
|
255
|
+
|
|
256
|
+
const OGG = ${JSON.stringify(OGG_BASE64)};
|
|
257
|
+
|
|
258
|
+
async function main(): Promise<void> {
|
|
259
|
+
const data: any = Buffer.from(OGG, "base64");
|
|
260
|
+
const ctx: any = new AudioContext({ __offline: true });
|
|
261
|
+
const decoded: any = await ctx.decodeAudioData(data);
|
|
262
|
+
console.log("bytes=" + data.length);
|
|
263
|
+
console.log("ogg=" + decoded.numberOfChannels + ":" + decoded.sampleRate + ":" +
|
|
264
|
+
(decoded.length > 50));
|
|
265
|
+
}
|
|
266
|
+
main();
|
|
267
|
+
`, { extensions: [mediaExtension, nodeExtension], console: true });
|
|
268
|
+
expect(value("bytes")).toBe("2707");
|
|
269
|
+
expect(value("ogg")).toBe("1:48000:true");
|
|
270
|
+
});
|
|
271
|
+
it("rejects bytes that are not a supported audio file", () => {
|
|
272
|
+
const { value } = harness.compileAndRun("audio-error", `
|
|
273
|
+
async function main(): Promise<void> {
|
|
274
|
+
const ctx = new AudioContext({ __offline: true });
|
|
275
|
+
try {
|
|
276
|
+
await ctx.decodeAudioData(new ArrayBuffer(16));
|
|
277
|
+
console.log("error=none");
|
|
278
|
+
} catch (e: any) {
|
|
279
|
+
console.log("error=" + e.name + ":" + (e.message.indexOf("decode") >= 0));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
main();
|
|
283
|
+
`, { console: true });
|
|
284
|
+
expect(value("error")).toBe("EncodingError:true");
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
//# sourceMappingURL=gui-audio.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-audio.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-audio.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC;;6EAE6E;AAC7E,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,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AAI,EAAE,CAC/D,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;IAEF,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,aAAa,CACrC,aAAa,EACb;;;;;;;;;;;OAWC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -74,7 +74,7 @@ describe.skipIf(!guiAvailable)("gui extension — browser globals", () => {
|
|
|
74
74
|
expect(value("pending")).toBe("true");
|
|
75
75
|
expect(value("audio")).toBe("48000:running:0.5");
|
|
76
76
|
expect(value("buffer")).toBe("8:0.25:1");
|
|
77
|
-
expect(value("webgl")).toBe("
|
|
77
|
+
expect(value("webgl")).toBe("function");
|
|
78
78
|
expect(value("adopt")).toBe("true:true");
|
|
79
79
|
expect(value("bound")).toBe("hi:hi");
|
|
80
80
|
expect(value("title")).toBe("ropes page:complete:false");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gui-browser.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-browser.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAE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,GAAG,GAAG,OAAO,CAAC,aAAa,CAC/B,UAAU,EACV;;;;;;;;;;;;;;;;;OAiBC,EACD,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;QAEF,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;QACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end tests for the `gui` extension — CSS decorative effects:
|
|
3
|
+
* `@media`, generated content, background layers, `text-shadow`, `clip-path`
|
|
4
|
+
* and `filter`.
|
|
5
|
+
*/
|
|
6
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
8
|
+
const harness = createGuiHarness();
|
|
9
|
+
describe.skipIf(!guiAvailable)("gui extension — effects", () => {
|
|
10
|
+
beforeAll(() => harness.setup());
|
|
11
|
+
afterAll(() => harness.cleanup());
|
|
12
|
+
it("applies @media rules against the viewport and skips @media print", () => {
|
|
13
|
+
const { value } = harness.compileAndRun("media", `
|
|
14
|
+
import { createWindow, run } from "gui";
|
|
15
|
+
|
|
16
|
+
const HTML = \`
|
|
17
|
+
<html><head><style>
|
|
18
|
+
body { margin: 0; }
|
|
19
|
+
#a { width: 10px; height: 10px; background: #111111; }
|
|
20
|
+
@media (min-width: 600px) { #a { background: #ff0000; } }
|
|
21
|
+
@media (max-width: 500px) { #a { background: #00ff00; } }
|
|
22
|
+
@media (orientation: landscape) { #b { color: #0000ff; } }
|
|
23
|
+
@media print { #a { background: #000000; } }
|
|
24
|
+
@media (min-width: 1000px) { #a { background: #ffff00; } }
|
|
25
|
+
@media screen and (min-width: 100px) and (max-width: 900px) {
|
|
26
|
+
#c { color: #00ff00; }
|
|
27
|
+
}
|
|
28
|
+
</style></head><body>
|
|
29
|
+
<div id="a"></div><div id="b">b</div><div id="c">c</div>
|
|
30
|
+
</body></html>
|
|
31
|
+
\`;
|
|
32
|
+
|
|
33
|
+
const win = createWindow({ title: "media", width: 800, height: 600 });
|
|
34
|
+
win.on("ready", () => {
|
|
35
|
+
console.log("a=" + win.computedStyle("#a", "background-color"));
|
|
36
|
+
console.log("b=" + win.computedStyle("#b", "color"));
|
|
37
|
+
console.log("c=" + win.computedStyle("#c", "color"));
|
|
38
|
+
console.log("mq=" + win.matchMedia("(min-width: 600px)").matches);
|
|
39
|
+
win.close();
|
|
40
|
+
});
|
|
41
|
+
win.loadHTML(HTML);
|
|
42
|
+
run();
|
|
43
|
+
`);
|
|
44
|
+
// 800x600 matches min-width:600px but not max-width:500px/1000px/print.
|
|
45
|
+
expect(value("a")).toBe("rgb(255, 0, 0)");
|
|
46
|
+
expect(value("b")).toBe("rgb(0, 0, 255)");
|
|
47
|
+
expect(value("c")).toBe("rgb(0, 255, 0)");
|
|
48
|
+
expect(value("mq")).toBe("true");
|
|
49
|
+
});
|
|
50
|
+
it("generates ::before/::after boxes with content and places them in flow", () => {
|
|
51
|
+
const { value, stdout } = harness.compileAndRun("pseudo", `
|
|
52
|
+
import { createWindow, run } from "gui";
|
|
53
|
+
|
|
54
|
+
const HTML = \`
|
|
55
|
+
<html><head><style>
|
|
56
|
+
body { margin: 0; }
|
|
57
|
+
#card { position: relative; width: 120px; height: 30px; background: #202020; color: #ffffff; }
|
|
58
|
+
#card::before {
|
|
59
|
+
content: "B"; display: inline-block; width: 10px; height: 10px;
|
|
60
|
+
background: #00ff00; color: #ff0000;
|
|
61
|
+
}
|
|
62
|
+
#card::after { content: attr(data-tail); color: #0000ff; }
|
|
63
|
+
#none::before { content: none; }
|
|
64
|
+
</style></head><body>
|
|
65
|
+
<div id="card" data-tail="tail">card</div>
|
|
66
|
+
<div id="none">x</div>
|
|
67
|
+
</body></html>
|
|
68
|
+
\`;
|
|
69
|
+
|
|
70
|
+
const win = createWindow({ title: "pseudo", width: 400, height: 300 });
|
|
71
|
+
win.on("ready", () => {
|
|
72
|
+
console.log("count=" + win.paintCount());
|
|
73
|
+
console.log("children=" + win.queryCount("#card > *"));
|
|
74
|
+
console.log("list-start");
|
|
75
|
+
console.log(win.paintList());
|
|
76
|
+
console.log("list-end");
|
|
77
|
+
win.close();
|
|
78
|
+
});
|
|
79
|
+
win.loadHTML(HTML);
|
|
80
|
+
run();
|
|
81
|
+
`);
|
|
82
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
83
|
+
// The synthetic nodes never appear in DOM traversal.
|
|
84
|
+
expect(value("children")).toBe("0");
|
|
85
|
+
// Generated text and the inline-block pseudo background are painted.
|
|
86
|
+
expect(list).toContain('"B"');
|
|
87
|
+
expect(list).toContain('"tail"');
|
|
88
|
+
expect(list).toContain("#00ff00ff");
|
|
89
|
+
// `content: none` generates no box: no colour of its own.
|
|
90
|
+
expect(list).not.toContain("#ffff00ff");
|
|
91
|
+
// The before box comes before the card's own text, the after box after it.
|
|
92
|
+
const before = list.indexOf('"B"');
|
|
93
|
+
const own = list.indexOf('"card"');
|
|
94
|
+
const after = list.indexOf('"tail"');
|
|
95
|
+
expect(before).toBeGreaterThanOrEqual(0);
|
|
96
|
+
expect(own).toBeGreaterThan(before);
|
|
97
|
+
expect(after).toBeGreaterThan(own);
|
|
98
|
+
// `paintCount` counts rectangles: the card's background and ::before's.
|
|
99
|
+
expect(Number(value("count"))).toBe(2);
|
|
100
|
+
});
|
|
101
|
+
it("paints multi-layer linear/radial backgrounds bottom-to-top", () => {
|
|
102
|
+
const { value, stdout } = harness.compileAndRun("backgrounds", `
|
|
103
|
+
import { createWindow, run } from "gui";
|
|
104
|
+
|
|
105
|
+
const HTML = \`
|
|
106
|
+
<html><head><style>
|
|
107
|
+
body { margin: 0; }
|
|
108
|
+
#g {
|
|
109
|
+
width: 100px; height: 60px;
|
|
110
|
+
background-color: #000000;
|
|
111
|
+
background-image:
|
|
112
|
+
radial-gradient(circle at 50% 50%, #ff0000, #00ff00),
|
|
113
|
+
linear-gradient(180deg, #0000ff, #000000);
|
|
114
|
+
}
|
|
115
|
+
</style></head><body><div id="g"></div></body></html>
|
|
116
|
+
\`;
|
|
117
|
+
|
|
118
|
+
const win = createWindow({ title: "backgrounds", width: 400, height: 300 });
|
|
119
|
+
win.on("ready", () => {
|
|
120
|
+
console.log("image=" + win.computedStyle("#g", "background-image"));
|
|
121
|
+
console.log("count=" + win.paintCount());
|
|
122
|
+
console.log("list-start");
|
|
123
|
+
console.log(win.paintList());
|
|
124
|
+
console.log("list-end");
|
|
125
|
+
win.close();
|
|
126
|
+
});
|
|
127
|
+
win.loadHTML(HTML);
|
|
128
|
+
run();
|
|
129
|
+
`);
|
|
130
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
131
|
+
expect(value("image")).toContain("radial-gradient()");
|
|
132
|
+
expect(value("image")).toContain("linear-gradient()");
|
|
133
|
+
// Both layers are painted: the red radial core and its green outer ring
|
|
134
|
+
// (the linear blue layer is underneath them).
|
|
135
|
+
expect(list).toContain("#ff0000ff");
|
|
136
|
+
expect(list).toContain("#00ff00ff");
|
|
137
|
+
expect(list).toMatch(/#0000[0-9a-f]{2}ff/);
|
|
138
|
+
// Radial bands plus the linear strips.
|
|
139
|
+
expect(Number(value("count"))).toBeGreaterThan(30);
|
|
140
|
+
});
|
|
141
|
+
it("paints text-shadow copies behind the text", () => {
|
|
142
|
+
const { value, stdout } = harness.compileAndRun("text-shadow", `
|
|
143
|
+
import { createWindow, run } from "gui";
|
|
144
|
+
|
|
145
|
+
const HTML = \`
|
|
146
|
+
<html><head><style>
|
|
147
|
+
body { margin: 0; }
|
|
148
|
+
#t { font-size: 20px; color: #ffffff; text-shadow: 2px 3px 0 #ff0000; }
|
|
149
|
+
</style></head><body><div id="t">Hi</div></body></html>
|
|
150
|
+
\`;
|
|
151
|
+
|
|
152
|
+
const win = createWindow({ title: "text-shadow", width: 400, height: 300 });
|
|
153
|
+
win.on("ready", () => {
|
|
154
|
+
console.log("shadow=" + win.computedStyle("#t", "text-shadow"));
|
|
155
|
+
console.log("list-start");
|
|
156
|
+
console.log(win.paintList());
|
|
157
|
+
console.log("list-end");
|
|
158
|
+
win.close();
|
|
159
|
+
});
|
|
160
|
+
win.loadHTML(HTML);
|
|
161
|
+
run();
|
|
162
|
+
`);
|
|
163
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
164
|
+
expect(value("shadow")).toBe("2px 3px rgb(255, 0, 0)");
|
|
165
|
+
expect(list).toContain('text x=2.0 baseline=');
|
|
166
|
+
expect(list).toContain('color=#ff0000ff "Hi" shadow=1');
|
|
167
|
+
// The main run is still painted in the text colour.
|
|
168
|
+
expect(list).toContain('color=#ffffffff "Hi"');
|
|
169
|
+
});
|
|
170
|
+
it("clips boxes and descendants with clip-path", () => {
|
|
171
|
+
const { value, stdout } = harness.compileAndRun("clip-path", `
|
|
172
|
+
import { createWindow, run } from "gui";
|
|
173
|
+
|
|
174
|
+
const HTML = \`
|
|
175
|
+
<html><head><style>
|
|
176
|
+
body { margin: 0; }
|
|
177
|
+
#c {
|
|
178
|
+
position: relative; width: 100px; height: 100px; background: #ff0000;
|
|
179
|
+
clip-path: inset(10px 20px 30px 40px);
|
|
180
|
+
}
|
|
181
|
+
#in { position: absolute; left: 0; top: 0; width: 20px; height: 20px; background: #0000ff; }
|
|
182
|
+
#p { width: 50px; height: 50px; background: #00ff00;
|
|
183
|
+
clip-path: polygon(50% 0, 100% 100%, 0 100%); }
|
|
184
|
+
</style></head><body>
|
|
185
|
+
<div id="c"><div id="in"></div></div>
|
|
186
|
+
<div id="p"></div>
|
|
187
|
+
</body></html>
|
|
188
|
+
\`;
|
|
189
|
+
|
|
190
|
+
const win = createWindow({ title: "clip", width: 400, height: 300 });
|
|
191
|
+
win.on("ready", () => {
|
|
192
|
+
console.log("inset=" + win.computedStyle("#c", "clip-path"));
|
|
193
|
+
console.log("polygon=" + win.computedStyle("#p", "clip-path"));
|
|
194
|
+
console.log("list-start");
|
|
195
|
+
console.log(win.paintList());
|
|
196
|
+
console.log("list-end");
|
|
197
|
+
win.close();
|
|
198
|
+
});
|
|
199
|
+
win.loadHTML(HTML);
|
|
200
|
+
run();
|
|
201
|
+
`);
|
|
202
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
203
|
+
expect(value("inset")).toBe("inset(10px 20px 30px 40px)");
|
|
204
|
+
expect(value("polygon")).toContain("polygon(");
|
|
205
|
+
expect(value("polygon")).toContain("50%");
|
|
206
|
+
expect(value("polygon")).toContain("100%");
|
|
207
|
+
// Both the clipped box and its child carry the resolved path index.
|
|
208
|
+
expect(list).toContain("clip-path=0");
|
|
209
|
+
expect(list).toContain("#ff0000ff");
|
|
210
|
+
expect(list).toContain("#0000ffff");
|
|
211
|
+
});
|
|
212
|
+
it("applies colour filters and approximates blur/drop-shadow", () => {
|
|
213
|
+
const { value, stdout } = harness.compileAndRun("filter", `
|
|
214
|
+
import { createWindow, run } from "gui";
|
|
215
|
+
|
|
216
|
+
const HTML = \`
|
|
217
|
+
<html><head><style>
|
|
218
|
+
body { margin: 0; }
|
|
219
|
+
#grey { width: 100px; height: 50px; background: #ff0000;
|
|
220
|
+
filter: grayscale(1) brightness(1.2); }
|
|
221
|
+
#dim { width: 10px; height: 10px; background: #ffffff; filter: opacity(0.5); }
|
|
222
|
+
#soft { position: absolute; left: 0; top: 100px; width: 20px; height: 20px;
|
|
223
|
+
background: #00ff00; filter: blur(4px); }
|
|
224
|
+
#shadow { position: absolute; left: 200px; top: 0; width: 20px; height: 20px;
|
|
225
|
+
background: #0000ff; filter: drop-shadow(5px 5px 0 #000000); }
|
|
226
|
+
#glass { position: absolute; left: 250px; top: 0; width: 20px; height: 20px;
|
|
227
|
+
backdrop-filter: blur(4px) brightness(0.5); }
|
|
228
|
+
</style></head><body>
|
|
229
|
+
<div id="grey"></div><div id="dim"></div><div id="soft"></div><div id="shadow"></div>
|
|
230
|
+
<div id="glass"></div>
|
|
231
|
+
</body></html>
|
|
232
|
+
\`;
|
|
233
|
+
|
|
234
|
+
const win = createWindow({ title: "filter", width: 400, height: 300 });
|
|
235
|
+
win.on("ready", () => {
|
|
236
|
+
console.log("filter=" + win.computedStyle("#grey", "filter"));
|
|
237
|
+
console.log("backdrop=" + win.computedStyle("#glass", "backdrop-filter"));
|
|
238
|
+
console.log("count=" + win.paintCount());
|
|
239
|
+
console.log("list-start");
|
|
240
|
+
console.log(win.paintList());
|
|
241
|
+
console.log("list-end");
|
|
242
|
+
win.close();
|
|
243
|
+
});
|
|
244
|
+
win.loadHTML(HTML);
|
|
245
|
+
run();
|
|
246
|
+
`);
|
|
247
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
248
|
+
expect(value("filter")).toBe("grayscale(1) brightness(1.2)");
|
|
249
|
+
// `backdrop-filter` parses/cascades; it is not painted (no backdrop pass).
|
|
250
|
+
expect(value("backdrop")).toBe("blur(4px) brightness(0.5)");
|
|
251
|
+
// grayscale(red) = 0.2126, brightness 1.2 = 0.2551 -> #414141.
|
|
252
|
+
expect(list).toContain("#414141ff");
|
|
253
|
+
// opacity(0.5) halves the painted alpha.
|
|
254
|
+
expect(list).toContain("#ffffff80");
|
|
255
|
+
// blur(4px) spreads the green box into nine translucent copies.
|
|
256
|
+
expect(Number(value("count"))).toBeGreaterThan(9);
|
|
257
|
+
// drop-shadow paints a black rectangle behind the blue box.
|
|
258
|
+
expect(list).toContain("#000000ff");
|
|
259
|
+
expect(list).toContain("#0000ffff");
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
//# sourceMappingURL=gui-effects.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-effects.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-effects.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;AAEnC,QAAQ,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,yBAAyB,EAAE,GAAG,EAAE;IAC7D,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAElC,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,aAAa,CACrC,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BC,CACF,CAAC;QACF,wEAAwE;QACxE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAE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,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,CAC7C,QAAQ,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCC,CACF,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACpF,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC7D,2EAA2E;QAC3E,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC5D,+DAA+D;QAC/D,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACpC,yCAAyC;QACzC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACpC,gEAAgE;QAChE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAClD,4DAA4D;QAC5D,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end smoke test for `examples/gui/webgl-cube`.
|
|
3
|
+
*
|
|
4
|
+
* The scene (`scene.js`) is loaded by `index.html` as a classic script, so a
|
|
5
|
+
* browser runs the same document. The test compiles the native host, runs it
|
|
6
|
+
* with an auto-close guard, and checks the readback probes: the cube's faces
|
|
7
|
+
* are lit by the directional light and the whole frame is produced by WebGL on
|
|
8
|
+
* the GPU.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|