Add unit tests for renderKenBurnsFrame pan/zoom maths
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend, testing-qa
Research direction
Start with frontend/src/engine/ken-burns.ts, especially renderKenBurnsFrame at lines 32-76 and the preset definitions at lines 100-125. Add frontend/src/engine/ken-burns.test.ts using a fake context and fake image, then run cd frontend && npx vitest run src/engine/ken-burns.test.ts. Done means the specified drawImage and clearRect assertions pass, including clamping and the wide-image case, and a changelog fragment is added under changelog.d/.
Written by the indexing model from the issue text.
Description
What is wrong / what to do
renderKenBurnsFrame decides where every slideshow image is drawn in an exported video, and it has no tests. It is a pure function of its arguments, so it can be tested without a real canvas: pass a fake context object with clearRect and drawImage as vi.fn(), and a fake image { width, height }. Add ken-burns.test.ts that checks the drawImage arguments for known inputs.
Where in the code
frontend/src/engine/ken-burns.ts:32-76—renderKenBurnsFramefrontend/src/engine/ken-burns.ts:41—tis clamped to [0, 1] before easingfrontend/src/engine/ken-burns.ts:100-125—KB_PRESETS
How to reproduce, or the test command
cd frontend && npx vitest run src/engine/ken-burns.test.ts
Done when
- With a 1000x1000 canvas and a 1000x1000 image,
KB_PRESETS['zoom-in']att = 0callsdrawImage(img, 0, 0, 1000, 1000), and att = 1callsdrawImage(img, -100, -100, 1200, 1200) -
t = -0.5produces the samedrawImagearguments ast = 0, andt = 1.5the same ast = 1(clamping) -
clearRect(0, 0, canvasWidth, canvasHeight)is called once per frame - A wide image (e.g. 2000x1000) on a square canvas fills the canvas height (
drawH === canvasHeight * scale) - Tests added or updated, and the command above passes
- Changelog fragment in
changelog.d/
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 3
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BeyondITL/contentine-create
-
good first issue level: 1 ui
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#58 ·
Maintainers usually reply within 1 day
-
Fix Enter on the marketplace Buy button opening details instead of buyingPossibly taken @developedbyBob claimed this 3 days ago. Openaccessibility claimed good first issue level: 1
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#57 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Enable JSX in vitest so React component tests can runPossibly taken @29miaoet claimed this 4 days ago. Openclaimed good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
BeyondITL/contentine-create#56 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 94/100
BeyondITL/contentine-create#55 ·
Maintainers usually reply within 1 day
-
good first issue level: 1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
BeyondITL/contentine-create#54 ·
Maintainers usually reply within 1 day
All issues in BeyondITL/contentine-create
Similar issues
-
bug module:nodes tests
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
rocketride-org/rocketride-server#3020 ·
Maintainers usually reply within 2 days
-
area: dashboard area: tests good first issue size: XS tests
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Read canvas commentsOpenenhancement needs-community-review
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
shaharia-lab/slackcli#501 · 3 comments ·
Maintainers usually reply within 1 day
-
[Bug] Pod detail shows CPU usage ten times too high, and throws on decimal memory suffixesPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 11 days
-
`package.json`: build tools listed as runtime dependencies, exact pins causing duplicate installsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
themesberg/flowbite-vue#471 ·