Skip to content

Add text2speech, translate, and videosensing blocks with tests - #154

Open
nakasyou wants to merge 1 commit into
mainfrom
codex/resolve-issue-151-f8fmgz
Open

Add text2speech, translate, and videosensing blocks with tests#154
nakasyou wants to merge 1 commit into
mainfrom
codex/resolve-issue-151-f8fmgz

Conversation

@nakasyou

Copy link
Copy Markdown
Member

Motivation

  • Add support for the Text-to-Speech, Translate, and Video Sensing Scratch extensions to the hikkaku blocks set.
  • Provide utility reporter and statement builders plus menu shadow blocks so these extension blocks can be composed in scripts.
  • Export the new blocks from the package entry so they are available to consumers.

Description

  • Exported text2speech, translate, and videosensing modules from packages/hikkaku/src/blocks/index.ts.
  • Implemented text2speech.ts with speakAndWait, setVoice, setLanguage, and associated menu shadow blocks menuOfTextToSpeechVoice and menuOfTextToSpeechLanguage.
  • Implemented translate.ts with translate, menuOfTranslateLanguage, and getViewerLanguage reporter blocks.
  • Implemented videosensing.ts with whenMotionGreaterThan, videoOn, videoToggle, setVideoTransparency, and menu shadow blocks for attributes, subjects, and video state.
  • Added unit tests text2speech.test.ts, translate.test.ts, and videosensing.test.ts that assert the created blocks expose the expected opcodes and properties (including top-level hats).

Testing

  • Ran the workspace unit tests with pnpm -w test.
  • The new tests packages/hikkaku/src/blocks/text2speech.test.ts, packages/hikkaku/src/blocks/translate.test.ts, and packages/hikkaku/src/blocks/videosensing.test.ts executed as part of the suite and passed.
  • No automated test failures were observed during the run.

Codex Task

Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 27, 2026 23:30
@codecov

codecov Bot commented Apr 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
+ Coverage   80.72%   80.87%   +0.15%     
==========================================
  Files          50       53       +3     
  Lines        4083     4116      +33     
  Branches      590      592       +2     
==========================================
+ Hits         3296     3329      +33     
  Misses        549      549              
  Partials      238      238              
Flag Coverage Δ
tests 80.87% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/hikkaku/src/blocks/text2speech.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/translate.ts 100.00% <100.00%> (ø)
packages/hikkaku/src/blocks/videosensing.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Scratch extension block factories (Text-to-Speech, Translate, Video Sensing) to the hikkaku blocks package, along with unit tests and barrel exports so consumers can compose these extension blocks in scripts.

Changes:

  • Added text2speech, translate, and videosensing block factory modules (including their menu shadow blocks).
  • Added unit tests validating the emitted opcodes (and hat topLevel for Video Sensing).
  • Exported the new modules from packages/hikkaku/src/blocks/index.ts.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/hikkaku/src/blocks/videosensing.ts Introduces Video Sensing block factories and menu shadow blocks (including a top-level hat).
packages/hikkaku/src/blocks/videosensing.test.ts Adds opcode/topLevel tests for the Video Sensing blocks.
packages/hikkaku/src/blocks/translate.ts Introduces Translate extension reporter/menu blocks.
packages/hikkaku/src/blocks/translate.test.ts Adds opcode tests for Translate extension blocks.
packages/hikkaku/src/blocks/text2speech.ts Introduces Text-to-Speech statement blocks and menu shadow blocks.
packages/hikkaku/src/blocks/text2speech.test.ts Adds opcode tests for Text-to-Speech extension blocks.
packages/hikkaku/src/blocks/index.ts Re-exports the new extension modules from the blocks entrypoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +19
const blocks = createBlocks(() => {
whenMotionGreaterThan(10, () => {
setVideoTransparency(50)
})
say(videoOn('motion', 'this sprite'))
videoToggle('on')
})

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

In this test, blocks created after calling whenMotionGreaterThan(…, () => { … }) are emitted in the root build scope; during createBlocks(), applyNextAndParent() will link those root blocks after the hat and can overwrite the hat’s next pointer (which attachStack() set to the substack). That can disconnect the intended stack from whenMotionGreaterThan, meaning the test isn’t actually validating the hat+stack wiring. Consider moving say(videoOn(...)) / videoToggle('on') into the hat callback (if they should be in that script), or start a separate top-level script before them (if they should be separate), and optionally assert the hat’s next points at the first stacked block.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants