Skip to content

feat(nsgotest): run a frame stamped with a given time - #2379

Merged
houko merged 1 commit into
nsgo-dev:mainfrom
Laotree:feat/frame-at
Nov 25, 2026
Merged

houko merged 1 commit into
nsgo-dev:mainfrom
Laotree:feat/frame-at

Conversation

@Laotree

@Laotree Laotree commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

A display may stamp a frame with when it will show — a frame ahead of Scope.Now, as macOS and iOS do, or before it, as an Android vsync or a web frame that began before a resume can. A test could only reach that by capturing the view's scope and posting cx.RunFrameAt(at), which goes around App's frame bookkeeping and is not documented.

Add nsgotest.App.FrameAt(at): it runs the display frame the app waits for, stamped at, without moving the clock, and settles. A zero at stamps the clock's now, and no waiting frame runs nothing. Under -target it skips the test, as other headless-only steps do.

Fixes #2256.

Targets

  • Shared code (core, base, ui, tsx, the nsgo tool)
  • macOS
  • iOS
  • tvOS
  • watchOS
  • Android
  • Windows
  • Linux
  • Web
  • Mini programs
  • Docs or website only

Screenshots

None; nothing visible changes.

Verification

  • New test TestFrameAtStampsTheWaitingFrame covers a frame stamped a frame ahead of the clock, one stamped before it, and a call with no frame waiting; each checks the stamp the callback hears and that the clock did not move.

  • go tool nsgo test ./nsgotest -count=1: 242 passed, 1 skipped.

  • go run ./tools/changelog check passes with the new fragment.

  • docs/public/en/testing.md, docs/public/zh/testing.md and the headless paragraph of docs/architecture/animation.md name it.

  • go tool nsgo check

  • go tool nsgo test

  • go tool nsgo test -target <target> on the targets above

Checklist

  • The title is a Conventional Commit; a squash merge uses it as the commit subject.
  • Docs whose facts change are updated, and a capability users can see has a line in a changelog.d/ fragment, not in CHANGELOG.md.
  • New third-party code, assets and dependencies name their source and license. None are added.

🤖 Generated with Claude Code

@github-actions github-actions Bot added size/S enhancement New feature or request documentation Improvements or additions to documentation labels Nov 25, 2026

@houko houko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against latest main. App.FrameAt drives only the pending headless frame, preserves the clock, skips target runs, and the regression covers timestamps ahead of and behind the clock plus no pending frame. Documentation and changelog are updated, and all repository checks are green. Approving.

@houko houko left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against latest origin/main and issue #2256.

The new App.FrameAt method consumes the same frameWanted bookkeeping as the existing headless frame loop, dispatches Scope.RunFrameAt with the requested timestamp, leaves the manual clock unchanged, and settles follow-up graph work. It correctly skips target-backed runs, uses the clock's current time for a zero timestamp, and does nothing when no frame is pending. The regression test covers timestamps ahead of and before the clock plus the no-pending-frame case. English and Chinese testing docs, the animation architecture note, and the changelog are updated.

All reported required checks are green, including formatting, build and vet, the full test suite, platform tests, and CodeQL. Approving.

@houko
houko force-pushed the feat/frame-at branch 3 times, most recently from a2001f1 to fe4f2ab Compare November 25, 2026 11:06
A display may stamp a frame with when it will show, a frame ahead of the
clock or before it, and only smuggling a scope out of the view could test
it. Add App.FrameAt, which runs the waiting frame with that stamp without
moving the clock, and settles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@houko
houko merged commit 7cf20b5 into nsgo-dev:main Nov 25, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nsgotest: no step runs a display frame stamped with a time other than the clock's now (RunFrameAt)

2 participants