makepad/libs/tween/tests/golden/overwrite.rs
vjroger a8fb6c4374 widgets, libs: a tween engine, the theme lab, the designer and the surface material, on the family crates
The widget half of the widget catalogue's later work, ported onto
makepad-widgets-core and the family crates.

- libs/tween: a dependency-free tween and timeline engine -- nested
  timelines with positions and labels, stagger, repeat and yoyo, seek and
  reverse, time scale, a ticker with lag smoothing, a global pause and
  reduced motion, colour-space interpolation, keyframes and motion paths.
  The core binds it to the widget tree (tween, a widget's TweenHost),
  gives script a mod.tween (tween_script) and a live inspector
  (tween_inspect, tween_inspector). The Animator's Ease now answers from
  the engine's easing, so the curves have one source; the Animator keeps
  its states, its keyframe timelines and its own clock.
- libs/gizmo and a Gizmo3d / ViewCube widget.
- core: the ease editor, the sequencer, diagonal headings, hotkeys, the
  hotkey editor and keyboard map, the overlay layer host, a conceding row
  and the width a widget would take without drawing; a theme mix and a
  person's own theme edits that survive a style reload (theme_mix,
  set_theme_edit), both taken off by set_base_theme.
- the surface material: buttons, check boxes, toggles, sliders and knobs
  carry the moulded material behind one uniform, a press idiom per sign
  of material_press, and four sheets that raise it: neumorphic, molded,
  glossy and milled.
- the sheets: a row of fields is one height under every sheet. A sheet
  line that names a widget the app did not register (a family left out)
  is skipped when the sheet installs, so the date fields a sheet sizes
  need the dates family only where it is linked.
- extras: the gradient editor, registered with the colour picker it
  builds on.
- tweaker: the designer (a widget's literal located and edited in its
  source as hunks), the theme lab and the theme builder. The window reads
  the docked panel's band through the tweaker's hooks.
- the panel no longer wears the app's theme (the design surface keeps
  its own palette), so the worn-theme tests go with it.

Five theme builder tests fail here as they do on the branch this comes
from (every_built_theme_reads and four more on text contrast);
radial_menu's tab_under_an_open_menu_finds_nowhere_to_go fails here as it
does on dev.
2026-09-29 01:55:12 +02:00

402 lines
38 KiB
Rust

// GENERATED by gsap/emit_rust.js from gsap/out/overwrite.json -- do not edit by hand.
// GSAP 3.15.0 under Node v22.22.2; generator golden.js; root time after the frame tick: 0.
// Numbers are the golden doubles (shortest round-trip repr, bit-exact). Tolerances are the test's business
// (see design/gsap_reconciliation.md D: GSAP rounds written property values to 1e-6, so value columns need 5e-7).
// Each step is a flattened snapshot (obj.x, t1_has_parent, callbacks.0, ...), in the order the GSAP calls ran.
#![allow(
dead_code,
unused_imports,
clippy::approx_constant,
clippy::excessive_precision,
clippy::unreadable_literal
)]
use super::common::*;
pub const GSAP_VERSION: &str = "3.15.0";
pub const NOTES: &[&str] = &["All tweens live on the root timeline; the root never advances (frozen clock), so t1 \"playing\" means un-paused with its start aligned so that root time 0 == t1 time 0.5.", "t1_live_props_internal_ptLookup / t1_overwritten_props_internal_op read GSAP internals (_ptLookup, _op); t1.vars is never modified by overwriting.", "gsap.getTweensOf(obj) lists tweens still attached to a timeline; a fully killed tween is removed from its parent."];
#[derive(Clone, Copy, Debug)]
pub struct Step {
pub at: &'static str,
pub vals: Pairs,
}
#[derive(Clone, Copy, Debug)]
pub struct OverwriteCase {
pub id: &'static str,
pub description: &'static str,
pub overwrite: &'static str,
pub gsap_calls: &'static [&'static str],
pub steps: &'static [Step],
}
pub const CASES: &[OverwriteCase] = &[
OverwriteCase { id: "auto_t1_playing", description: "overwrite:\"auto\", t1 un-paused (on root) and moved to 0.5 -> t1 is \"active\" at t2 init time", overwrite: "auto",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\"})", "t1.totalTime(0.5)", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:\"auto\",paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(1.0)), ("t1_live_props_internal_ptLookup.0", Val::S("y")),
("t1_overwritten_props_internal_op.len", Val::F(1.0)), ("t1_overwritten_props_internal_op.0", Val::S("x")), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(1.0)), ("t1_live_props_internal_ptLookup.0", Val::S("y")),
("t1_overwritten_props_internal_op.len", Val::F(1.0)), ("t1_overwritten_props_internal_op.0", Val::S("x")), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(1.0)), ("t1_live_props_internal_ptLookup.0", Val::S("y")),
("t1_overwritten_props_internal_op.len", Val::F(1.0)), ("t1_overwritten_props_internal_op.0", Val::S("x")), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "auto_t1_paused", description: "overwrite:\"auto\", t1 PAUSED at 0.5 -> paused tweens are ignored by auto-overwrite (_ts == 0)", overwrite: "auto",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\",paused:true})", "t1.totalTime(0.5)", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:\"auto\",paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(100.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "auto_t1_not_started", description: "overwrite:\"auto\", t1 not yet started (delay:1, never rendered) -> not killed", overwrite: "auto",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\",delay:1})", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:\"auto\",paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(100.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "true_t1_playing", description: "overwrite:true, t1 playing at 0.5 -> killed immediately at t2 construction", overwrite: "true",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\"})", "t1.totalTime(0.5)", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:true,paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("t1:onInterrupt")),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "true_t1_paused", description: "overwrite:true, t1 paused at 0.5 -> still killed (overwrite:true ignores state)", overwrite: "true",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\",paused:true})", "t1.totalTime(0.5)", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:true,paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("t1:onInterrupt")),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "true_t1_not_started", description: "overwrite:true, t1 not started", overwrite: "true",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\",delay:1})", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:true,paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("t1:onInterrupt")),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(0.0)), ("obj.y", Val::F(0.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(false)),
("t1_live_props_internal_ptLookup.len", Val::F(0.0)), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(0.0)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(100.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "false_t1_playing", description: "overwrite:false (the default): both tweens keep running; last render wins", overwrite: "false",
gsap_calls: &["obj={x:0,y:0}", "t1=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\"})", "t1.totalTime(0.5)", "t2=gsap.to(obj,{x:200,duration:1,ease:\"none\",overwrite:false,paused:true})", "t2.totalTime(0)", "t1.totalTime(1)", "t2.totalTime(1)"],
steps: &[
Step { at: "after t1 setup", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2 created", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(0)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("t1_isActive", Val::B(true)), ("t1_has_parent", Val::B(true)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(2.0)), ("t1_in_getTweensOf", Val::B(true)), ("t1_progress", Val::F(0.5)),
("callbacks.len", Val::F(0.0)), ("t2_isActive", Val::B(false)),
] },
Step { at: "after t1.totalTime(1)", vals: &[
("obj.x", Val::F(100.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
Step { at: "after t2.totalTime(1)", vals: &[
("obj.x", Val::F(200.0)), ("obj.y", Val::F(100.0)), ("t1_isActive", Val::B(false)), ("t1_has_parent", Val::B(false)), ("t1_initted", Val::B(true)),
("t1_live_props_internal_ptLookup.len", Val::F(2.0)), ("t1_live_props_internal_ptLookup.0", Val::S("x")),
("t1_live_props_internal_ptLookup.1", Val::S("y")), ("t1_overwritten_props_internal_op.len", Val::F(0.0)), ("t1_vars_has_x", Val::B(true)),
("t1_vars_has_y", Val::B(true)), ("getTweensOf_count", Val::F(1.0)), ("t1_in_getTweensOf", Val::B(false)), ("t1_progress", Val::F(1.0)),
("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "design_auto_single_prop", description: "design 12.9 T12a: A a:0->100 playing at 0.5; B a:->0 overwrite auto: at B's first render A loses its only prop, is interrupted (onInterrupt) and removed; B starts from 50", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{a:100,duration:1,ease:\"none\",onInterrupt})", "A.totalTime(0.5)", "B=gsap.to(obj,{a:0,duration:1,ease:\"none\",overwrite:\"auto\",paused:true})", "B.totalTime(0); B.totalTime(0.5); A.totalTime(0.8)"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after B created", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after B.totalTime(0)", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(false)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(1.0)),
("callbacks.0", Val::S("A:onInterrupt")),
] },
Step { at: "after B.totalTime(0.5)", vals: &[
("obj.a", Val::F(25.0)), ("A_has_parent", Val::B(false)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after A.totalTime(0.8) (killed: no write)", vals: &[
("obj.a", Val::F(25.0)), ("A_has_parent", Val::B(true)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "design_auto_two_rivals", description: "design 12.9 T12b: two running rivals (overwrite none) on the same prop; a third with auto kills both at its first render", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{a:100,duration:1}); A.totalTime(0.5)", "A2=gsap.to(obj,{a:50,duration:2}); A2.totalTime(0.5)", "C=gsap.to(obj,{a:-100,duration:1,overwrite:\"auto\",paused:true}); C.totalTime(0)"],
steps: &[
Step { at: "after A, A2 at 0.5", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A2_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after C.totalTime(0)", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(false)), ("A2_has_parent", Val::B(false)), ("callbacks.len", Val::F(2.0)),
("callbacks.0", Val::S("A2:onInterrupt")), ("callbacks.1", Val::S("A:onInterrupt")),
] },
] },
OverwriteCase { id: "design_true_multi_target", description: "design 12.9 T12c: overwrite:true is per target: A tweens [t1,t2]; B on t1 kills only A's t1 part; A keeps moving t2 and stays alive, no onInterrupt", overwrite: "true",
gsap_calls: &["A=gsap.to([t1,t2],{a:100,duration:1,ease:\"none\",onInterrupt}); A.totalTime(0.5)", "B=gsap.to(t1,{a:0,duration:1,overwrite:true,paused:true})", "A.totalTime(1)"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[
("t1.a", Val::F(50.0)), ("t2.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after B created (overwrite:true)", vals: &[
("t1.a", Val::F(50.0)), ("t2.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A_is_active", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after A.totalTime(1)", vals: &[
("t1.a", Val::F(50.0)), ("t2.a", Val::F(100.0)), ("A_has_parent", Val::B(false)), ("A_is_active", Val::B(false)), ("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "design_auto_ignores_finished", description: "design 12.9: a finished tween is not a rival of auto (not linked / outside its global window)", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{a:100,duration:1}); A.totalTime(1)", "B=gsap.to(obj,{a:0,duration:1,overwrite:\"auto\",paused:true}); B.totalTime(0)", "A.totalTime(0.5)"],
steps: &[
Step { at: "after A.totalTime(1) (completed, removed from the root)", vals: &[
("obj.a", Val::F(100.0)), ("A_has_parent", Val::B(false)), ("A_initted", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after B.totalTime(0)", vals: &[
("obj.a", Val::F(100.0)), ("A_has_parent", Val::B(false)), ("A_initted", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after A.totalTime(0.5) (A still writes: it was not killed)", vals: &[
("obj.a", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("A_initted", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
] },
OverwriteCase { id: "design_auto_deferred_from", description: "overwrite auto on an immediately rendered from: the creation render writes the start values but the auto kill waits (from(): the first later render, even at 0; fromTo(): the first render with time > 0; to({immediateRender:true}): at creation)", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{x:100,duration:1,ease:\"none\",onInterrupt}); A.totalTime(0.5)", "B=gsap.from(obj,{x:-50,duration:1,overwrite:\"auto\",paused:true})", "B.totalTime(0); B.totalTime(0.1)"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[("obj.x", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B created (immediate render)", vals: &[("obj.x", Val::F(-50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B.totalTime(0)", vals: &[
("obj.x", Val::F(-50.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("A:onInterrupt")),
] },
Step { at: "after B.totalTime(0.1)", vals: &[("obj.x", Val::F(-40.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(0.0))] },
] },
OverwriteCase { id: "design_auto_deferred_fromto", description: "overwrite auto on an immediately rendered fromTo: the creation render writes the start values but the auto kill waits (from(): the first later render, even at 0; fromTo(): the first render with time > 0; to({immediateRender:true}): at creation)", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{x:100,duration:1,ease:\"none\",onInterrupt}); A.totalTime(0.5)", "B=gsap.fromTo(obj,{x:-50},{x:0,duration:1,overwrite:\"auto\",paused:true})", "B.totalTime(0); B.totalTime(0.1)"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[("obj.x", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B created (immediate render)", vals: &[("obj.x", Val::F(-50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B.totalTime(0)", vals: &[("obj.x", Val::F(-50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B.totalTime(0.1)", vals: &[
("obj.x", Val::F(-45.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("A:onInterrupt")),
] },
] },
OverwriteCase { id: "design_auto_deferred_to_immediaterender", description: "overwrite auto on an immediately rendered to_immediateRender: the creation render writes the start values but the auto kill waits (from(): the first later render, even at 0; fromTo(): the first render with time > 0; to({immediateRender:true}): at creation)", overwrite: "auto",
gsap_calls: &["A=gsap.to(obj,{x:100,duration:1,ease:\"none\",onInterrupt}); A.totalTime(0.5)", "B=gsap.to(obj,{x:0,duration:1,overwrite:\"auto\",paused:true,immediateRender:true})", "B.totalTime(0); B.totalTime(0.1)"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[("obj.x", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B created (immediate render)", vals: &[
("obj.x", Val::F(50.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(1.0)), ("callbacks.0", Val::S("A:onInterrupt")),
] },
Step { at: "after B.totalTime(0)", vals: &[("obj.x", Val::F(50.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(0.0))] },
Step { at: "after B.totalTime(0.1)", vals: &[("obj.x", Val::F(45.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(0.0))] },
] },
OverwriteCase { id: "design_kill_tweens_of_props", description: "design 12.9 kill_tweens_of_is_property_level: killTweensOf(obj,\"x\") removes only x; killing the last prop interrupts only when progress < 1", overwrite: "killTweensOf",
gsap_calls: &["A=gsap.to(obj,{x:100,y:100,duration:1,ease:\"none\",onInterrupt}); A.totalTime(0.5)", "gsap.killTweensOf(obj,\"x\")", "A.totalTime(1)", "gsap.killTweensOf(obj,\"y\")"],
steps: &[
Step { at: "after A.totalTime(0.5)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after gsap.killTweensOf(obj,\"x\")", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(50.0)), ("A_has_parent", Val::B(true)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after A.totalTime(1)", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(100.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(0.0)),
] },
Step { at: "after gsap.killTweensOf(obj,\"y\")", vals: &[
("obj.x", Val::F(50.0)), ("obj.y", Val::F(100.0)), ("A_has_parent", Val::B(false)), ("callbacks.len", Val::F(0.0)),
] },
] },
];