Add text2speech, translate, and videosensing blocks with tests - #154
Add text2speech, translate, and videosensing blocks with tests#154nakasyou wants to merge 1 commit into
Conversation
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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, andvideosensingblock factory modules (including their menu shadow blocks). - Added unit tests validating the emitted opcodes (and hat
topLevelfor 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.
| const blocks = createBlocks(() => { | ||
| whenMotionGreaterThan(10, () => { | ||
| setVideoTransparency(50) | ||
| }) | ||
| say(videoOn('motion', 'this sprite')) | ||
| videoToggle('on') | ||
| }) |
There was a problem hiding this comment.
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.
Motivation
Description
text2speech,translate, andvideosensingmodules frompackages/hikkaku/src/blocks/index.ts.text2speech.tswithspeakAndWait,setVoice,setLanguage, and associated menu shadow blocksmenuOfTextToSpeechVoiceandmenuOfTextToSpeechLanguage.translate.tswithtranslate,menuOfTranslateLanguage, andgetViewerLanguagereporter blocks.videosensing.tswithwhenMotionGreaterThan,videoOn,videoToggle,setVideoTransparency, and menu shadow blocks for attributes, subjects, and video state.text2speech.test.ts,translate.test.ts, andvideosensing.test.tsthat assert the created blocks expose the expected opcodes and properties (including top-level hats).Testing
pnpm -w test.packages/hikkaku/src/blocks/text2speech.test.ts,packages/hikkaku/src/blocks/translate.test.ts, andpackages/hikkaku/src/blocks/videosensing.test.tsexecuted as part of the suite and passed.Codex Task