xbintsc 0.5.45 → 0.5.52
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/AGENTS.md +1 -1
- package/README.md +5 -4
- package/README.zh-CN.md +4 -3
- package/dist/src/cli/extensions.d.ts +24 -0
- package/dist/src/cli/extensions.js +62 -0
- package/dist/src/cli/extensions.js.map +1 -0
- package/dist/src/cli/help.d.ts +1 -1
- package/dist/src/cli/help.js +3 -1
- package/dist/src/cli/help.js.map +1 -1
- package/dist/src/cli/hints.js +8 -3
- package/dist/src/cli/hints.js.map +1 -1
- package/dist/src/cli/main.js +21 -28
- package/dist/src/cli/main.js.map +1 -1
- package/dist/src/diagnostics/diagnostic.d.ts +3 -1
- package/dist/src/diagnostics/diagnostic.js +2 -0
- package/dist/src/diagnostics/diagnostic.js.map +1 -1
- package/dist/src/driver/build-key.d.ts +2 -0
- package/dist/src/driver/build-key.js +1 -0
- package/dist/src/driver/build-key.js.map +1 -1
- package/dist/src/driver/compiler.js +61 -8
- package/dist/src/driver/compiler.js.map +1 -1
- package/dist/src/driver/config.d.ts +4 -0
- package/dist/src/driver/config.js +2 -0
- package/dist/src/driver/config.js.map +1 -1
- package/dist/src/driver/link-features.d.ts +37 -0
- package/dist/src/driver/link-features.js +123 -0
- package/dist/src/driver/link-features.js.map +1 -0
- package/dist/src/driver/options.d.ts +10 -0
- package/dist/src/driver/runtime-objects.d.ts +5 -0
- package/dist/src/driver/runtime-objects.js +20 -1
- package/dist/src/driver/runtime-objects.js.map +1 -1
- package/dist/src/driver/usage.d.ts +23 -0
- package/dist/src/driver/usage.js +353 -0
- package/dist/src/driver/usage.js.map +1 -0
- package/dist/src/driver/version.d.ts +1 -1
- package/dist/src/driver/version.js +1 -1
- package/dist/src/extensions/catalog.js +1 -2
- package/dist/src/extensions/catalog.js.map +1 -1
- package/dist/src/extensions/gui/features.d.ts +34 -0
- package/dist/src/extensions/gui/features.js +165 -0
- package/dist/src/extensions/gui/features.js.map +1 -0
- package/dist/src/extensions/gui/index.js +10 -4
- package/dist/src/extensions/gui/index.js.map +1 -1
- package/dist/src/extensions/link-feature.d.ts +70 -0
- package/dist/src/extensions/link-feature.js +18 -0
- package/dist/src/extensions/link-feature.js.map +1 -0
- package/dist/src/extensions/registry.d.ts +24 -4
- package/dist/src/extensions/registry.js +26 -3
- package/dist/src/extensions/registry.js.map +1 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/tests/cli/hints.test.js +5 -7
- package/dist/tests/cli/hints.test.js.map +1 -1
- package/dist/tests/driver/link-features.test.js +105 -0
- package/dist/tests/driver/link-features.test.js.map +1 -0
- package/dist/tests/driver/usage.test.d.ts +1 -0
- package/dist/tests/driver/usage.test.js +88 -0
- package/dist/tests/driver/usage.test.js.map +1 -0
- package/dist/tests/e2e/gui-audio.test.js +4 -4
- package/dist/tests/e2e/gui-audio.test.js.map +1 -1
- package/dist/tests/e2e/gui-css-coverage.test.d.ts +9 -0
- package/dist/tests/e2e/gui-css-coverage.test.js +333 -0
- package/dist/tests/e2e/gui-css-coverage.test.js.map +1 -0
- package/dist/tests/e2e/gui-css-features.test.d.ts +6 -0
- package/dist/tests/e2e/gui-css-features.test.js +270 -0
- package/dist/tests/e2e/gui-css-features.test.js.map +1 -0
- package/dist/tests/e2e/gui-effects.test.js +92 -11
- package/dist/tests/e2e/gui-effects.test.js.map +1 -1
- package/dist/tests/e2e/gui-feature-linking.test.d.ts +9 -0
- package/dist/tests/e2e/gui-feature-linking.test.js +68 -0
- package/dist/tests/e2e/gui-feature-linking.test.js.map +1 -0
- package/dist/tests/e2e/gui-font-face.test.d.ts +10 -0
- package/dist/tests/e2e/gui-font-face.test.js +142 -0
- package/dist/tests/e2e/gui-font-face.test.js.map +1 -0
- package/dist/tests/e2e/gui-fonts.test.d.ts +10 -0
- package/dist/tests/e2e/gui-fonts.test.js +150 -0
- package/dist/tests/e2e/gui-fonts.test.js.map +1 -0
- package/dist/tests/e2e/gui-helpers.d.ts +10 -1
- package/dist/tests/e2e/gui-helpers.js +6 -0
- package/dist/tests/e2e/gui-helpers.js.map +1 -1
- package/dist/tests/e2e/gui-layout.test.js +7 -3
- package/dist/tests/e2e/gui-layout.test.js.map +1 -1
- package/dist/tests/e2e/gui-media-disabled.test.d.ts +5 -4
- package/dist/tests/e2e/gui-media-disabled.test.js +7 -6
- package/dist/tests/e2e/gui-media-disabled.test.js.map +1 -1
- package/dist/tests/e2e/gui-media.test.d.ts +5 -4
- package/dist/tests/e2e/gui-media.test.js +9 -9
- package/dist/tests/e2e/gui-media.test.js.map +1 -1
- package/dist/tests/e2e/gui-paint.test.js +5 -2
- package/dist/tests/e2e/gui-paint.test.js.map +1 -1
- package/dist/tests/e2e/gui-shaping.test.d.ts +5 -0
- package/dist/tests/e2e/gui-shaping.test.js +47 -0
- package/dist/tests/e2e/gui-shaping.test.js.map +1 -0
- package/dist/tests/e2e/gui-track-sizing.test.d.ts +6 -0
- package/dist/tests/e2e/gui-track-sizing.test.js +173 -0
- package/dist/tests/e2e/gui-track-sizing.test.js.map +1 -0
- package/dist/tests/e2e/gui-transform.test.js +3 -2
- package/dist/tests/e2e/gui-transform.test.js.map +1 -1
- package/dist/tests/e2e/gui-webgl-pipeline-cache.test.d.ts +18 -0
- package/dist/tests/e2e/gui-webgl-pipeline-cache.test.js +120 -0
- package/dist/tests/e2e/gui-webgl-pipeline-cache.test.js.map +1 -0
- package/dist/tests/extensions/gui-features.test.d.ts +1 -0
- package/dist/tests/extensions/gui-features.test.js +175 -0
- package/dist/tests/extensions/gui-features.test.js.map +1 -0
- package/doc/ai/cli.md +5 -1
- package/doc/ai/extensions.md +56 -26
- package/doc/ai/troubleshooting.md +10 -7
- package/doc/ai/zh-CN/cli.md +5 -1
- package/doc/ai/zh-CN/extensions.md +48 -22
- package/doc/ai/zh-CN/troubleshooting.md +6 -5
- package/doc/gui/animation.md +39 -9
- package/doc/gui/api.md +2 -1
- package/doc/gui/build.md +137 -19
- package/doc/gui/canvas.md +1 -1
- package/doc/gui/dom.md +20 -4
- package/doc/gui/known-issues.md +63 -26
- package/doc/gui/layout.md +31 -8
- package/doc/gui/media.md +13 -7
- package/doc/gui/rendering.md +114 -39
- package/doc/gui/runtime.md +5 -0
- package/doc/gui/webgl.md +24 -6
- package/doc/gui.md +110 -47
- package/doc/implemented/cli.md +2 -0
- package/doc/implemented/extensions.md +9 -3
- package/doc/npm-package.md +4 -4
- package/doc/xbintsc.config.schema.json +10 -0
- package/doc/zh-CN/gui/animation.md +33 -10
- package/doc/zh-CN/gui/api.md +2 -1
- package/doc/zh-CN/gui/build.md +110 -16
- package/doc/zh-CN/gui/canvas.md +1 -1
- package/doc/zh-CN/gui/dom.md +16 -3
- package/doc/zh-CN/gui/known-issues.md +45 -15
- package/doc/zh-CN/gui/layout.md +23 -6
- package/doc/zh-CN/gui/media.md +11 -6
- package/doc/zh-CN/gui/rendering.md +84 -26
- package/doc/zh-CN/gui/runtime.md +3 -0
- package/doc/zh-CN/gui/webgl.md +3 -3
- package/doc/zh-CN/gui.md +92 -41
- package/doc/zh-CN/implemented/cli.md +2 -0
- package/doc/zh-CN/implemented/extensions.md +9 -3
- package/doc/zh-CN/npm-package.md +4 -3
- package/package.json +7 -7
- package/runtime/ext_gui/animation_values.cpp +425 -0
- package/runtime/ext_gui/animation_values.h +64 -0
- package/runtime/ext_gui/browser.cpp +22 -15
- package/runtime/ext_gui/browser_loop.cpp +13 -1
- package/runtime/ext_gui/canvas.h +1 -1
- package/runtime/ext_gui/canvas_raster.cpp +1 -1
- package/runtime/ext_gui/canvas_text.cpp +1 -1
- package/runtime/ext_gui/css.cpp +172 -21
- package/runtime/ext_gui/css.h +75 -4
- package/runtime/ext_gui/css_match.cpp +4 -0
- package/runtime/ext_gui/css_sheet.cpp +218 -2
- package/runtime/ext_gui/document.cpp +42 -192
- package/runtime/ext_gui/document.h +25 -12
- package/runtime/ext_gui/document_animation.cpp +428 -0
- package/runtime/ext_gui/dom_api_canvas.cpp +15 -8
- package/runtime/ext_gui/dom_api_canvas_extra.cpp +44 -20
- package/runtime/ext_gui/dom_api_canvas_image.cpp +3 -1
- package/runtime/ext_gui/dom_api_node_read.cpp +10 -0
- package/runtime/ext_gui/dom_api_offscreen.cpp +3 -1
- package/runtime/ext_gui/dom_api_style.cpp +7 -0
- package/runtime/ext_gui/dom_api_webgl_internal.h +4 -0
- package/runtime/ext_gui/dom_api_webgl_source.cpp +5 -2
- package/runtime/ext_gui/effect_values.cpp +245 -21
- package/runtime/ext_gui/gpu_bridge.c +28 -0
- package/runtime/ext_gui/gpu_feature.cpp +30 -0
- package/runtime/ext_gui/gpu_shader.cpp +22 -0
- package/runtime/ext_gui/gpu_shader_api.h +50 -0
- package/runtime/ext_gui/gradient_values.cpp +24 -0
- package/runtime/ext_gui/grid_values.cpp +23 -0
- package/runtime/ext_gui/gui.cpp +6 -37
- package/runtime/ext_gui/gui_canvas.cpp +14 -6
- package/runtime/ext_gui/gui_cursor.cpp +50 -0
- package/runtime/ext_gui/gui_engine.h +1 -18
- package/runtime/ext_gui/gui_events.cpp +19 -6
- package/runtime/ext_gui/gui_internal.h +3 -0
- package/runtime/ext_gui/gui_webgl.cpp +25 -10
- package/runtime/ext_gui/image_api.cpp +18 -0
- package/runtime/ext_gui/image_api.h +43 -0
- package/runtime/ext_gui/image_bitmap_browser.cpp +20 -11
- package/runtime/ext_gui/image_bridge.c +22 -0
- package/runtime/ext_gui/image_feature.cpp +107 -0
- package/runtime/ext_gui/inline_svg.cpp +95 -8
- package/runtime/ext_gui/inline_svg.h +5 -1
- package/runtime/ext_gui/layout.cpp +15 -9
- package/runtime/ext_gui/layout.h +8 -2
- package/runtime/ext_gui/layout_flex.cpp +134 -29
- package/runtime/ext_gui/layout_flow.cpp +58 -7
- package/runtime/ext_gui/layout_flow_internal.h +39 -4
- package/runtime/ext_gui/layout_grid.cpp +31 -0
- package/runtime/ext_gui/layout_inline.cpp +26 -2
- package/runtime/ext_gui/layout_vertical.cpp +196 -0
- package/runtime/ext_gui/media.cpp +4 -2
- package/runtime/ext_gui/media.h +3 -3
- package/runtime/ext_gui/media_api.h +7 -6
- package/runtime/ext_gui/paint.cpp +67 -9
- package/runtime/ext_gui/paint.h +61 -8
- package/runtime/ext_gui/paint_backdrop.cpp +211 -0
- package/runtime/ext_gui/paint_background.cpp +175 -97
- package/runtime/ext_gui/paint_effects.cpp +12 -6
- package/runtime/ext_gui/paint_internal.h +27 -0
- package/runtime/ext_gui/paint_outline.cpp +44 -0
- package/runtime/ext_gui/paint_shadow.cpp +368 -0
- package/runtime/ext_gui/renderer.cpp +15 -7
- package/runtime/ext_gui/renderer.h +11 -2
- package/runtime/ext_gui/renderer_backdrop.cpp +374 -0
- package/runtime/ext_gui/renderer_bitmap.cpp +82 -0
- package/runtime/ext_gui/renderer_gradient.cpp +51 -17
- package/runtime/ext_gui/renderer_image.cpp +19 -7
- package/runtime/ext_gui/renderer_internal.h +21 -0
- package/runtime/ext_gui/renderer_layer.cpp +37 -6
- package/runtime/ext_gui/renderer_text.cpp +2 -1
- package/runtime/ext_gui/stb_truetype.h +5077 -0
- package/runtime/ext_gui/style.cpp +62 -8
- package/runtime/ext_gui/style.h +111 -4
- package/runtime/ext_gui/style_cascade.cpp +83 -0
- package/runtime/ext_gui/style_internal.h +13 -1
- package/runtime/ext_gui/style_length.cpp +92 -0
- package/runtime/ext_gui/style_print.cpp +83 -2
- package/runtime/ext_gui/style_svg.cpp +40 -0
- package/runtime/ext_gui/style_text.cpp +302 -0
- package/runtime/ext_gui/style_ui.cpp +150 -0
- package/runtime/ext_gui/style_values.cpp +76 -62
- package/runtime/ext_gui/style_values_internal.h +23 -0
- package/runtime/ext_gui/text.cpp +27 -499
- package/runtime/ext_gui/text.h +18 -9
- package/runtime/ext_gui/text_api.h +45 -0
- package/runtime/ext_gui/text_bridge.c +23 -0
- package/runtime/ext_gui/text_cache.cpp +12 -3
- package/runtime/ext_gui/text_font_db.cpp +427 -0
- package/runtime/ext_gui/text_font_paths.cpp +250 -0
- package/runtime/ext_gui/text_font_paths.h +39 -0
- package/runtime/ext_gui/text_font_sfnt.cpp +396 -0
- package/runtime/ext_gui/text_font_sfnt.h +44 -0
- package/runtime/ext_gui/text_fonts.cpp +348 -0
- package/runtime/ext_gui/text_fonts.h +78 -0
- package/runtime/ext_gui/text_fonts_internal.h +77 -0
- package/runtime/ext_gui/text_glyph_cache.cpp +2 -2
- package/runtime/ext_gui/text_hb.cpp +438 -0
- package/runtime/ext_gui/text_stb.cpp +369 -0
- package/runtime/ext_gui/transform.cpp +107 -9
- package/runtime/ext_gui/transform.h +5 -0
- package/runtime/ext_gui/webgl_api.cpp +19 -0
- package/runtime/ext_gui/webgl_api.h +53 -0
- package/runtime/ext_gui/webgl_bridge.c +25 -0
- package/runtime/ext_gui/webgl_draw_setup.cpp +42 -1
- package/runtime/ext_gui/webgl_feature.cpp +82 -0
- package/runtime/ext_gui/webgl_feature.h +28 -0
- package/runtime/ext_gui/webgl_msl.cpp +41 -0
- package/runtime/ext_gui/webgl_msl.h +6 -0
- package/runtime/ext_gui/webgl_shader.cpp +40 -32
- package/runtime/ext_gui/window.cpp +7 -7
- package/runtime/ext_media/decode_audio.cpp +1 -1
- package/runtime/ext_media/media.cpp +1 -1
- package/runtime/ext_media/media_bridge.c +7 -7
- package/scripts/build-gui.ts +97 -98
- package/scripts/check-file-length.ts +1 -0
- package/scripts/gui-build-options.ts +122 -0
- package/src/cli/extensions.ts +72 -0
- package/src/cli/help.ts +3 -1
- package/src/cli/hints.ts +9 -3
- package/src/cli/main.ts +21 -27
- package/src/diagnostics/diagnostic.ts +2 -0
- package/src/driver/build-key.ts +3 -0
- package/src/driver/compiler.ts +63 -8
- package/src/driver/config.ts +6 -0
- package/src/driver/link-features.ts +163 -0
- package/src/driver/options.ts +10 -0
- package/src/driver/runtime-objects.ts +26 -1
- package/src/driver/usage.ts +376 -0
- package/src/driver/version.ts +1 -1
- package/src/extensions/catalog.ts +1 -2
- package/src/extensions/gui/features.ts +166 -0
- package/src/extensions/gui/index.ts +10 -4
- package/src/extensions/link-feature.ts +72 -0
- package/src/extensions/registry.ts +45 -4
- package/src/index.ts +3 -2
- package/dist/src/extensions/media/index.d.ts +0 -28
- package/dist/src/extensions/media/index.js +0 -59
- package/dist/src/extensions/media/index.js.map +0 -1
- package/dist/tests/extensions/media.test.js +0 -63
- package/dist/tests/extensions/media.test.js.map +0 -1
- package/src/extensions/media/index.ts +0 -65
- /package/dist/tests/{extensions/media.test.d.ts → driver/link-features.test.d.ts} +0 -0
|
@@ -1 +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,
|
|
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,EA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inline flex/grid, grid-area, aspect-ratio, auto
|
|
4
|
+
* margins, percentage radii, outlines, vertical text, SVG presentation
|
|
5
|
+
* properties and sized background tiles. Assertions use layout geometry,
|
|
6
|
+
* `computedStyle`, `paintList` and the `inlineSvg` diagnostic, so they are
|
|
7
|
+
* deterministic without reading GPU pixels.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end coverage for the CSS surface used by the Inside the Ropes
|
|
3
|
+
* stylesheets: typography, inline flex/grid, grid-area, aspect-ratio, auto
|
|
4
|
+
* margins, percentage radii, outlines, vertical text, SVG presentation
|
|
5
|
+
* properties and sized background tiles. Assertions use layout geometry,
|
|
6
|
+
* `computedStyle`, `paintList` and the `inlineSvg` diagnostic, so they are
|
|
7
|
+
* deterministic without reading GPU pixels.
|
|
8
|
+
*/
|
|
9
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
10
|
+
import { createGuiHarness, guiAvailable } from "./gui-helpers.js";
|
|
11
|
+
const harness = createGuiHarness();
|
|
12
|
+
describe.skipIf(!guiAvailable)("gui extension — CSS coverage", () => {
|
|
13
|
+
beforeAll(() => harness.setup());
|
|
14
|
+
afterAll(() => harness.cleanup());
|
|
15
|
+
it("applies letter-spacing and text-transform to layout and paint", () => {
|
|
16
|
+
const { value, stdout } = harness.compileAndRun("typography", `
|
|
17
|
+
import { createWindow, run } from "gui";
|
|
18
|
+
|
|
19
|
+
const HTML = \`
|
|
20
|
+
<html><head><style>
|
|
21
|
+
body { margin: 0; }
|
|
22
|
+
#a, #b, #c {
|
|
23
|
+
position: absolute; top: 0; font-size: 20px; white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
#a { left: 0; }
|
|
26
|
+
#b { left: 200px; letter-spacing: 2px; }
|
|
27
|
+
#c { left: 350px; text-transform: uppercase; }
|
|
28
|
+
</style></head><body>
|
|
29
|
+
<div id="a">abc</div><div id="b">abc</div><div id="c">abc</div>
|
|
30
|
+
</body></html>\`;
|
|
31
|
+
|
|
32
|
+
const win = createWindow({ title: "typography", width: 500, height: 120 });
|
|
33
|
+
win.on("ready", () => {
|
|
34
|
+
const a = win.getBoundingClientRect("#a");
|
|
35
|
+
const b = win.getBoundingClientRect("#b");
|
|
36
|
+
console.log("delta=" + (b.width - a.width).toFixed(1));
|
|
37
|
+
console.log("spacing=" + win.computedStyle("#b", "letter-spacing"));
|
|
38
|
+
console.log("transform=" + win.computedStyle("#c", "text-transform"));
|
|
39
|
+
console.log(win.paintList());
|
|
40
|
+
win.close();
|
|
41
|
+
});
|
|
42
|
+
win.loadHTML(HTML);
|
|
43
|
+
run();
|
|
44
|
+
`);
|
|
45
|
+
// Three characters, two pixels each, including the trailing one.
|
|
46
|
+
expect(value("delta")).toBe("6.0");
|
|
47
|
+
expect(value("spacing")).toBe("2px");
|
|
48
|
+
expect(value("transform")).toBe("uppercase");
|
|
49
|
+
expect(stdout).toContain('"ABC"');
|
|
50
|
+
});
|
|
51
|
+
it("resolves currentColor and percentage border radii", () => {
|
|
52
|
+
const { value, stdout } = harness.compileAndRun("colors-radius", `
|
|
53
|
+
import { createWindow, run } from "gui";
|
|
54
|
+
|
|
55
|
+
const HTML = \`
|
|
56
|
+
<html><head><style>
|
|
57
|
+
body { margin: 0; }
|
|
58
|
+
#dot {
|
|
59
|
+
color: #ff0000;
|
|
60
|
+
background: currentColor;
|
|
61
|
+
width: 20px; height: 20px;
|
|
62
|
+
border-radius: 50%;
|
|
63
|
+
}
|
|
64
|
+
</style></head><body><div id="dot"></div></body></html>\`;
|
|
65
|
+
|
|
66
|
+
const win = createWindow({ title: "colors", width: 200, height: 120 });
|
|
67
|
+
win.on("ready", () => {
|
|
68
|
+
console.log("bg=" + win.computedStyle("#dot", "background-color"));
|
|
69
|
+
console.log("radius=" + win.computedStyle("#dot", "border-radius"));
|
|
70
|
+
console.log(win.paintList());
|
|
71
|
+
win.close();
|
|
72
|
+
});
|
|
73
|
+
win.loadHTML(HTML);
|
|
74
|
+
run();
|
|
75
|
+
`);
|
|
76
|
+
expect(value("bg")).toBe("rgb(255, 0, 0)");
|
|
77
|
+
expect(value("radius")).toBe("50%");
|
|
78
|
+
expect(stdout).toContain("r=10.0 color=#ff0000ff");
|
|
79
|
+
});
|
|
80
|
+
it("lays out inline-flex and inline-grid boxes atomically", () => {
|
|
81
|
+
const { value } = harness.compileAndRun("inline-containers", `
|
|
82
|
+
import { createWindow, run } from "gui";
|
|
83
|
+
|
|
84
|
+
const HTML = \`
|
|
85
|
+
<html><head><style>
|
|
86
|
+
body { margin: 0; }
|
|
87
|
+
#row { display: inline-flex; gap: 10px; }
|
|
88
|
+
#row i { display: block; width: 20px; height: 20px; background: #222; }
|
|
89
|
+
#key {
|
|
90
|
+
display: inline-grid; place-items: center;
|
|
91
|
+
width: 17px; height: 17px; vertical-align: -3px;
|
|
92
|
+
background: #333;
|
|
93
|
+
}
|
|
94
|
+
</style></head><body>
|
|
95
|
+
<div id="line"><span id="row"><i></i><i></i></span><span id="key">W</span></div>
|
|
96
|
+
</body></html>\`;
|
|
97
|
+
|
|
98
|
+
const win = createWindow({ title: "inline", width: 400, height: 120 });
|
|
99
|
+
win.on("ready", () => {
|
|
100
|
+
const row = win.getBoundingClientRect("#row");
|
|
101
|
+
const key = win.getBoundingClientRect("#key");
|
|
102
|
+
console.log("row=" + row.width.toFixed(1) + "x" + row.height.toFixed(1));
|
|
103
|
+
console.log("key=" + key.width.toFixed(1) + "x" + key.height.toFixed(1));
|
|
104
|
+
console.log("flex=" + win.computedStyle("#row", "display"));
|
|
105
|
+
console.log("grid=" + win.computedStyle("#key", "display"));
|
|
106
|
+
console.log("align=" + win.computedStyle("#key", "vertical-align"));
|
|
107
|
+
win.close();
|
|
108
|
+
});
|
|
109
|
+
win.loadHTML(HTML);
|
|
110
|
+
run();
|
|
111
|
+
`);
|
|
112
|
+
expect(value("row")).toBe("50.0x20.0");
|
|
113
|
+
expect(value("key")).toBe("17.0x17.0");
|
|
114
|
+
expect(value("flex")).toBe("inline-flex");
|
|
115
|
+
expect(value("grid")).toBe("inline-grid");
|
|
116
|
+
expect(value("align")).toBe("-3px");
|
|
117
|
+
});
|
|
118
|
+
it("places grid-area items and derives height from aspect-ratio", () => {
|
|
119
|
+
const { value } = harness.compileAndRun("grid-aspect", `
|
|
120
|
+
import { createWindow, run } from "gui";
|
|
121
|
+
|
|
122
|
+
const HTML = \`
|
|
123
|
+
<html><head><style>
|
|
124
|
+
body { margin: 0; }
|
|
125
|
+
#grid {
|
|
126
|
+
display: grid;
|
|
127
|
+
grid-template-columns: repeat(3, 30px);
|
|
128
|
+
grid-template-rows: repeat(3, 30px);
|
|
129
|
+
}
|
|
130
|
+
#cell { grid-area: 2 / 3; background: #444; }
|
|
131
|
+
#ratio { width: 300px; aspect-ratio: 3 / 4; background: #555; }
|
|
132
|
+
</style></head><body>
|
|
133
|
+
<div id="grid"><div id="cell"></div></div>
|
|
134
|
+
<div id="ratio"></div>
|
|
135
|
+
</body></html>\`;
|
|
136
|
+
|
|
137
|
+
const win = createWindow({ title: "grid", width: 500, height: 500 });
|
|
138
|
+
win.on("ready", () => {
|
|
139
|
+
const cell = win.getBoundingClientRect("#cell");
|
|
140
|
+
const ratio = win.getBoundingClientRect("#ratio");
|
|
141
|
+
console.log("cell=" + cell.x.toFixed(1) + "," + cell.y.toFixed(1));
|
|
142
|
+
console.log("ratio=" + ratio.width.toFixed(1) + "x" + ratio.height.toFixed(1));
|
|
143
|
+
console.log("area=" + win.computedStyle("#cell", "grid-area"));
|
|
144
|
+
console.log("ar=" + win.computedStyle("#ratio", "aspect-ratio"));
|
|
145
|
+
win.close();
|
|
146
|
+
});
|
|
147
|
+
win.loadHTML(HTML);
|
|
148
|
+
run();
|
|
149
|
+
`);
|
|
150
|
+
expect(value("cell")).toBe("60.0,30.0");
|
|
151
|
+
expect(value("ratio")).toBe("300.0x400.0");
|
|
152
|
+
expect(value("area")).toBe("2 / 3 / 0 / 0");
|
|
153
|
+
expect(value("ar")).toBe("0.75");
|
|
154
|
+
});
|
|
155
|
+
it("paints focus-visible outlines and applies :active transforms", () => {
|
|
156
|
+
const { value, stdout } = harness.compileAndRun("outline-active", `
|
|
157
|
+
import { createWindow, run } from "gui";
|
|
158
|
+
|
|
159
|
+
const HTML = \`
|
|
160
|
+
<html><head><style>
|
|
161
|
+
body { margin: 0; }
|
|
162
|
+
#btn {
|
|
163
|
+
position: absolute; left: 10px; top: 10px;
|
|
164
|
+
width: 60px; height: 30px;
|
|
165
|
+
background: #111;
|
|
166
|
+
border: 0;
|
|
167
|
+
outline: 2px solid #ff0000;
|
|
168
|
+
outline-offset: 3px;
|
|
169
|
+
}
|
|
170
|
+
#btn:focus-visible { outline-color: #00ff00; }
|
|
171
|
+
#btn:active { transform: translateY(5px); }
|
|
172
|
+
</style></head><body><button id="btn">go</button></body></html>\`;
|
|
173
|
+
|
|
174
|
+
const win = createWindow({ title: "outline", width: 200, height: 120 });
|
|
175
|
+
win.on("ready", () => {
|
|
176
|
+
const doc = win.document;
|
|
177
|
+
const btn: any = doc.querySelector("#btn");
|
|
178
|
+
btn.focus();
|
|
179
|
+
console.log("color=" + win.computedStyle("#btn", "outline-color"));
|
|
180
|
+
console.log("width=" + win.computedStyle("#btn", "outline-width"));
|
|
181
|
+
console.log("offset=" + win.computedStyle("#btn", "outline-offset"));
|
|
182
|
+
console.log(win.paintList());
|
|
183
|
+
win.sendEvent("mousedown", { x: 20, y: 20, button: 0 });
|
|
184
|
+
console.log("active=" + win.computedStyle("#btn", "transform"));
|
|
185
|
+
win.sendEvent("mouseup", { x: 20, y: 20, button: 0 });
|
|
186
|
+
console.log("released=" + win.computedStyle("#btn", "transform"));
|
|
187
|
+
win.close();
|
|
188
|
+
});
|
|
189
|
+
win.loadHTML(HTML);
|
|
190
|
+
run();
|
|
191
|
+
`);
|
|
192
|
+
expect(value("color")).toBe("rgb(0, 255, 0)");
|
|
193
|
+
expect(value("width")).toBe("2px");
|
|
194
|
+
expect(value("offset")).toBe("3px");
|
|
195
|
+
expect(stdout).toContain("rect x=7.0 y=7.0 w=66.0 h=2.0");
|
|
196
|
+
expect(value("active")).toContain("translateY(5px)");
|
|
197
|
+
expect(value("released")).toBe("none");
|
|
198
|
+
});
|
|
199
|
+
it("lays vertical writing mode text out in a column and rotates it", () => {
|
|
200
|
+
const { value, stdout } = harness.compileAndRun("vertical", `
|
|
201
|
+
import { createWindow, run } from "gui";
|
|
202
|
+
|
|
203
|
+
const HTML = \`
|
|
204
|
+
<html><head><style>
|
|
205
|
+
body { margin: 0; }
|
|
206
|
+
#v {
|
|
207
|
+
position: absolute; left: 200px; top: 0;
|
|
208
|
+
writing-mode: vertical-rl;
|
|
209
|
+
font-size: 10px;
|
|
210
|
+
}
|
|
211
|
+
</style></head><body><div id="v">ABCD</div></body></html>\`;
|
|
212
|
+
|
|
213
|
+
const win = createWindow({ title: "vertical", width: 400, height: 200 });
|
|
214
|
+
win.on("ready", () => {
|
|
215
|
+
const v = win.getBoundingClientRect("#v");
|
|
216
|
+
console.log("rect=" + v.width.toFixed(1) + "," + v.height.toFixed(1));
|
|
217
|
+
console.log("mode=" + win.computedStyle("#v", "writing-mode"));
|
|
218
|
+
console.log(win.paintList());
|
|
219
|
+
win.close();
|
|
220
|
+
});
|
|
221
|
+
win.loadHTML(HTML);
|
|
222
|
+
run();
|
|
223
|
+
`);
|
|
224
|
+
const size = value("rect").split(",");
|
|
225
|
+
const width = Number(size[0] ?? 0);
|
|
226
|
+
const height = Number(size[1] ?? 0);
|
|
227
|
+
expect(width).toBeLessThan(20);
|
|
228
|
+
expect(height).toBeGreaterThan(width);
|
|
229
|
+
expect(value("mode")).toBe("vertical-rl");
|
|
230
|
+
expect(stdout).toContain(",1,-1,");
|
|
231
|
+
});
|
|
232
|
+
it("injects document CSS into the serialized inline SVG", () => {
|
|
233
|
+
const { value } = harness.compileAndRun("svg-css", `
|
|
234
|
+
import { createWindow, run } from "gui";
|
|
235
|
+
|
|
236
|
+
const HTML = \`
|
|
237
|
+
<html><head><style>
|
|
238
|
+
body { margin: 0; }
|
|
239
|
+
.ring { fill: none; stroke: #ff0000; stroke-width: 2; }
|
|
240
|
+
.glow { fill: #00ff00; stroke: rgba(0, 0, 255, 0.5); }
|
|
241
|
+
</style></head><body>
|
|
242
|
+
<svg id="icon" viewBox="0 0 20 20">
|
|
243
|
+
<circle class="ring" cx="10" cy="10" r="8"></circle>
|
|
244
|
+
<rect class="glow" x="1" y="1" width="4" height="4"></rect>
|
|
245
|
+
</svg>
|
|
246
|
+
</body></html>\`;
|
|
247
|
+
|
|
248
|
+
const win = createWindow({ title: "svg", width: 120, height: 120 });
|
|
249
|
+
win.on("ready", () => {
|
|
250
|
+
const info: any = win.inlineSvg("#icon");
|
|
251
|
+
console.log("shapes=" + info.shapes);
|
|
252
|
+
console.log("ring=" + (info.markup.indexOf("style=\\"fill:none;stroke:#ff0000;stroke-width:2\\"") >= 0));
|
|
253
|
+
console.log("glow=" + (info.markup.indexOf("fill:#00ff00") >= 0));
|
|
254
|
+
console.log("opacity=" + (info.markup.indexOf("stroke-opacity:0.500") >= 0));
|
|
255
|
+
win.close();
|
|
256
|
+
});
|
|
257
|
+
win.loadHTML(HTML);
|
|
258
|
+
run();
|
|
259
|
+
`);
|
|
260
|
+
expect(value("shapes")).toBe("2");
|
|
261
|
+
expect(value("ring")).toBe("true");
|
|
262
|
+
expect(value("glow")).toBe("true");
|
|
263
|
+
expect(value("opacity")).toBe("true");
|
|
264
|
+
});
|
|
265
|
+
it("tiles an image background at background-size", () => {
|
|
266
|
+
const image = harness.imageSrc(harness.logoPath);
|
|
267
|
+
const { stdout } = harness.compileAndRun("background-size", `
|
|
268
|
+
import { createWindow, run } from "gui";
|
|
269
|
+
|
|
270
|
+
const HTML = \`
|
|
271
|
+
<html><head><style>
|
|
272
|
+
body { margin: 0; }
|
|
273
|
+
#bg { width: 250px; height: 120px; background-image: url("${image}"); background-size: 100px 100px; }
|
|
274
|
+
</style></head><body><div id="bg"></div></body></html>\`;
|
|
275
|
+
|
|
276
|
+
const win = createWindow({ title: "tiles", width: 500, height: 300 });
|
|
277
|
+
win.on("ready", () => {
|
|
278
|
+
console.log(win.paintList());
|
|
279
|
+
win.close();
|
|
280
|
+
});
|
|
281
|
+
win.loadHTML(HTML);
|
|
282
|
+
run();
|
|
283
|
+
`);
|
|
284
|
+
const tiles = stdout.split("\n").filter((line) => line.includes("w=100.0 h=100.0"));
|
|
285
|
+
expect(tiles.length).toBe(6);
|
|
286
|
+
expect(stdout).toContain("image x=0.0 y=0.0 w=100.0 h=100.0");
|
|
287
|
+
});
|
|
288
|
+
it("distributes auto margins, inherits fonts and copies clip-path", () => {
|
|
289
|
+
const { value } = harness.compileAndRun("auto-margins", `
|
|
290
|
+
import { createWindow, run } from "gui";
|
|
291
|
+
|
|
292
|
+
const HTML = \`
|
|
293
|
+
<html><head><style>
|
|
294
|
+
body { margin: 0; font-size: 30px; }
|
|
295
|
+
button { font: inherit; }
|
|
296
|
+
#center { width: 100px; height: 10px; margin: 0 auto; background: #666; }
|
|
297
|
+
#flex { display: flex; width: 300px; height: 10px; }
|
|
298
|
+
#hint { width: 20px; height: 10px; margin-left: auto; background: #777; }
|
|
299
|
+
#outer {
|
|
300
|
+
width: 100px; height: 100px;
|
|
301
|
+
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
|
|
302
|
+
}
|
|
303
|
+
#outer::before { content: ""; clip-path: inherit; }
|
|
304
|
+
</style></head><body>
|
|
305
|
+
<div id="center"></div>
|
|
306
|
+
<div id="flex"><div id="hint"></div></div>
|
|
307
|
+
<div id="outer"></div>
|
|
308
|
+
<button id="b">x</button>
|
|
309
|
+
</body></html>\`;
|
|
310
|
+
|
|
311
|
+
const win = createWindow({ title: "margins", width: 400, height: 300 });
|
|
312
|
+
win.on("ready", () => {
|
|
313
|
+
const center = win.getBoundingClientRect("#center");
|
|
314
|
+
const hint = win.getBoundingClientRect("#hint");
|
|
315
|
+
console.log("center=" + center.x.toFixed(1));
|
|
316
|
+
console.log("hint=" + hint.x.toFixed(1));
|
|
317
|
+
console.log("font=" + win.computedStyle("#b", "font-size"));
|
|
318
|
+
const outer: any = win.document.querySelector("#outer");
|
|
319
|
+
const inherited: any = getComputedStyle(outer, "::before").getPropertyValue("clip-path");
|
|
320
|
+
const own: any = getComputedStyle(outer).getPropertyValue("clip-path");
|
|
321
|
+
console.log("clip=" + (inherited === own) + ":" + own);
|
|
322
|
+
win.close();
|
|
323
|
+
});
|
|
324
|
+
win.loadHTML(HTML);
|
|
325
|
+
run();
|
|
326
|
+
`);
|
|
327
|
+
expect(value("center")).toBe("150.0");
|
|
328
|
+
expect(value("hint")).toBe("280.0");
|
|
329
|
+
expect(value("font")).toBe("30px");
|
|
330
|
+
expect(value("clip")).toContain("true:polygon(");
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
//# sourceMappingURL=gui-css-coverage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gui-css-coverage.test.js","sourceRoot":"","sources":["../../../tests/e2e/gui-css-coverage.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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,8BAA8B,EAAE,GAAG,EAAE;IAClE,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,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,O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AAC;QACpC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end tests for the CSS features that need more than a value parser:
|
|
3
|
+
* `calc()`, `box-shadow`, Gaussian `text-shadow`, `backdrop-filter`, CSS
|
|
4
|
+
* transitions (arbitrary properties + cubic-bezier/steps) and `@keyframes`.
|
|
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 — CSS features", () => {
|
|
10
|
+
beforeAll(() => harness.setup());
|
|
11
|
+
afterAll(() => harness.cleanup());
|
|
12
|
+
it("evaluates calc() arithmetic in every length property", () => {
|
|
13
|
+
const { value } = harness.compileAndRun("calc", `
|
|
14
|
+
import { createWindow, run } from "gui";
|
|
15
|
+
|
|
16
|
+
const HTML = \`
|
|
17
|
+
<html><head><style>
|
|
18
|
+
body { margin: 0; }
|
|
19
|
+
#a {
|
|
20
|
+
position: absolute;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
font-size: calc(8px + 2px);
|
|
23
|
+
left: calc(10px + 5%);
|
|
24
|
+
top: calc(1em + 4px);
|
|
25
|
+
width: calc(100px + 2 * 10px);
|
|
26
|
+
height: calc(50px - 5px);
|
|
27
|
+
padding-left: calc(1em * 2 - 4px);
|
|
28
|
+
background: #ff0000;
|
|
29
|
+
}
|
|
30
|
+
#b { width: min(calc(100px + 10px), 200px); height: clamp(10px, calc(2 * 5px), 40px); }
|
|
31
|
+
</style></head><body><div id="a"></div><div id="b"></div></body></html>
|
|
32
|
+
\`;
|
|
33
|
+
|
|
34
|
+
const win = createWindow({ title: "calc", width: 400, height: 300 });
|
|
35
|
+
win.on("ready", () => {
|
|
36
|
+
const a = win.getBoundingClientRect("#a");
|
|
37
|
+
console.log("a=" + a.x.toFixed(1) + "," + a.y.toFixed(1) + "," +
|
|
38
|
+
a.width.toFixed(1) + "," + a.height.toFixed(1));
|
|
39
|
+
console.log("font=" + win.computedStyle("#a", "font-size"));
|
|
40
|
+
console.log("width=" + win.computedStyle("#a", "width"));
|
|
41
|
+
const b = win.getBoundingClientRect("#b");
|
|
42
|
+
console.log("b=" + b.width.toFixed(1) + "," + b.height.toFixed(1));
|
|
43
|
+
win.close();
|
|
44
|
+
});
|
|
45
|
+
win.loadHTML(HTML);
|
|
46
|
+
run();
|
|
47
|
+
`);
|
|
48
|
+
// 5% of the 400px viewport is 20px; 1em is the calc'd 10px font size.
|
|
49
|
+
expect(value("a")).toBe("30.0,14.0,120.0,45.0");
|
|
50
|
+
expect(value("font")).toBe("10px");
|
|
51
|
+
expect(value("width")).toBe("calc(100px + 2 * 10px)");
|
|
52
|
+
expect(value("b")).toBe("110.0,10.0");
|
|
53
|
+
});
|
|
54
|
+
it("paints box-shadow and blurred text-shadow as Gaussian masks", () => {
|
|
55
|
+
const { value, stdout } = harness.compileAndRun("shadows", `
|
|
56
|
+
import { createWindow, run } from "gui";
|
|
57
|
+
|
|
58
|
+
const HTML = \`
|
|
59
|
+
<html><head><style>
|
|
60
|
+
body { margin: 0; }
|
|
61
|
+
#box {
|
|
62
|
+
width: 100px; height: 50px; background: #336699;
|
|
63
|
+
box-shadow: 4px 6px 12px 2px rgba(0, 0, 0, 0.5), inset 0 0 8px #ff0000;
|
|
64
|
+
}
|
|
65
|
+
#text { font-size: 20px; color: #ffffff; text-shadow: 2px 3px 6px #00ff00; }
|
|
66
|
+
</style></head><body><div id="box"></div><div id="text">Hi</div></body></html>
|
|
67
|
+
\`;
|
|
68
|
+
|
|
69
|
+
const win = createWindow({ title: "shadows", width: 400, height: 300 });
|
|
70
|
+
win.on("ready", () => {
|
|
71
|
+
console.log("box=" + win.computedStyle("#box", "box-shadow"));
|
|
72
|
+
console.log("text=" + win.computedStyle("#text", "text-shadow"));
|
|
73
|
+
console.log("list-start");
|
|
74
|
+
console.log(win.paintList());
|
|
75
|
+
console.log("list-end");
|
|
76
|
+
let frames = 0;
|
|
77
|
+
const tick = (): void => {
|
|
78
|
+
frames += 1;
|
|
79
|
+
if (frames < 2) win.requestAnimationFrame(tick);
|
|
80
|
+
else win.close();
|
|
81
|
+
};
|
|
82
|
+
win.requestAnimationFrame(tick);
|
|
83
|
+
});
|
|
84
|
+
win.loadHTML(HTML);
|
|
85
|
+
run();
|
|
86
|
+
`, { autocloseMs: 10_000 });
|
|
87
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
88
|
+
expect(value("box")).toContain("inset 0px 0px 8px");
|
|
89
|
+
expect(value("box")).toContain("4px 6px 12px 2px");
|
|
90
|
+
expect(value("text")).toBe("2px 3px 6px rgb(0, 255, 0)");
|
|
91
|
+
// A nonzero blur is one pre-blurred texture, not a stack of offset copies.
|
|
92
|
+
expect(list).toContain("bitmap=bs:o:");
|
|
93
|
+
expect(list).toContain("bitmap=bs:i:");
|
|
94
|
+
expect(list).toContain("bitmap=ts:");
|
|
95
|
+
});
|
|
96
|
+
it("runs @keyframes with direction, timing and fill modes", () => {
|
|
97
|
+
const { value } = harness.compileAndRun("keyframes", `
|
|
98
|
+
import { createWindow, run } from "gui";
|
|
99
|
+
|
|
100
|
+
const HTML = \`
|
|
101
|
+
<html><head><style>
|
|
102
|
+
body { margin: 0; }
|
|
103
|
+
@keyframes fade {
|
|
104
|
+
from { opacity: 0; transform: translateX(0px); }
|
|
105
|
+
50% { opacity: 1; }
|
|
106
|
+
to { opacity: 0; transform: translateX(100px); }
|
|
107
|
+
}
|
|
108
|
+
#k { width: 20px; height: 20px; background: #000000;
|
|
109
|
+
animation: fade 1000ms linear forwards; }
|
|
110
|
+
</style></head><body><div id="k"></div></body></html>
|
|
111
|
+
\`;
|
|
112
|
+
|
|
113
|
+
const win = createWindow({ title: "keyframes", width: 400, height: 300 });
|
|
114
|
+
win.on("ready", () => {
|
|
115
|
+
console.log("t0=" + win.computedStyle("#k", "opacity"));
|
|
116
|
+
win.advance(250);
|
|
117
|
+
console.log("t25=" + win.computedStyle("#k", "opacity"));
|
|
118
|
+
console.log("x25=" + win.computedStyle("#k", "transform"));
|
|
119
|
+
win.advance(250);
|
|
120
|
+
console.log("t50=" + win.computedStyle("#k", "opacity"));
|
|
121
|
+
win.advance(250);
|
|
122
|
+
console.log("t75=" + win.computedStyle("#k", "opacity"));
|
|
123
|
+
console.log("x75=" + win.computedStyle("#k", "transform"));
|
|
124
|
+
win.advance(250);
|
|
125
|
+
console.log("t100=" + win.computedStyle("#k", "opacity"));
|
|
126
|
+
win.advance(1000);
|
|
127
|
+
console.log("held=" + win.computedStyle("#k", "opacity"));
|
|
128
|
+
win.close();
|
|
129
|
+
});
|
|
130
|
+
win.loadHTML(HTML);
|
|
131
|
+
run();
|
|
132
|
+
`);
|
|
133
|
+
expect(value("t0")).toBe("0");
|
|
134
|
+
expect(value("t25")).toBe("0.5");
|
|
135
|
+
expect(value("x25")).toBe("translateX(25px)");
|
|
136
|
+
expect(value("t50")).toBe("1");
|
|
137
|
+
expect(value("t75")).toBe("0.5");
|
|
138
|
+
expect(value("x75")).toBe("translateX(75px)");
|
|
139
|
+
expect(value("t100")).toBe("0");
|
|
140
|
+
// `forwards` holds the final keyframe instead of snapping back.
|
|
141
|
+
expect(value("held")).toBe("0");
|
|
142
|
+
});
|
|
143
|
+
it("honours animation delay, backwards fill and alternate direction", () => {
|
|
144
|
+
const { value } = harness.compileAndRun("keyframes-delay", `
|
|
145
|
+
import { createWindow, run } from "gui";
|
|
146
|
+
|
|
147
|
+
const HTML = \`
|
|
148
|
+
<html><head><style>
|
|
149
|
+
body { margin: 0; }
|
|
150
|
+
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
|
|
151
|
+
#d { animation: fade 1000ms linear 500ms backwards; }
|
|
152
|
+
#e { animation: fade 1000ms linear infinite alternate; }
|
|
153
|
+
</style></head><body><div id="d"></div><div id="e"></div></body></html>
|
|
154
|
+
\`;
|
|
155
|
+
|
|
156
|
+
const win = createWindow({ title: "keyframes-delay", width: 400, height: 300 });
|
|
157
|
+
win.on("ready", () => {
|
|
158
|
+
console.log("d0=" + win.computedStyle("#d", "opacity"));
|
|
159
|
+
console.log("e0=" + win.computedStyle("#e", "opacity"));
|
|
160
|
+
win.advance(500);
|
|
161
|
+
console.log("d500=" + win.computedStyle("#d", "opacity"));
|
|
162
|
+
win.advance(500);
|
|
163
|
+
console.log("d1000=" + win.computedStyle("#d", "opacity"));
|
|
164
|
+
console.log("e1000=" + win.computedStyle("#e", "opacity"));
|
|
165
|
+
win.advance(500);
|
|
166
|
+
console.log("e1500=" + win.computedStyle("#e", "opacity"));
|
|
167
|
+
win.close();
|
|
168
|
+
});
|
|
169
|
+
win.loadHTML(HTML);
|
|
170
|
+
run();
|
|
171
|
+
`);
|
|
172
|
+
// `backwards` shows the first keyframe throughout the delay.
|
|
173
|
+
expect(value("d0")).toBe("0");
|
|
174
|
+
expect(value("d500")).toBe("0");
|
|
175
|
+
expect(value("d1000")).toBe("0.5");
|
|
176
|
+
// `alternate` starts the second iteration at the first one's end value
|
|
177
|
+
// and then runs it backwards.
|
|
178
|
+
expect(value("e0")).toBe("0");
|
|
179
|
+
expect(value("e1000")).toBe("1");
|
|
180
|
+
expect(value("e1500")).toBe("0.5");
|
|
181
|
+
});
|
|
182
|
+
it("interpolates transitions with arbitrary properties, cubic-bezier and steps", () => {
|
|
183
|
+
const { value } = harness.compileAndRun("transition-easing", `
|
|
184
|
+
import { createWindow, run } from "gui";
|
|
185
|
+
|
|
186
|
+
const HTML = \`
|
|
187
|
+
<html><head><style>
|
|
188
|
+
body { margin: 0; }
|
|
189
|
+
#t {
|
|
190
|
+
width: 100px; height: 20px; opacity: 1;
|
|
191
|
+
background: #000000;
|
|
192
|
+
transition: width 1000ms steps(4, end),
|
|
193
|
+
opacity 1000ms cubic-bezier(0.5, 0, 0.5, 1);
|
|
194
|
+
}
|
|
195
|
+
#t:hover { width: 200px; opacity: 0.2; }
|
|
196
|
+
</style></head><body><div id="t"></div></body></html>
|
|
197
|
+
\`;
|
|
198
|
+
|
|
199
|
+
const win = createWindow({ title: "transition-easing", width: 400, height: 300 });
|
|
200
|
+
win.on("ready", () => {
|
|
201
|
+
win.sendEvent("mousemove", { x: 50, y: 10 });
|
|
202
|
+
console.log("start=" + win.getBoundingClientRect("#t").width.toFixed(1));
|
|
203
|
+
win.advance(200);
|
|
204
|
+
console.log("w20=" + win.getBoundingClientRect("#t").width.toFixed(1));
|
|
205
|
+
win.advance(300);
|
|
206
|
+
console.log("w50=" + win.getBoundingClientRect("#t").width.toFixed(1));
|
|
207
|
+
console.log("o50=" + win.computedStyle("#t", "opacity"));
|
|
208
|
+
win.advance(300);
|
|
209
|
+
console.log("w80=" + win.getBoundingClientRect("#t").width.toFixed(1));
|
|
210
|
+
win.close();
|
|
211
|
+
});
|
|
212
|
+
win.loadHTML(HTML);
|
|
213
|
+
run();
|
|
214
|
+
`);
|
|
215
|
+
// steps(4, end) holds 100px until 250ms, then jumps by 25px.
|
|
216
|
+
expect(value("start")).toBe("100.0");
|
|
217
|
+
expect(value("w20")).toBe("100.0");
|
|
218
|
+
expect(value("w50")).toBe("150.0");
|
|
219
|
+
// cubic-bezier(0.5, 0, 0.5, 1) is symmetric: 50% progress -> 0.6 opacity.
|
|
220
|
+
expect(value("o50")).toBe("0.6");
|
|
221
|
+
expect(value("w80")).toBe("175.0");
|
|
222
|
+
});
|
|
223
|
+
it("composites backdrop-filter from an offscreen snapshot of the scene", () => {
|
|
224
|
+
const { value, stdout, stderr } = harness.compileAndRun("backdrop", `
|
|
225
|
+
import { createWindow, run } from "gui";
|
|
226
|
+
|
|
227
|
+
const HTML = \`
|
|
228
|
+
<html><head><style>
|
|
229
|
+
body { margin: 0; }
|
|
230
|
+
#scene { width: 200px; height: 100px; background: #3366cc; }
|
|
231
|
+
#glass {
|
|
232
|
+
position: absolute; left: 20px; top: 20px; width: 80px; height: 40px;
|
|
233
|
+
border-radius: 8px;
|
|
234
|
+
backdrop-filter: blur(4px) brightness(0.5);
|
|
235
|
+
background: rgba(255, 255, 255, 0.2);
|
|
236
|
+
}
|
|
237
|
+
</style></head><body>
|
|
238
|
+
<div id="scene"><div id="glass"></div></div>
|
|
239
|
+
</body></html>
|
|
240
|
+
\`;
|
|
241
|
+
|
|
242
|
+
const win = createWindow({ title: "backdrop", width: 400, height: 300 });
|
|
243
|
+
win.on("ready", () => {
|
|
244
|
+
console.log("filter=" + win.computedStyle("#glass", "backdrop-filter"));
|
|
245
|
+
console.log("list-start");
|
|
246
|
+
console.log(win.paintList());
|
|
247
|
+
console.log("list-end");
|
|
248
|
+
/* Keep the loop alive for a couple of frames: the compositor compiles
|
|
249
|
+
* its shaders on the first draw, which is what exercises the backdrop
|
|
250
|
+
* pass (the assertions read its stderr). */
|
|
251
|
+
let frames = 0;
|
|
252
|
+
const tick = (): void => {
|
|
253
|
+
frames += 1;
|
|
254
|
+
if (frames < 3) win.requestAnimationFrame(tick);
|
|
255
|
+
else win.close();
|
|
256
|
+
};
|
|
257
|
+
win.requestAnimationFrame(tick);
|
|
258
|
+
});
|
|
259
|
+
win.loadHTML(HTML);
|
|
260
|
+
run();
|
|
261
|
+
`, { features: ["gpu"], autocloseMs: 10_000 });
|
|
262
|
+
const list = stdout.slice(stdout.indexOf("list-start"), stdout.indexOf("list-end"));
|
|
263
|
+
expect(value("filter")).toBe("blur(4px) brightness(0.5)");
|
|
264
|
+
expect(list).toContain("backdrop x=20.0 y=20.0 w=80.0 h=40.0 r=8.0 blur=4.0");
|
|
265
|
+
// The runtime shader must have compiled; a failure would only log.
|
|
266
|
+
expect(stderr).not.toContain("backdrop-filter shader unavailable");
|
|
267
|
+
expect(stderr).not.toContain("backdrop-filter pipeline creation failed");
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
//# sourceMappingURL=gui-css-features.test.js.map
|