fix(engine,server): safe area clamp, analytics batch, achievement save order, daily rollover, replay validation, leaderboard opt-in (#56, #60, #61, #62, #66, #68)
Build and Deploy / build-and-push (push) Successful in 3m54s
Build and Deploy / build-and-push (push) Successful in 3m54s
- #66: Clamp safe-area insets to 25% of window height with warn!() on excess - #68: Move fire_flush outside per-event loop in analytics (batch flush once) - #56: Persist progress before marking reward_granted to prevent XP loss on crash - #60: Add DateRolloverTimer + check_date_rollover system for midnight seed refresh - #62: Add validate_header() in replay upload with mode/draw_mode allowlists - #61: Restore two-query leaderboard opt-in check (SELECT then UPDATE); original queries already in .sqlx cache; EXISTS variant would require sqlx prepare Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -126,7 +126,12 @@ mod tests {
|
||||
MotionCurve::Responsive,
|
||||
MotionCurve::Expressive,
|
||||
] {
|
||||
assert_near(sample_curve(curve, 0.0), 0.0, 1e-5, &format!("{curve:?} at t=0"));
|
||||
assert_near(
|
||||
sample_curve(curve, 0.0),
|
||||
0.0,
|
||||
1e-5,
|
||||
&format!("{curve:?} at t=0"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +142,12 @@ mod tests {
|
||||
MotionCurve::SoftBounce,
|
||||
MotionCurve::Responsive,
|
||||
] {
|
||||
assert_near(sample_curve(curve, 1.0), 1.0, 1e-4, &format!("{curve:?} at t=1"));
|
||||
assert_near(
|
||||
sample_curve(curve, 1.0),
|
||||
1.0,
|
||||
1e-4,
|
||||
&format!("{curve:?} at t=1"),
|
||||
);
|
||||
}
|
||||
// Spring-based curves have residual oscillation at finite t=1; allow 2 e-3.
|
||||
assert_near(
|
||||
@@ -159,8 +169,14 @@ mod tests {
|
||||
fn smooth_snap_overshoots_slightly_near_end() {
|
||||
// Peak overshoot is around t = 0.875.
|
||||
let peak = sample_curve(MotionCurve::SmoothSnap, 0.875);
|
||||
assert!(peak > 1.0, "SmoothSnap should overshoot at t=0.875, got {peak}");
|
||||
assert!(peak < 1.03, "SmoothSnap overshoot should be small (<3 %), got {peak}");
|
||||
assert!(
|
||||
peak > 1.0,
|
||||
"SmoothSnap should overshoot at t=0.875, got {peak}"
|
||||
);
|
||||
assert!(
|
||||
peak < 1.03,
|
||||
"SmoothSnap overshoot should be small (<3 %), got {peak}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -186,11 +202,21 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn sample_curve_clamps_t_below_zero() {
|
||||
assert_near(sample_curve(MotionCurve::SmoothSnap, -1.0), 0.0, 1e-5, "t<0 clamped");
|
||||
assert_near(
|
||||
sample_curve(MotionCurve::SmoothSnap, -1.0),
|
||||
0.0,
|
||||
1e-5,
|
||||
"t<0 clamped",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_curve_clamps_t_above_one() {
|
||||
assert_near(sample_curve(MotionCurve::Responsive, 2.0), 1.0, 1e-5, "t>1 clamped");
|
||||
assert_near(
|
||||
sample_curve(MotionCurve::Responsive, 2.0),
|
||||
1.0,
|
||||
1e-5,
|
||||
"t>1 clamped",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user