swf2js 0.1.2 → 0.4.0
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 +81 -14
- package/package.json +11 -7
- package/studio/actionscript-roundtrip.test.js +54 -0
- package/studio/actionscript-scripts.test.js +169 -0
- package/studio/animated-image.test.js +137 -0
- package/studio/arithmetic.test.js +16 -0
- package/studio/as3-import.test.js +110 -0
- package/studio/audio-info.test.js +44 -0
- package/studio/components.test.js +152 -0
- package/studio/document-editing.test.js +92 -0
- package/studio/examples/01-space-mission.json +1628 -0
- package/studio/examples/02-clockwork-vault.json +1079 -0
- package/studio/examples/03-neon-synth.json +1364 -0
- package/studio/examples/04-kinetic-poster.json +923 -0
- package/studio/examples/05-signal-relay.json +1131 -0
- package/studio/examples/06-calculator.json +564 -0
- package/studio/frame-editing.test.js +129 -0
- package/studio/frame-events.test.js +117 -0
- package/studio/groups.test.js +88 -0
- package/studio/index.html +962 -0
- package/studio/interaction-triggers.test.js +37 -0
- package/studio/linked-actions.test.js +48 -0
- package/studio/lottie.test.js +208 -0
- package/studio/masks.test.js +43 -0
- package/studio/media-assets.test.js +62 -0
- package/studio/paint-tools.test.js +60 -0
- package/studio/playback.test.js +17 -0
- package/studio/project-io.test.js +405 -0
- package/studio/project-preview.test.js +475 -0
- package/studio/scene-transition.test.js +32 -0
- package/studio/server/archive-companions.js +27 -0
- package/studio/server/as3-library.js +91 -0
- package/studio/server/assets.js +162 -0
- package/studio/server/audio-info.js +82 -0
- package/studio/server/font-files.js +332 -0
- package/studio/server/http.js +135 -0
- package/studio/server/linked-actions.js +93 -0
- package/studio/server/png-decode.js +1 -0
- package/studio/server/project-movie.js +1164 -0
- package/studio/server/project-preview.js +152 -0
- package/studio/server/projects.js +370 -0
- package/studio/server/report.js +29 -0
- package/studio/server/routes.js +93 -0
- package/studio/server/swf-authoring.js +90 -0
- package/studio/server/swf-control-runtime.as +513 -0
- package/studio/server/swf-controls.js +119 -0
- package/studio/server/swf-export.js +293 -0
- package/studio/server/swf-import.js +1675 -0
- package/studio/server/swf-morphs.js +64 -0
- package/studio/server/swf-routes.js +42 -0
- package/studio/server/swf-streams.js +80 -0
- package/studio/server/swf-transition-runtime.as +52 -0
- package/studio/server/tween-recovery.js +106 -0
- package/studio/server-api.test.js +283 -0
- package/studio/server.js +320 -0
- package/studio/src/animated-image.js +423 -0
- package/studio/src/appearance-inspector.js +63 -0
- package/studio/src/arithmetic.js +50 -0
- package/studio/src/authored-controls.js +42 -0
- package/studio/src/busy.js +41 -0
- package/studio/src/canvas.js +430 -0
- package/studio/src/clipper-browser.js +2 -0
- package/studio/src/color-transform.js +38 -0
- package/studio/src/component-inspector.js +126 -0
- package/studio/src/components.js +268 -0
- package/studio/src/display-frame.js +262 -0
- package/studio/src/document-editing.js +69 -0
- package/studio/src/event-editor.js +150 -0
- package/studio/src/frame-editing.js +150 -0
- package/studio/src/frame-events.js +128 -0
- package/studio/src/frame-image.js +28 -0
- package/studio/src/groups.js +125 -0
- package/studio/src/handler-editor.js +122 -0
- package/studio/src/history.js +83 -0
- package/studio/src/imported-paths.js +99 -0
- package/studio/src/index.js +3582 -0
- package/studio/src/interaction-triggers.js +42 -0
- package/studio/src/json-patch.js +77 -0
- package/studio/src/layer-icons.js +25 -0
- package/studio/src/lottie-export.js +948 -0
- package/studio/src/lottie-import.js +1138 -0
- package/studio/src/masks.js +69 -0
- package/studio/src/media-assets.js +188 -0
- package/studio/src/media-library.js +193 -0
- package/studio/src/model.js +431 -0
- package/studio/src/numeric-fields.js +46 -0
- package/studio/src/object-list.js +57 -0
- package/studio/src/paint-tools.js +76 -0
- package/studio/src/placement-effects.js +74 -0
- package/studio/src/playback.js +10 -0
- package/studio/src/preview-audio.js +64 -0
- package/studio/src/preview-interactions.js +106 -0
- package/studio/src/preview-recorder.js +335 -0
- package/studio/src/preview-surface.js +338 -0
- package/studio/src/project-io.js +905 -0
- package/studio/src/project-session.js +375 -0
- package/studio/src/projects-dialog.js +319 -0
- package/studio/src/scene-transition.js +129 -0
- package/studio/src/script-editor.js +175 -0
- package/studio/src/script-references.js +74 -0
- package/studio/src/scripted-controls.js +146 -0
- package/studio/src/scripts.js +185 -0
- package/studio/src/stage-guides.js +101 -0
- package/studio/src/svg-animation.js +416 -0
- package/studio/src/svg-context.js +522 -0
- package/studio/src/svg-frame.js +413 -0
- package/studio/src/svg-import.js +1208 -0
- package/studio/src/swf-recording.js +104 -0
- package/studio/src/symbol-library.js +39 -0
- package/studio/src/symbols.js +62 -0
- package/studio/src/text-fields.js +58 -0
- package/studio/src/theme.js +43 -0
- package/studio/src/timeline.js +321 -0
- package/studio/src/vector-cut.js +103 -0
- package/studio/src/vector-geometry.js +254 -0
- package/studio/src/vector-style.js +146 -0
- package/studio/src/video-encode.js +84 -0
- package/studio/src/video-export.js +331 -0
- package/studio/src/video-mux.js +339 -0
- package/studio/src/video-playback.js +281 -0
- package/studio/src/workspace.js +344 -0
- package/studio/stroke-style.test.js +119 -0
- package/studio/styles.css +1547 -0
- package/studio/svg-export.test.js +162 -0
- package/studio/svg-import.test.js +318 -0
- package/studio/swf-authoring.test.js +140 -0
- package/studio/swf-export.test.js +324 -0
- package/studio/swf-import.test.js +489 -0
- package/studio/symbols.test.js +68 -0
- package/studio/tests/accessibility-interactions.mjs +138 -0
- package/studio/tests/appearance-interactions.mjs +103 -0
- package/studio/tests/control-interactions.mjs +60 -0
- package/studio/tests/event-interactions.mjs +117 -0
- package/studio/tests/external-resources.mjs +174 -0
- package/studio/tests/frame-image.mjs +71 -0
- package/studio/tests/html-export.mjs +68 -0
- package/studio/tests/import-files.mjs +131 -0
- package/studio/tests/lottie.mjs +125 -0
- package/studio/tests/mask-interactions.mjs +148 -0
- package/studio/tests/media-interactions.mjs +109 -0
- package/studio/tests/paint-interactions.mjs +64 -0
- package/studio/tests/project-interactions.mjs +244 -0
- package/studio/tests/script-interactions.mjs +178 -0
- package/studio/tests/scripted-control-interactions.mjs +107 -0
- package/studio/tests/svg-export.mjs +149 -0
- package/studio/tests/text-field-interactions.mjs +64 -0
- package/studio/tests/theme-interactions.mjs +53 -0
- package/studio/tests/timeline-browser.mjs +507 -0
- package/studio/tests/transition-interactions.mjs +94 -0
- package/studio/tests/trigger-interactions.mjs +93 -0
- package/studio/tests/video-export.mjs +243 -0
- package/studio/tests/workspace-interactions.mjs +226 -0
- package/studio/tween-recovery.test.js +31 -0
- package/studio/vector-style.test.js +56 -0
- package/studio/video-export.test.js +326 -0
- package/studiospec/actionscript.md +88 -0
- package/studiospec/architecture.md +378 -0
- package/studiospec/controls.md +100 -0
- package/studiospec/file-support.md +268 -0
- package/studiospec/lottie.md +69 -0
- package/studiospec/requirements.md +135 -0
- package/studiospec/stroke-style.md +95 -0
- package/studiospec/svg-export.md +83 -0
- package/studiospec/svg-import.md +139 -0
- package/studiospec/swooflib-integration.md +115 -0
- package/studiospec/tasks.md +573 -0
- package/studiospec/video-export.md +127 -0
- package/swf2js/__tests__/actionscript.test.js +1609 -0
- package/swf2js/__tests__/adpcm-audio.test.js +43 -0
- package/swf2js/__tests__/as2-compiler.test.js +153 -0
- package/swf2js/__tests__/as3-mixed-depth.test.js +498 -0
- package/swf2js/__tests__/authored-sprite-hit.test.js +118 -0
- package/swf2js/__tests__/authored-sprite-sizing.test.js +164 -0
- package/swf2js/__tests__/avm1-action-prefix.test.js +134 -0
- package/swf2js/__tests__/avm1-attach-movie.test.js +1151 -0
- package/swf2js/__tests__/avm1-boxhead-budget.test.js +73 -0
- package/swf2js/__tests__/avm1-cfg-bubble-tanks.test.js +101 -0
- package/swf2js/__tests__/avm1-cfg-mario-kart.test.js +184 -0
- package/swf2js/__tests__/avm1-cfg-mario.test.js +31 -0
- package/swf2js/__tests__/avm1-cfg-pacman.test.js +49 -0
- package/swf2js/__tests__/avm1-checkers-gameplay.test.js +122 -0
- package/swf2js/__tests__/avm1-clip-actions.test.js +2002 -0
- package/swf2js/__tests__/avm1-clone-drag.test.js +626 -0
- package/swf2js/__tests__/avm1-decompiler.test.js +102 -0
- package/swf2js/__tests__/avm1-dynamic-locals.test.js +159 -0
- package/swf2js/__tests__/avm1-formal-parameters.test.js +71 -0
- package/swf2js/__tests__/avm1-key-events.test.js +52 -0
- package/swf2js/__tests__/avm1-load-bitmap.test.js +75 -0
- package/swf2js/__tests__/avm1-loading-host-actions.test.js +764 -0
- package/swf2js/__tests__/avm1-multibyte-strings.test.js +63 -0
- package/swf2js/__tests__/avm1-pacman-gameplay.test.js +115 -0
- package/swf2js/__tests__/avm1-shape-hittest.test.js +311 -0
- package/swf2js/__tests__/avm1-shared-bodies.test.js +57 -0
- package/swf2js/__tests__/avm1-shared-runtime.test.js +1364 -0
- package/swf2js/__tests__/avm1-snake-gameplay.test.js +139 -0
- package/swf2js/__tests__/avm1-super.test.js +70 -0
- package/swf2js/__tests__/avm1-target-path.test.js +325 -0
- package/swf2js/__tests__/avm1-try.test.js +229 -0
- package/swf2js/__tests__/avm2-activation-closures.test.js +65 -0
- package/swf2js/__tests__/avm2-applytype.test.js +180 -0
- package/swf2js/__tests__/avm2-call-ops.test.js +232 -0
- package/swf2js/__tests__/avm2-callsuperid.test.js +231 -0
- package/swf2js/__tests__/avm2-class-initializer.test.js +219 -0
- package/swf2js/__tests__/avm2-custom-namespace.test.js +139 -0
- package/swf2js/__tests__/avm2-describe-type.test.js +96 -0
- package/swf2js/__tests__/avm2-dictionary.test.js +96 -0
- package/swf2js/__tests__/avm2-domain-memory.test.js +332 -0
- package/swf2js/__tests__/avm2-e4x.test.js +326 -0
- package/swf2js/__tests__/avm2-exceptions.test.js +81 -0
- package/swf2js/__tests__/avm2-findprop.test.js +110 -0
- package/swf2js/__tests__/avm2-getlex.test.js +166 -0
- package/swf2js/__tests__/avm2-global-slot.test.js +106 -0
- package/swf2js/__tests__/avm2-interface.test.js +95 -0
- package/swf2js/__tests__/avm2-multiname-precedence.test.js +148 -0
- package/swf2js/__tests__/avm2-named-namespace-types.test.js +106 -0
- package/swf2js/__tests__/avm2-optional-args.test.js +100 -0
- package/swf2js/__tests__/avm2-outer-scopes.test.js +101 -0
- package/swf2js/__tests__/avm2-package-internal-class.test.js +106 -0
- package/swf2js/__tests__/avm2-protected-namespace.test.js +105 -0
- package/swf2js/__tests__/avm2-protected.test.js +214 -0
- package/swf2js/__tests__/avm2-qwop-gameplay.test.js +116 -0
- package/swf2js/__tests__/avm2-runtime-namespaces.test.js +159 -0
- package/swf2js/__tests__/avm2-script-traits.test.js +89 -0
- package/swf2js/__tests__/avm2-shared-runtime.test.js +52 -0
- package/swf2js/__tests__/avm2-slot-ops.test.js +117 -0
- package/swf2js/__tests__/avm2-type-ops.test.js +224 -0
- package/swf2js/__tests__/bevel-filter.test.js +116 -0
- package/swf2js/__tests__/bitmap-button-mask.test.js +106 -0
- package/swf2js/__tests__/bitmap-data-draw.test.js +388 -0
- package/swf2js/__tests__/bitmap-decoder.test.js +108 -0
- package/swf2js/__tests__/bitmapdata-color-bounds.test.js +70 -0
- package/swf2js/__tests__/bitmapdata-copy-channel.test.js +91 -0
- package/swf2js/__tests__/bitmapdata-copy-pixels.test.js +136 -0
- package/swf2js/__tests__/bitmapdata-fill-compare.test.js +241 -0
- package/swf2js/__tests__/bitmapdata-filter.test.js +232 -0
- package/swf2js/__tests__/bitmapdata-hit-test.test.js +71 -0
- package/swf2js/__tests__/bitmapdata-merge.test.js +84 -0
- package/swf2js/__tests__/bitmapdata-palette-map.test.js +92 -0
- package/swf2js/__tests__/bitmapdata-pixels-io.test.js +198 -0
- package/swf2js/__tests__/bitmapdata-threshold.test.js +97 -0
- package/swf2js/__tests__/bitmapdata-vector.test.js +82 -0
- package/swf2js/__tests__/blur-filter.test.js +48 -0
- package/swf2js/__tests__/bundle-emitter.test.js +394 -0
- package/swf2js/__tests__/button-actions.test.js +370 -0
- package/swf2js/__tests__/button-color-transform.test.js +48 -0
- package/swf2js/__tests__/button-decoder.test.js +106 -0
- package/swf2js/__tests__/button-hit-test.test.js +825 -0
- package/swf2js/__tests__/button-scaling-grid.test.js +124 -0
- package/swf2js/__tests__/button-sound.test.js +105 -0
- package/swf2js/__tests__/bytearray-coercion.test.js +23 -0
- package/swf2js/__tests__/bytearray-object-serialization.test.js +380 -0
- package/swf2js/__tests__/cfg-switch-loop.test.js +103 -0
- package/swf2js/__tests__/clip-depth-mask.test.js +119 -0
- package/swf2js/__tests__/clipped-bitmap-fill.test.js +118 -0
- package/swf2js/__tests__/companion-swf.test.js +638 -0
- package/swf2js/__tests__/context-menu.test.js +149 -0
- package/swf2js/__tests__/convolution-filter.test.js +74 -0
- package/swf2js/__tests__/definefont4.test.js +280 -0
- package/swf2js/__tests__/display-displacement.test.js +161 -0
- package/swf2js/__tests__/display-list.test.js +80 -0
- package/swf2js/__tests__/display-mask-render.test.js +656 -0
- package/swf2js/__tests__/displayobject-stage.test.js +320 -0
- package/swf2js/__tests__/embedded-script-audio.test.js +131 -0
- package/swf2js/__tests__/embedded-swf.test.js +202 -0
- package/swf2js/__tests__/embedded-textfield.test.js +107 -0
- package/swf2js/__tests__/embedded-timeline-audio.test.js +182 -0
- package/swf2js/__tests__/embedded-timeline-input.test.js +420 -0
- package/swf2js/__tests__/embedded-timer-lifecycle.test.js +145 -0
- package/swf2js/__tests__/event-priority-order.test.js +125 -0
- package/swf2js/__tests__/event-weak-listeners.test.js +53 -0
- package/swf2js/__tests__/event-will-trigger.test.js +43 -0
- package/swf2js/__tests__/flash-text-engine-content.test.js +115 -0
- package/swf2js/__tests__/flash-text-engine-format.test.js +95 -0
- package/swf2js/__tests__/flash-text-engine-line.test.js +314 -0
- package/swf2js/__tests__/font-encoder.test.js +95 -0
- package/swf2js/__tests__/font-outline-text.test.js +659 -0
- package/swf2js/__tests__/glow-shadow-filter.test.js +68 -0
- package/swf2js/__tests__/graphics-bitmap-smoothing.test.js +32 -0
- package/swf2js/__tests__/graphics-fill-lifetime.test.js +36 -0
- package/swf2js/__tests__/graphics-gradient-matrix.test.js +53 -0
- package/swf2js/__tests__/graphics-stroke-hit-test.test.js +457 -0
- package/swf2js/__tests__/hit-test-primitives.test.js +414 -0
- package/swf2js/__tests__/input-events.test.js +714 -0
- package/swf2js/__tests__/integration/corpus.test.js +41 -0
- package/swf2js/__tests__/loader-embedded-swf.test.js +210 -0
- package/swf2js/__tests__/loader-info.test.js +81 -0
- package/swf2js/__tests__/local-connection.test.js +122 -0
- package/swf2js/__tests__/morph-focal-gradient.test.js +51 -0
- package/swf2js/__tests__/morph-topology.test.js +267 -0
- package/swf2js/__tests__/movie-data-codec.test.js +128 -0
- package/swf2js/__tests__/nellymoser-audio.test.js +84 -0
- package/swf2js/__tests__/opaque-background-cache.test.js +352 -0
- package/swf2js/__tests__/path-stream.test.js +81 -0
- package/swf2js/__tests__/place-object-filters.test.js +88 -0
- package/swf2js/__tests__/place-object3-decoder.test.js +116 -0
- package/swf2js/__tests__/place-object3-image.test.js +85 -0
- package/swf2js/__tests__/player-version.test.js +46 -0
- package/swf2js/__tests__/root-textfield.test.js +287 -0
- package/swf2js/__tests__/scaling-grid.test.js +183 -0
- package/swf2js/__tests__/shape-decoder.test.js +361 -0
- package/swf2js/__tests__/shape-line-style2.test.js +138 -0
- package/swf2js/__tests__/shape-nonscaling-stroke.test.js +131 -0
- package/swf2js/__tests__/shape-pixel-hint.test.js +101 -0
- package/swf2js/__tests__/simplebutton-pointer.test.js +1477 -0
- package/swf2js/__tests__/socket-offline.test.js +67 -0
- package/swf2js/__tests__/sound-avm1-stop.test.js +99 -0
- package/swf2js/__tests__/sound-envelope.test.js +110 -0
- package/swf2js/__tests__/sound-extract.test.js +168 -0
- package/swf2js/__tests__/sound-id3.test.js +283 -0
- package/swf2js/__tests__/sound-load.test.js +259 -0
- package/swf2js/__tests__/sound-mixer-spectrum.test.js +261 -0
- package/swf2js/__tests__/sound-stream-sprite.test.js +624 -0
- package/swf2js/__tests__/sound-transform.test.js +104 -0
- package/swf2js/__tests__/speex-audio.test.js +77 -0
- package/swf2js/__tests__/stage-noscale.test.js +45 -0
- package/swf2js/__tests__/swf-encoder.test.js +134 -0
- package/swf2js/__tests__/swflib-assemble.test.js +20 -0
- package/swf2js/__tests__/textfield-html-text.test.js +368 -0
- package/swf2js/__tests__/textfield-line-layout.test.js +339 -0
- package/swf2js/__tests__/textfield-programmatic-overlay.test.js +2506 -0
- package/swf2js/__tests__/textfield-scroll.test.js +79 -0
- package/swf2js/__tests__/textfield-selection.test.js +383 -0
- package/swf2js/__tests__/timeline-effect-surfaces.test.js +295 -0
- package/swf2js/__tests__/timeline-named-anchor.test.js +139 -0
- package/swf2js/__tests__/timeline-scenes.test.js +1723 -0
- package/swf2js/__tests__/urlloader-http-status.test.js +236 -0
- package/{src → swf2js}/cli.js +43 -11
- package/swf2js/compiler/as2-classes.js +156 -0
- package/swf2js/compiler/as2-parser.js +598 -0
- package/swf2js/compiler/avm1-codegen.js +897 -0
- package/swf2js/compiler/index.js +28 -0
- package/{src → swf2js}/decoder/button-decoder.js +3 -1
- package/swf2js/decoder/png.js +114 -0
- package/{src → swf2js}/decoder/shape-decoder.js +20 -10
- package/{src → swf2js}/decoder/tag-decoder.js +5 -3
- package/{src → swf2js}/decoder/tag-types.js +4 -0
- package/swf2js/decompiler/avm1-decompiler.js +1138 -0
- package/{src → swf2js}/emitter/asset-encoder.js +66 -113
- package/{src → swf2js}/emitter/bundle-emitter.js +209 -78
- package/swf2js/emitter/external-resources.js +39 -0
- package/swf2js/emitter/movie-data-codec.js +91 -0
- package/swf2js/encoder/bit-writer.js +182 -0
- package/swf2js/encoder/shape-encoder.js +310 -0
- package/swf2js/encoder/swf-builder.js +639 -0
- package/swf2js/encoder/swf-writer.js +55 -0
- package/{src/runtime/swflib/assemble.js → swf2js/runtime/assemble-swooflib.js} +4 -3
- package/{src → swf2js}/runtime/avm1-runtime.js +102 -63
- package/{src → swf2js}/runtime/index.js +1 -1
- package/{src → swf2js}/runtime/movie-runtime.js +28 -2
- package/{src → swf2js}/transpiler/actionscript.js +82 -19
- package/{src → swf2js}/transpiler/avm1/avm1-opcodes.js +5 -3
- package/{src → swf2js}/transpiler/avm1/avm1-transpiler.js +69 -6
- package/{src → swf2js}/transpiler/avm2/avm2-transpiler.js +1 -1
- package/{src → swf2js}/transpiler/timeline/display-list.js +41 -22
- package/{src → swf2js}/transpiler/timeline/timeline-codegen.js +97 -36
- package/swooflib/README.md +569 -0
- package/swooflib/adpcm.js +147 -0
- package/{src/runtime/swflib → swooflib}/builtins.js +6 -0
- package/{src/runtime/swflib → swooflib}/context-menu.js +7 -1
- package/swooflib/control-definitions.js +42 -0
- package/swooflib/control-widget.js +763 -0
- package/swooflib/controls.js +300 -0
- package/{src/runtime/swflib → swooflib}/display.js +16 -10
- package/{src/runtime/swflib → swooflib}/events.js +11 -0
- package/{src/runtime/swflib → swooflib}/flash.js +6 -5
- package/{src/runtime/swflib → swooflib}/graphics.js +81 -19
- package/{src/runtime/swflib → swooflib}/input.js +12 -14
- package/{src/runtime/swflib → swooflib}/loader.js +52 -22
- package/swooflib/movie-network.js +86 -0
- package/swooflib/path-stream.js +169 -0
- package/{src/runtime/swflib → swooflib}/render.js +3 -13
- package/{src/runtime/swflib → swooflib}/sound.js +25 -2
- package/{src/runtime/swflib → swooflib}/stage.js +3 -3
- package/swooflib/stream-time.js +21 -0
- package/{src/runtime/swflib → swooflib}/system.js +88 -37
- package/{src/runtime/swflib → swooflib}/text-paint.js +14 -3
- package/{src/runtime/swflib → swooflib}/text.js +8 -0
- package/swooflib/xml-node.js +53 -0
- package/src/emitter/timeline-data-codec.js +0 -58
- /package/{src → swf2js}/decoder/symbol-table.js +0 -0
- /package/{src → swf2js}/emitter/embedded-swf.js +0 -0
- /package/{src → swf2js}/emitter/font-encoder.js +0 -0
- /package/{src → swf2js}/model/swf-document.js +0 -0
- /package/{src → swf2js}/model/transpile-result.js +0 -0
- /package/{src → swf2js}/parser/bit-reader.js +0 -0
- /package/{src → swf2js}/parser/decompressor.js +0 -0
- /package/{src → swf2js}/parser/swf-parser.js +0 -0
- /package/{src → swf2js}/pretty-printer/pretty-printer.js +0 -0
- /package/{src → swf2js}/runtime/avm2-runtime.js +0 -0
- /package/{src → swf2js}/runtime/embedded-movie-runtime.js +0 -0
- /package/{src → swf2js}/transpiler/avm1/avm1-ir.js +0 -0
- /package/{src → swf2js}/transpiler/avm1/avm1-rewrite.js +0 -0
- /package/{src → swf2js}/transpiler/avm2/abc-reader.js +0 -0
- /package/{src → swf2js}/transpiler/cfg-structurer.js +0 -0
- /package/{src → swf2js}/util/diagnostics.js +0 -0
- /package/{src → swf2js}/util/logger.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bitmap-image.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bitmap.js +0 -0
- /package/{src/runtime/swflib → swooflib}/bytearray.js +0 -0
- /package/{src/runtime/swflib → swooflib}/compiled-swf.js +0 -0
- /package/{src/runtime/swflib → swooflib}/cursor-flag.js +0 -0
- /package/{src/runtime/swflib → swooflib}/dictionary.js +0 -0
- /package/{src/runtime/swflib → swooflib}/filters.js +0 -0
- /package/{src/runtime/swflib → swooflib}/geom.js +0 -0
- /package/{src/runtime/swflib → swooflib}/glyph-metrics.js +0 -0
- /package/{src/runtime/swflib → swooflib}/host.js +0 -0
- /package/{src/runtime/swflib → swooflib}/inherit.js +0 -0
- /package/{src/runtime/swflib → swooflib}/marks.js +0 -0
- /package/{src/runtime/swflib → swooflib}/matrix3d.js +0 -0
- /package/{src/runtime/swflib → swooflib}/pointer-bridge.js +0 -0
- /package/{src/runtime/swflib → swooflib}/projection.js +0 -0
- /package/{src/runtime/swflib → swooflib}/sprite-drag.js +0 -0
- /package/{src/runtime/swflib → swooflib}/stage-ref.js +0 -0
- /package/{src/runtime/swflib → swooflib}/text-field.js +0 -0
- /package/{src/runtime/swflib → swooflib}/transform.js +0 -0
- /package/{src/runtime/swflib → swooflib}/xml.js +0 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { verifyPaintTools } from './paint-interactions.mjs';
|
|
2
|
+
import { verifyControls } from './control-interactions.mjs';
|
|
3
|
+
import { verifyExternalResources } from './external-resources.mjs';
|
|
4
|
+
import { verifyHtmlExport } from './html-export.mjs';
|
|
5
|
+
import { verifyVideoExport } from './video-export.mjs';
|
|
6
|
+
import { verifyFrameImage } from './frame-image.mjs';
|
|
7
|
+
import { verifySvgExport } from './svg-export.mjs';
|
|
8
|
+
import { verifyLottie } from './lottie.mjs';
|
|
9
|
+
import { verifyImportFiles } from './import-files.mjs';
|
|
10
|
+
import { verifyTriggers } from './trigger-interactions.mjs';
|
|
11
|
+
import { verifySceneTransitions } from './transition-interactions.mjs';
|
|
12
|
+
import { verifyAccessibility } from './accessibility-interactions.mjs';
|
|
13
|
+
import { verifyMedia } from './media-interactions.mjs';
|
|
14
|
+
import { verifyFrameEvents } from './event-interactions.mjs';
|
|
15
|
+
import { verifyMasks } from './mask-interactions.mjs';
|
|
16
|
+
import { verifyScriptedControls } from './scripted-control-interactions.mjs';
|
|
17
|
+
import { verifyTextFields } from './text-field-interactions.mjs';
|
|
18
|
+
import { verifyScriptEditing } from './script-interactions.mjs';
|
|
19
|
+
// Run with node studio/tests/timeline-browser.mjs. Set CHROME_BIN for a custom Chromium installation.
|
|
20
|
+
import { verifyAppearance } from './appearance-interactions.mjs';
|
|
21
|
+
import { verifyTheme } from './theme-interactions.mjs';
|
|
22
|
+
import { verifyProjects } from './project-interactions.mjs';
|
|
23
|
+
import { verifyWorkspace } from './workspace-interactions.mjs';
|
|
24
|
+
import assert from 'node:assert/strict';
|
|
25
|
+
import { spawn } from 'node:child_process';
|
|
26
|
+
import { once } from 'node:events';
|
|
27
|
+
import { createStudioServer } from '../server.js';
|
|
28
|
+
import { mkdtemp, rm } from 'node:fs/promises';
|
|
29
|
+
import { existsSync } from 'node:fs';
|
|
30
|
+
import { tmpdir } from 'node:os';
|
|
31
|
+
import path from 'node:path';
|
|
32
|
+
import { fileURLToPath } from 'node:url';
|
|
33
|
+
|
|
34
|
+
const root = fileURLToPath(new URL('../', import.meta.url));
|
|
35
|
+
const chrome = process.env.CHROME_BIN || [
|
|
36
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
37
|
+
'/usr/bin/chromium', '/usr/bin/google-chrome', '/usr/bin/chromium-browser',
|
|
38
|
+
].find(existsSync);
|
|
39
|
+
assert.ok(chrome, 'Set CHROME_BIN to a Chrome or Chromium executable');
|
|
40
|
+
const projectsDir = await mkdtemp(path.join(tmpdir(), 'studio-projects-'));
|
|
41
|
+
const server = createStudioServer({ root, projectsDir });
|
|
42
|
+
server.listen(0, '127.0.0.1');
|
|
43
|
+
await once(server, 'listening');
|
|
44
|
+
const profile = await mkdtemp(path.join(tmpdir(), 'studio-timeline-'));
|
|
45
|
+
const proc = spawn(chrome, ['--headless', '--disable-gpu', '--no-first-run', '--window-size=1600,1100',
|
|
46
|
+
'--remote-debugging-pipe', `--user-data-dir=${profile}`, 'about:blank'], { stdio: ['ignore','ignore','ignore','pipe','pipe'] });
|
|
47
|
+
const exited = once(proc, 'exit');
|
|
48
|
+
const pending = new Map();
|
|
49
|
+
const errors = [];
|
|
50
|
+
const dialogs = [];
|
|
51
|
+
const frameContexts = new Map();
|
|
52
|
+
const childSessions = new Map();
|
|
53
|
+
let sequence = 0;
|
|
54
|
+
let sessionId;
|
|
55
|
+
let buffer = '';
|
|
56
|
+
proc.stdio[4].setEncoding('utf8').on('data', chunk => {
|
|
57
|
+
buffer += chunk;
|
|
58
|
+
let boundary;
|
|
59
|
+
while ((boundary = buffer.indexOf('\0')) >= 0) {
|
|
60
|
+
const msg = JSON.parse(buffer.slice(0, boundary));
|
|
61
|
+
buffer = buffer.slice(boundary + 1);
|
|
62
|
+
if (msg.method === 'Target.detachedFromTarget') {
|
|
63
|
+
for (const [target, session] of childSessions) {
|
|
64
|
+
if (session === msg.params.sessionId) childSessions.delete(target);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (msg.method === 'Runtime.executionContextCreated') {
|
|
68
|
+
const { id, auxData } = msg.params.context;
|
|
69
|
+
if (auxData?.isDefault) frameContexts.set(auxData.frameId, id);
|
|
70
|
+
}
|
|
71
|
+
if (msg.method === 'Runtime.exceptionThrown') errors.push(msg.params.exceptionDetails);
|
|
72
|
+
// Accept discard confirmations and unload warnings, recording them for assertions.
|
|
73
|
+
if (msg.method === 'Page.javascriptDialogOpening') {
|
|
74
|
+
dialogs.push(msg.params);
|
|
75
|
+
proc.stdio[3].write(JSON.stringify({ id: ++sequence, method: 'Page.handleJavaScriptDialog',
|
|
76
|
+
params: { accept: true }, sessionId: msg.sessionId }) + '\0');
|
|
77
|
+
}
|
|
78
|
+
pending.get(msg.id)?.(msg);
|
|
79
|
+
pending.delete(msg.id);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
function call(method, params = {}, targetSession = sessionId) {
|
|
83
|
+
const id = ++sequence;
|
|
84
|
+
const trace = new Error(method);
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
const timeout = setTimeout(() => reject(new Error(`Timed out during ${method}`)), 8000);
|
|
87
|
+
pending.set(id, msg => {
|
|
88
|
+
clearTimeout(timeout);
|
|
89
|
+
if (msg.error) {
|
|
90
|
+
trace.message += ': ' + msg.error.message + ' ' + (params.expression ?? '').slice(0, 64);
|
|
91
|
+
reject(trace);
|
|
92
|
+
}
|
|
93
|
+
else resolve(msg.result);
|
|
94
|
+
});
|
|
95
|
+
proc.stdio[3].write(JSON.stringify({ id, method, params, sessionId: targetSession ?? undefined }) + '\0');
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
async function game(expression) {
|
|
99
|
+
const { frameTree } = await call('Page.getFrameTree');
|
|
100
|
+
const frame = frameTree.childFrames?.find(child => child.frame.url.includes('/api/preview/'))?.frame;
|
|
101
|
+
const contextId = frame && frameContexts.get(frame.id);
|
|
102
|
+
let result;
|
|
103
|
+
if (contextId) {
|
|
104
|
+
result = await call('Runtime.evaluate', { expression, contextId, returnByValue: true, awaitPromise: true });
|
|
105
|
+
} else {
|
|
106
|
+
const { targetInfos } = await call('Target.getTargets', {}, null);
|
|
107
|
+
const target = targetInfos.find(info => info.type === 'iframe' && info.url.includes('/api/preview/'));
|
|
108
|
+
if (!target) return undefined;
|
|
109
|
+
if (!childSessions.has(target.targetId)) {
|
|
110
|
+
const { sessionId: child } = await call('Target.attachToTarget', { targetId: target.targetId, flatten: true }, null);
|
|
111
|
+
childSessions.set(target.targetId, child);
|
|
112
|
+
}
|
|
113
|
+
result = await call('Runtime.evaluate', { expression, returnByValue: true, awaitPromise: true }, childSessions.get(target.targetId));
|
|
114
|
+
}
|
|
115
|
+
assert.ok(!result.exceptionDetails, result.exceptionDetails?.exception?.description);
|
|
116
|
+
return result.result.value;
|
|
117
|
+
}
|
|
118
|
+
async function js(expression) {
|
|
119
|
+
const result = await call('Runtime.evaluate', { expression, returnByValue:true, awaitPromise:true });
|
|
120
|
+
assert.ok(!result.exceptionDetails, result.exceptionDetails?.exception?.description);
|
|
121
|
+
return result.result.value;
|
|
122
|
+
}
|
|
123
|
+
const click = selector => js(`document.querySelector(${JSON.stringify(selector)}).click()`);
|
|
124
|
+
const change = (id, value, event = 'change') => js(`{
|
|
125
|
+
const input = document.getElementById(${JSON.stringify(id)});
|
|
126
|
+
input.value = ${JSON.stringify(value)};
|
|
127
|
+
input.dispatchEvent(new Event(${JSON.stringify(event)}, { bubbles:true }));
|
|
128
|
+
}`);
|
|
129
|
+
const scrub = frame => change('playhead', frame, 'input');
|
|
130
|
+
const edit = op => change('frame-edit', op);
|
|
131
|
+
async function key(key, code, virtualKey, modifiers = 0, text = '') {
|
|
132
|
+
const event = { key, code, windowsVirtualKeyCode: virtualKey, modifiers };
|
|
133
|
+
await call('Input.dispatchKeyEvent', { ...event, type: 'keyDown', text });
|
|
134
|
+
await call('Input.dispatchKeyEvent', { ...event, type: 'keyUp' });
|
|
135
|
+
}
|
|
136
|
+
async function drag(x1, y1, x2 = x1, y2 = y1, modifiers = 0) {
|
|
137
|
+
const rect = await js("(() => { const c = document.querySelector('#stage'); return { ...c.getBoundingClientRect().toJSON(), w: c.width, h: c.height }; })()");
|
|
138
|
+
const mouse = (type, x, y, buttons) => call('Input.dispatchMouseEvent', {type,
|
|
139
|
+
x:rect.x + x * rect.width/rect.w, y:rect.y + y * rect.height/rect.h, button:'left', buttons, modifiers, clickCount:1});
|
|
140
|
+
await mouse('mousePressed', x1, y1, 1);
|
|
141
|
+
await mouse('mouseMoved', x2, y2, 1);
|
|
142
|
+
await mouse('mouseReleased', x2, y2, 0);
|
|
143
|
+
}
|
|
144
|
+
async function doubleClickStage(x, y) {
|
|
145
|
+
const point = await js(`(() => {
|
|
146
|
+
const c = document.querySelector('#stage'), r = c.getBoundingClientRect();
|
|
147
|
+
return { x: r.x + ${x} * r.width / c.width, y: r.y + ${y} * r.height / c.height };
|
|
148
|
+
})()`);
|
|
149
|
+
for (const clickCount of [1, 2]) {
|
|
150
|
+
await call('Input.dispatchMouseEvent', { type: 'mousePressed', ...point, button: 'left', buttons: 1, clickCount });
|
|
151
|
+
await call('Input.dispatchMouseEvent', { type: 'mouseReleased', ...point, button: 'left', buttons: 0, clickCount });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const pixel = (x = 200, y = 200) => js(`Array.from(document.querySelector('#stage').getContext('2d').getImageData(${x},${y},1,1).data)`);
|
|
155
|
+
async function exportProject() {
|
|
156
|
+
await click('#export-project');
|
|
157
|
+
const json = await js("document.querySelector('#project-io-textarea').value");
|
|
158
|
+
await click('#project-io-close');
|
|
159
|
+
return JSON.parse(json);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
try {
|
|
163
|
+
const {targetInfos} = await call('Target.getTargets');
|
|
164
|
+
const targetId = targetInfos.find(item => item.type === 'page').targetId;
|
|
165
|
+
({ sessionId } = await call('Target.attachToTarget', { targetId, flatten:true }));
|
|
166
|
+
await call('Runtime.enable');
|
|
167
|
+
await call('Page.enable');
|
|
168
|
+
await call('Page.navigate', { url:`http://127.0.0.1:${server.address().port}/` });
|
|
169
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
170
|
+
if (await js("document.querySelector('#stage')?.dataset.tool === 'select'")) break;
|
|
171
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
172
|
+
}
|
|
173
|
+
// Preview plays by default; these checks inspect still frames, so open Preview paused.
|
|
174
|
+
// The autoplay check below turns it back on.
|
|
175
|
+
await js("localStorage.setItem('swoof-studio.preview-autoplay', 'off')");
|
|
176
|
+
// Studio imports the Swoof keyboard listeners before it needs a runtime stage.
|
|
177
|
+
assert.equal(await js("import('./swooflib/stage.js').then(m => m.stageSingleton === null)"), true);
|
|
178
|
+
await key('m', 'KeyM', 77);
|
|
179
|
+
assert.equal(await js("document.querySelector('#stage').dataset.tool"), 'rectangle');
|
|
180
|
+
await key('v', 'KeyV', 86);
|
|
181
|
+
await key('Tab', 'Tab', 9);
|
|
182
|
+
assert.equal(await js('document.activeElement !== document.body'), true);
|
|
183
|
+
assert.deepEqual(errors, []);
|
|
184
|
+
const background = await pixel();
|
|
185
|
+
await scrub(20);
|
|
186
|
+
await click('[data-tool="rectangle"]');
|
|
187
|
+
await drag(150, 160, 250, 240);
|
|
188
|
+
assert.equal(await js("document.querySelector('#playhead').value"), '20');
|
|
189
|
+
const fill = await pixel();
|
|
190
|
+
assert.notDeepEqual(fill, background);
|
|
191
|
+
await scrub(19);
|
|
192
|
+
assert.deepEqual(await pixel(), background);
|
|
193
|
+
await scrub(20);
|
|
194
|
+
await edit('duplicate');
|
|
195
|
+
await edit('removeKey');
|
|
196
|
+
await click('#undo');
|
|
197
|
+
assert.equal(await js("document.querySelectorAll('.keyframe-marker').length"), 3);
|
|
198
|
+
await click('#redo');
|
|
199
|
+
assert.equal(await js("document.querySelectorAll('.keyframe-marker').length"), 2);
|
|
200
|
+
await scrub(24);
|
|
201
|
+
await edit('blank');
|
|
202
|
+
assert.deepEqual(await pixel(), background);
|
|
203
|
+
await scrub(26);
|
|
204
|
+
await click('#add-keyframe');
|
|
205
|
+
assert.deepEqual(await pixel(), fill);
|
|
206
|
+
await change('scene-duration', 10);
|
|
207
|
+
assert.equal(await js("document.querySelector('#scene-duration').value"), '120');
|
|
208
|
+
assert.match(await js("document.querySelector('#status-message').textContent"), /keyframe/);
|
|
209
|
+
await edit('insertFrame');
|
|
210
|
+
await edit('removeFrame');
|
|
211
|
+
const original = await exportProject();
|
|
212
|
+
await click('#import-project');
|
|
213
|
+
await change('project-io-textarea', JSON.stringify(original));
|
|
214
|
+
await click('#project-io-submit');
|
|
215
|
+
assert.deepEqual(await exportProject(), original);
|
|
216
|
+
await scrub(19);
|
|
217
|
+
assert.deepEqual(await pixel(), background);
|
|
218
|
+
await scrub(20);
|
|
219
|
+
assert.deepEqual(await pixel(), fill);
|
|
220
|
+
|
|
221
|
+
await click('.layer-entry.is-active [title="Hide layer"]');
|
|
222
|
+
assert.deepEqual(await pixel(), background);
|
|
223
|
+
await click('.layer-entry.is-active [title="Show layer"]');
|
|
224
|
+
assert.deepEqual(await pixel(), fill);
|
|
225
|
+
await click('.timeline-lane-label');
|
|
226
|
+
await click('.layer-entry.is-active [title="Lock layer"]');
|
|
227
|
+
assert.equal(await js("document.querySelector('#add-keyframe').disabled"), true);
|
|
228
|
+
await click('.layer-entry.is-active [title="Unlock layer"]');
|
|
229
|
+
|
|
230
|
+
// Selecting the first object's lane switches the drawing layer as well.
|
|
231
|
+
await click('#add-layer');
|
|
232
|
+
await click('.timeline-lane-label');
|
|
233
|
+
await click('[data-tool="ellipse"]');
|
|
234
|
+
await drag(325, 200);
|
|
235
|
+
let scene = (await exportProject()).scenes[0];
|
|
236
|
+
assert.equal(scene.elements[0].layerId, scene.elements[1].layerId);
|
|
237
|
+
await edit('layerBlank');
|
|
238
|
+
assert.deepEqual(await pixel(), background);
|
|
239
|
+
await click('#undo');
|
|
240
|
+
assert.deepEqual(await pixel(), fill);
|
|
241
|
+
|
|
242
|
+
await click('[data-tool="text"]');
|
|
243
|
+
await drag(520, 290);
|
|
244
|
+
await change('text-edit-input', 'Hello', 'input');
|
|
245
|
+
await click('#text-edit-done');
|
|
246
|
+
assert.equal((await exportProject()).scenes[0].elements.at(-1).keyframes.at(-1).text, 'Hello');
|
|
247
|
+
await click('#undo');
|
|
248
|
+
assert.notEqual((await exportProject()).scenes[0].elements.at(-1).keyframes.at(-1).text, 'Hello');
|
|
249
|
+
await click('#redo');
|
|
250
|
+
await click('[data-tool="pen"]');
|
|
251
|
+
await drag(150, 300); await drag(250, 330); await click('#finish-path');
|
|
252
|
+
scene = (await exportProject()).scenes[0];
|
|
253
|
+
assert.equal(scene.elements.at(-1).type, 'path');
|
|
254
|
+
await click('#undo');
|
|
255
|
+
assert.equal((await exportProject()).scenes[0].elements.length, scene.elements.length - 1);
|
|
256
|
+
await click('#redo');
|
|
257
|
+
await scrub(30);
|
|
258
|
+
await click('[data-tool="pen"]');
|
|
259
|
+
await drag(150, 300, 165, 315);
|
|
260
|
+
const pathKeys = (await exportProject()).scenes[0].elements.at(-1).keyframes;
|
|
261
|
+
assert.notDeepEqual(pathKeys.find(k => k.frame === 30).points, pathKeys.find(k => k.frame === 20).points);
|
|
262
|
+
await click('#undo');
|
|
263
|
+
assert.equal((await exportProject()).scenes[0].elements.at(-1).keyframes.at(-1).frame, 20);
|
|
264
|
+
await click('#add-scene'); await click('#undo');
|
|
265
|
+
assert.equal((await exportProject()).scenes.length, 1);
|
|
266
|
+
await click('#redo');
|
|
267
|
+
assert.equal((await exportProject()).scenes.length, 2);
|
|
268
|
+
// Scrubbing cannot fire the button; the authored hotspot appears from frame 20.
|
|
269
|
+
await click('.scene-entry');
|
|
270
|
+
await scrub(20);
|
|
271
|
+
await click('.timeline-lane-label');
|
|
272
|
+
await click('[data-tool="select"]');
|
|
273
|
+
await drag(200, 200, 230, 200);
|
|
274
|
+
assert.equal((await exportProject()).scenes[0].elements[0].keyframes.find(k => k.frame === 20).x, 230);
|
|
275
|
+
await click('#undo');
|
|
276
|
+
// Preview starts playback, as Flash's Test Movie does.
|
|
277
|
+
await js("localStorage.removeItem('swoof-studio.preview-autoplay')");
|
|
278
|
+
await scrub(1);
|
|
279
|
+
await click('#preview-button');
|
|
280
|
+
assert.equal(await js("document.querySelector('#play-button').textContent"), 'Pause');
|
|
281
|
+
await new Promise(resolve => setTimeout(resolve, 400));
|
|
282
|
+
assert.ok(Number(await js("document.querySelector('#playhead').value")) > 1, 'Preview plays');
|
|
283
|
+
await click('#preview-button');
|
|
284
|
+
await js("localStorage.setItem('swoof-studio.preview-autoplay', 'off')");
|
|
285
|
+
await scrub(20);
|
|
286
|
+
await click('#element-is-button');
|
|
287
|
+
await click('#preview-button');
|
|
288
|
+
await drag(200, 200);
|
|
289
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Scene 1');
|
|
290
|
+
await click('#stop-button');
|
|
291
|
+
await scrub(20);
|
|
292
|
+
await click('#play-button');
|
|
293
|
+
await click('#play-button');
|
|
294
|
+
await drag(200, 200);
|
|
295
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Scene 2');
|
|
296
|
+
await click('#stop-button');
|
|
297
|
+
await click('#import-project');
|
|
298
|
+
const rect = { type: 'rectangle', width: 80, height: 60, y: 200 };
|
|
299
|
+
await change('project-io-textarea', JSON.stringify({
|
|
300
|
+
stage: { width: 800, height: 450, frameRate: 24 },
|
|
301
|
+
scenes: [{ durationFrames: 20, elements: [
|
|
302
|
+
{ ...rect, id: 'red', x: 200, fill: '#ff0000', keyframes: [{ frame: 1 }, { frame: 20, x: 240 }] },
|
|
303
|
+
{ ...rect, id: 'blue', x: 230, fill: '#0000ff' },
|
|
304
|
+
{ ...rect, id: 'button', x: 340, buttonAction: { type: 'gotoFrame', target: 10 } },
|
|
305
|
+
{ type: 'text', id: 'input', x: 520, y: 200, width: 100, height: 60, inputText: true, text: '' },
|
|
306
|
+
] }],
|
|
307
|
+
}));
|
|
308
|
+
await click('#project-io-submit');
|
|
309
|
+
await click('[data-tool="select"]');
|
|
310
|
+
assert.deepEqual(await pixel(), [0, 0, 255, 255]);
|
|
311
|
+
await drag(178, 200);
|
|
312
|
+
await drag(340, 200, 340, 200, 8);
|
|
313
|
+
assert.equal(await js("document.querySelector('#group-objects').disabled"), false);
|
|
314
|
+
await key('g', 'KeyG', 71, 2);
|
|
315
|
+
assert.equal(await js("document.querySelectorAll('.group-member').length"), 2);
|
|
316
|
+
assert.deepEqual(await pixel(), [255, 0, 0, 255]);
|
|
317
|
+
await click('#lower-objects');
|
|
318
|
+
assert.deepEqual(await pixel(), [0, 0, 255, 255]);
|
|
319
|
+
await click('#raise-objects');
|
|
320
|
+
assert.deepEqual(await pixel(), [255, 0, 0, 255]);
|
|
321
|
+
await drag(200, 200, 220, 210);
|
|
322
|
+
const grouped = await exportProject();
|
|
323
|
+
const members = grouped.scenes[0].elements.filter(e => e.groupId);
|
|
324
|
+
assert.deepEqual(members.map(e => [e.id, e.x, e.y]), [['red', 220, 210], ['button', 360, 210]]);
|
|
325
|
+
assert.equal(members[0].keyframes.at(-1).x, 260);
|
|
326
|
+
assert.equal(members[0].groupId, members[1].groupId);
|
|
327
|
+
await drag(400, 210, 455, 210);
|
|
328
|
+
const scaled = (await exportProject()).scenes[0].elements.filter(e => e.groupId);
|
|
329
|
+
assert.ok(scaled.every(e => Math.abs(e.scaleX - 1.5) < 0.02 && e.scaleX === e.scaleY));
|
|
330
|
+
await click('#undo');
|
|
331
|
+
assert.deepEqual(await exportProject(), grouped);
|
|
332
|
+
const unit = await js("800 / document.querySelector('#stage').getBoundingClientRect().width");
|
|
333
|
+
const radius = 30 + 24 * unit;
|
|
334
|
+
await drag(290, 210 - radius, 290 + radius, 210);
|
|
335
|
+
const rotated = (await exportProject()).scenes[0].elements.filter(e => e.groupId);
|
|
336
|
+
assert.ok(rotated.every(e => Math.abs(e.rotation - 90) < 1));
|
|
337
|
+
await click('#undo');
|
|
338
|
+
await click('#ungroup-objects');
|
|
339
|
+
assert.equal(await js("document.querySelectorAll('.group-member').length"), 0);
|
|
340
|
+
await click('#undo');
|
|
341
|
+
assert.deepEqual(await exportProject(), grouped);
|
|
342
|
+
await click('#import-project');
|
|
343
|
+
await change('project-io-textarea', JSON.stringify(grouped));
|
|
344
|
+
await click('#project-io-submit');
|
|
345
|
+
assert.deepEqual(await exportProject(), grouped);
|
|
346
|
+
await click('.group-entry');
|
|
347
|
+
|
|
348
|
+
// Add the input to the group and exercise both types of interactive child.
|
|
349
|
+
await js("Array.from(document.querySelectorAll('.element-entry')).find(el => el.textContent.includes('text 4')).dispatchEvent(new MouseEvent('click', { bubbles: true, shiftKey: true }))");
|
|
350
|
+
await click('#group-objects');
|
|
351
|
+
assert.equal(await js("document.querySelectorAll('.group-member').length"), 3);
|
|
352
|
+
await click('#preview-button');
|
|
353
|
+
await drag(520, 200);
|
|
354
|
+
await key('m', 'KeyM', 77, 0, 'm');
|
|
355
|
+
assert.equal(await js('document.activeElement.value'), 'm');
|
|
356
|
+
await drag(360, 210);
|
|
357
|
+
assert.equal(await js("document.querySelector('#playhead').value"), '10');
|
|
358
|
+
assert.equal(await js("document.querySelector('[data-element-id=input]').value"), 'm');
|
|
359
|
+
|
|
360
|
+
await click('#stop-button');
|
|
361
|
+
await click('#add-scene');
|
|
362
|
+
await click('#new-symbol');
|
|
363
|
+
await change('scene-name', 'Pulse');
|
|
364
|
+
await change('scene-duration', 2);
|
|
365
|
+
await click('[data-tool="rectangle"]');
|
|
366
|
+
await drag(135, 75, 185, 125);
|
|
367
|
+
await scrub(2);
|
|
368
|
+
await click('#add-keyframe');
|
|
369
|
+
await js(`{ const field = document.querySelector('[data-property=fill]');
|
|
370
|
+
field.value = '#ff0000'; field.dispatchEvent(new Event('change', { bubbles: true })); }`);
|
|
371
|
+
await click('#leave-symbol');
|
|
372
|
+
await click('#place-symbol');
|
|
373
|
+
await drag(400, 225, 200, 225);
|
|
374
|
+
await scrub(2);
|
|
375
|
+
await click('#place-symbol');
|
|
376
|
+
const sceneWithInstances = (await exportProject()).scenes.at(-1);
|
|
377
|
+
assert.equal(sceneWithInstances.elements.length, 2);
|
|
378
|
+
assert.equal(sceneWithInstances.elements[0].symbolId, sceneWithInstances.elements[1].symbolId);
|
|
379
|
+
assert.deepEqual(await pixel(200, 225), [255, 0, 0, 255]);
|
|
380
|
+
assert.deepEqual(await pixel(400, 225), fill);
|
|
381
|
+
await scrub(3);
|
|
382
|
+
assert.deepEqual(await pixel(200, 225), fill);
|
|
383
|
+
assert.deepEqual(await pixel(400, 225), [255, 0, 0, 255]);
|
|
384
|
+
await click('#edit-symbol');
|
|
385
|
+
assert.equal(await js("document.querySelector('#place-symbol').disabled"), true);
|
|
386
|
+
await click('.timeline-lane-label');
|
|
387
|
+
await js(`{ const field = document.querySelector('[data-property=fill]');
|
|
388
|
+
field.value = '#0000ff'; field.dispatchEvent(new Event('change', { bubbles: true })); }`);
|
|
389
|
+
await click('#leave-symbol');
|
|
390
|
+
assert.deepEqual(await pixel(200, 225), [0, 0, 255, 255]);
|
|
391
|
+
await scrub(2);
|
|
392
|
+
assert.deepEqual(await pixel(400, 225), [0, 0, 255, 255]);
|
|
393
|
+
await click('#undo');
|
|
394
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Pulse');
|
|
395
|
+
assert.deepEqual(await pixel(160, 100), fill);
|
|
396
|
+
await click('#redo');
|
|
397
|
+
assert.deepEqual(await pixel(400, 225), [0, 0, 255, 255]);
|
|
398
|
+
await js("Array.from(document.querySelectorAll('.timeline-lane-label')).at(-1).click()");
|
|
399
|
+
await change('instance-mode', 'single');
|
|
400
|
+
await change('instance-first', 2);
|
|
401
|
+
assert.deepEqual(await pixel(400, 225), [255, 0, 0, 255]);
|
|
402
|
+
await scrub(5);
|
|
403
|
+
assert.deepEqual(await pixel(400, 225), [255, 0, 0, 255]);
|
|
404
|
+
await scrub(2);
|
|
405
|
+
|
|
406
|
+
// Nest Pulse in another definition and verify the displayed pixels and round trip.
|
|
407
|
+
await click('#new-symbol');
|
|
408
|
+
await change('scene-name', 'Pair');
|
|
409
|
+
await change('symbol-library', sceneWithInstances.elements[0].symbolId);
|
|
410
|
+
await click('#place-symbol');
|
|
411
|
+
await click('#leave-symbol');
|
|
412
|
+
await click('#place-symbol');
|
|
413
|
+
await drag(400, 225, 600, 225);
|
|
414
|
+
assert.deepEqual(await pixel(600, 225), [0, 0, 255, 255]);
|
|
415
|
+
await scrub(3);
|
|
416
|
+
assert.deepEqual(await pixel(600, 225), [255, 0, 0, 255]);
|
|
417
|
+
await doubleClickStage(600, 225);
|
|
418
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Pair');
|
|
419
|
+
await doubleClickStage(160, 100);
|
|
420
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Pulse');
|
|
421
|
+
await click('#leave-symbol');
|
|
422
|
+
assert.equal(await js("document.querySelector('#stage-scene-name').textContent"), 'Pair');
|
|
423
|
+
await click('#leave-symbol');
|
|
424
|
+
assert.equal(await js("document.querySelector('#playhead').value"), '3');
|
|
425
|
+
const nestedProject = await exportProject();
|
|
426
|
+
await click('#import-project');
|
|
427
|
+
await change('project-io-textarea', JSON.stringify(nestedProject));
|
|
428
|
+
await click('#project-io-submit');
|
|
429
|
+
assert.deepEqual(await exportProject(), nestedProject);
|
|
430
|
+
|
|
431
|
+
// Each instance owns its native input and the button that targets it.
|
|
432
|
+
const widget = { id: 'widget', width: 200, height: 120, durationFrames: 2, elements: [
|
|
433
|
+
{ type: 'rectangle', x: 100, y: 20, width: 18, height: 18,
|
|
434
|
+
keyframes: [{ frame: 1, fill: '#ff0000' }, { frame: 2, fill: '#0000ff' }] },
|
|
435
|
+
{ type: 'text', id: 'value', x: 60, y: 60, width: 80, height: 40, inputText: true, text: '' },
|
|
436
|
+
{ type: 'rectangle', id: 'add', x: 155, y: 60, width: 60, height: 40,
|
|
437
|
+
buttonAction: { type: 'editInput', operation: 'insert', value: 'X', target: 'value' } },
|
|
438
|
+
{ type: 'rectangle', x: 40, y: 100, width: 40, height: 20, buttonAction: { type: 'gotoFrame', target: 2 } },
|
|
439
|
+
] };
|
|
440
|
+
const placed = { type: 'symbol', symbolId: 'widget', y: 200, width: 200, height: 120 };
|
|
441
|
+
await click('#import-project');
|
|
442
|
+
await change('project-io-textarea', JSON.stringify({ stage: nestedProject.stage, symbols: [widget],
|
|
443
|
+
scenes: [{ elements: [{ ...placed, x: 200 }, { ...placed, x: 550, rotation: 90 }] }] }));
|
|
444
|
+
await click('#project-io-submit');
|
|
445
|
+
await click('#preview-button');
|
|
446
|
+
await drag(255, 200);
|
|
447
|
+
await drag(550, 255);
|
|
448
|
+
await drag(550, 255);
|
|
449
|
+
assert.deepEqual(await js("Array.from(document.querySelectorAll('#preview-surface textarea'), field => field.value)"), ['X', 'XX']);
|
|
450
|
+
await drag(550, 160);
|
|
451
|
+
assert.equal(await js('document.activeElement.value'), 'XX');
|
|
452
|
+
assert.deepEqual(await pixel(200, 160), [255, 0, 0, 255]);
|
|
453
|
+
await drag(140, 240);
|
|
454
|
+
assert.deepEqual(await pixel(200, 160), [0, 0, 255, 255]);
|
|
455
|
+
assert.equal(await js("document.querySelector('#playhead').value"), '1');
|
|
456
|
+
|
|
457
|
+
await js(`(async () => {
|
|
458
|
+
const { installStage } = await import('./swooflib/stage.js');
|
|
459
|
+
const { Sprite } = await import('./swooflib/graphics.js');
|
|
460
|
+
const stage = installStage();
|
|
461
|
+
const child = new Sprite();
|
|
462
|
+
stage.addChild(child);
|
|
463
|
+
stage.focus = child;
|
|
464
|
+
window.receivedKeys = [];
|
|
465
|
+
for (const type of ['keyDown', 'keyUp']) {
|
|
466
|
+
child.addEventListener(type, e => window.receivedKeys.push([e.type, e.keyCode]));
|
|
467
|
+
}
|
|
468
|
+
})()`);
|
|
469
|
+
await key('a', 'KeyA', 65);
|
|
470
|
+
assert.deepEqual(await js('window.receivedKeys'), [['keyDown', 65], ['keyUp', 65]]);
|
|
471
|
+
await verifyPaintTools({ click, change, drag, js, pixel, exportProject, scrub });
|
|
472
|
+
await verifyControls({ click, change, key, drag, js, exportProject });
|
|
473
|
+
await verifyTriggers({ call, click, change, key, drag, js, exportProject });
|
|
474
|
+
await verifyAppearance({ click, change, js, scrub, pixel, drag, exportProject });
|
|
475
|
+
await verifyMasks({ click, change, js, scrub, pixel, drag, exportProject });
|
|
476
|
+
await verifySceneTransitions({ call, js, click, change, drag, pixel, exportProject });
|
|
477
|
+
await verifyFrameEvents({ click, change, js, scrub, pixel, exportProject });
|
|
478
|
+
await verifyScriptedControls({ game, js, click, change, key });
|
|
479
|
+
await verifyTextFields({ click, change, js, key, exportProject });
|
|
480
|
+
await verifyScriptEditing({ game, click, change, js, key, exportProject });
|
|
481
|
+
const network = { latency: 0, downloadThroughput: -1, uploadThroughput: -1 };
|
|
482
|
+
await call('Network.emulateNetworkConditions', { ...network, offline: true });
|
|
483
|
+
try {
|
|
484
|
+
await verifyMedia({ js, click, change, scrub, pixel, exportProject });
|
|
485
|
+
} finally {
|
|
486
|
+
await call('Network.emulateNetworkConditions', { ...network, offline: false });
|
|
487
|
+
}
|
|
488
|
+
await verifyWorkspace({ call, js, click, change, key, drag, exportProject, profile });
|
|
489
|
+
await verifyAccessibility({ call, js, click, change, key, scrub, exportProject });
|
|
490
|
+
await verifyTheme({ call, js, change, exportProject });
|
|
491
|
+
await verifyProjects({ game, call, js, click, change, key, dialogs });
|
|
492
|
+
await verifyVideoExport({ call, js, click, change, profile });
|
|
493
|
+
await verifyFrameImage({ call, js, click, change, drag, pixel, profile });
|
|
494
|
+
await verifySvgExport({ call, js, click, change, profile });
|
|
495
|
+
await verifyLottie({ call, js, click, change, profile });
|
|
496
|
+
await verifyImportFiles({ call, js, click, change, profile });
|
|
497
|
+
await verifyHtmlExport({ call, js, click, change, profile });
|
|
498
|
+
await verifyExternalResources({ call, js, studio: 'http://127.0.0.1:' + server.address().port, profile });
|
|
499
|
+
assert.deepEqual(errors, []);
|
|
500
|
+
console.log('Passed local image and audio assets, workspace themes, timeline actions, event authoring, nested vector and input masks, gradients and effects, desktop and mobile workspace, authoring, nested symbols, timeline, grouping, preview interactions, keyboard focus, accessible control names, live announcements, video, frame image, SVG and Lottie export, Lottie, SVG and SWF import from one picker and JSON round trip in Chromium.');
|
|
501
|
+
} finally {
|
|
502
|
+
proc.kill();
|
|
503
|
+
await exited;
|
|
504
|
+
server.close();
|
|
505
|
+
await rm(profile, {recursive:true, force:true, maxRetries:3});
|
|
506
|
+
await rm(projectsDir, {recursive:true, force:true, maxRetries:3});
|
|
507
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
|
|
3
|
+
export async function verifySceneTransitions({ call, js, click, change, drag, pixel, exportProject }) {
|
|
4
|
+
const stage = { width: 800, height: 450, background: '#101010', frameRate: 10 };
|
|
5
|
+
const art = { type: 'rectangle', x: 120, y: 120, width: 80, height: 80, strokeWidth: 0 };
|
|
6
|
+
const intro = { id: 'intro', name: 'Intro', elements: [
|
|
7
|
+
{ ...art, id: 'go', fill: '#ff0000', buttonAction: { type: 'gotoScene', target: 'end' } },
|
|
8
|
+
{ type: 'text', id: 'source-field', x: 320, y: 120, text: 'Original', inputText: true },
|
|
9
|
+
] };
|
|
10
|
+
const end = { id: 'end', name: 'End', startFrame: 3, durationFrames: 12, elements: [
|
|
11
|
+
{ ...art, id: 'target', fill: '#0000ff', buttonAction: { type: 'gotoFrame', target: 9 } },
|
|
12
|
+
], events: [{ trigger: 'frameEnter', frame: 3, actions: [{ type: 'gotoFrame', target: 5 }] }] };
|
|
13
|
+
async function load(scenes) {
|
|
14
|
+
await click('#import-project');
|
|
15
|
+
await change('project-io-textarea', JSON.stringify({ stage, scenes }));
|
|
16
|
+
await click('#project-io-submit');
|
|
17
|
+
assert.equal(await js("document.querySelector('#project-io-dialog').open"), false);
|
|
18
|
+
}
|
|
19
|
+
// Read the composited screen pixel, including both the outgoing snapshot and the incoming live stage.
|
|
20
|
+
async function painted() {
|
|
21
|
+
const clip = await js(`(() => { const r = document.querySelector('#stage').getBoundingClientRect();
|
|
22
|
+
return { x: Math.floor(r.x + 120*r.width/800), y: Math.floor(r.y + 140*r.height/450), width: 1, height: 1, scale: 1 }; })()`);
|
|
23
|
+
const { data } = await call('Page.captureScreenshot', { format: 'png', clip });
|
|
24
|
+
return js(`(async () => { const img = new Image(); img.src = 'data:image/png;base64,${data}'; await img.decode();
|
|
25
|
+
const c = document.createElement('canvas'), ctx = c.getContext('2d'); ctx.drawImage(img,0,0);
|
|
26
|
+
return Array.from(ctx.getImageData(0,0,1,1).data); })()`);
|
|
27
|
+
}
|
|
28
|
+
const at = () => js("Number(document.getElementById('playhead').value)");
|
|
29
|
+
const active = () => js("document.querySelector('.stage-mat').inert");
|
|
30
|
+
await load([intro, end]);
|
|
31
|
+
await click('.scene-entry:last-child');
|
|
32
|
+
await change('scene-transition-type', 'crossfade');
|
|
33
|
+
await change('scene-transition-duration', '4');
|
|
34
|
+
await change('scene-transition-easing', 'easeIn');
|
|
35
|
+
const authored = await exportProject();
|
|
36
|
+
assert.deepEqual(authored.scenes[1].transition, { type: 'crossfade', durationFrames: 4, easing: 'easeIn' });
|
|
37
|
+
await change('scene-transition-duration', '0');
|
|
38
|
+
assert.deepEqual(await exportProject(), authored);
|
|
39
|
+
await click('#undo');
|
|
40
|
+
assert.equal(await js("document.getElementById('scene-transition-easing').value"), 'linear');
|
|
41
|
+
await click('#redo');
|
|
42
|
+
await click('.scene-entry:first-child');
|
|
43
|
+
await js(`{ const request = window.requestAnimationFrame, cancel = window.cancelAnimationFrame;
|
|
44
|
+
const callbacks = new Map(); let sequence = 0, clock = 0;
|
|
45
|
+
window.requestAnimationFrame = cb => { callbacks.set(++sequence, cb); return sequence; };
|
|
46
|
+
window.cancelAnimationFrame = id => callbacks.delete(id);
|
|
47
|
+
window.stepTransition = ms => { clock += ms; const queued = [...callbacks.values()]; callbacks.clear(); queued.forEach(cb => cb(clock)); };
|
|
48
|
+
window.restoreTransitionClock = () => { window.requestAnimationFrame = request; window.cancelAnimationFrame = cancel; }; }`);
|
|
49
|
+
try {
|
|
50
|
+
await click('#preview-button');
|
|
51
|
+
await js(`{ const input = document.querySelector('#preview-surface textarea'); input.value = 'Edited';
|
|
52
|
+
input.dispatchEvent(new Event('input')); }`);
|
|
53
|
+
await drag(120,120);
|
|
54
|
+
assert.ok(await active());
|
|
55
|
+
assert.equal(await at(), 3);
|
|
56
|
+
assert.equal(await js("document.querySelector('.scene-transition textarea').value"), 'Edited');
|
|
57
|
+
await js('stepTransition(0); stepTransition(200)');
|
|
58
|
+
const from = await js("Array.from(document.querySelector('.scene-transition-frame > canvas').getContext('2d').getImageData(120,140,1,1).data)");
|
|
59
|
+
const to = await pixel(120,140);
|
|
60
|
+
const mixed = await painted();
|
|
61
|
+
assert.notDeepEqual(from, to);
|
|
62
|
+
assert.ok(mixed.every((channel, i) => Math.abs(channel - (from[i] * .75 + to[i] * .25)) <= 2),
|
|
63
|
+
'Eased crossfade blends the painted outgoing and incoming colors');
|
|
64
|
+
await drag(120,120);
|
|
65
|
+
assert.equal(await at(), 3);
|
|
66
|
+
await js('stepTransition(200)');
|
|
67
|
+
assert.equal(await active(), false);
|
|
68
|
+
assert.equal(await at(), 5, 'Destination entry actions run after the blend');
|
|
69
|
+
await drag(120,120);
|
|
70
|
+
assert.equal(await at(), 9);
|
|
71
|
+
await click('#preview-button');
|
|
72
|
+
assert.deepEqual(await exportProject(), authored);
|
|
73
|
+
|
|
74
|
+
const entry = { ...intro, events: [{ trigger: 'timelineStart', actions: [{ type: 'gotoScene', target: 'end', play: true }] }] };
|
|
75
|
+
await load([entry, { ...end, events: [], transition: { type: 'wipe', easing: 'linear', durationFrames: 4 } }]);
|
|
76
|
+
await click('#play-button');
|
|
77
|
+
assert.ok(await active());
|
|
78
|
+
await js('stepTransition(0); stepTransition(200)');
|
|
79
|
+
assert.equal(await at(), 3);
|
|
80
|
+
assert.deepEqual(await painted(), await pixel(120,140), 'The wipe reveals the left half of the destination');
|
|
81
|
+
await js('stepTransition(200); stepTransition(0); stepTransition(100)');
|
|
82
|
+
assert.equal(await at(), 4, 'Playback starts at the destination after the transition completes');
|
|
83
|
+
await click('#stop-button');
|
|
84
|
+
await click('#preview-button');
|
|
85
|
+
assert.ok(await active());
|
|
86
|
+
await click('#stop-button');
|
|
87
|
+
await js('stepTransition(1000)');
|
|
88
|
+
assert.equal(await active(), false);
|
|
89
|
+
assert.equal(await js("document.getElementById('stage-scene-name').textContent"), 'Intro');
|
|
90
|
+
assert.deepEqual(await pixel(120,120), [255,0,0,255]);
|
|
91
|
+
} finally {
|
|
92
|
+
await js('restoreTransitionClock()');
|
|
93
|
+
}
|
|
94
|
+
}
|