From 16321874b25fdb5d2a025141a44d2dc9dce4bda0 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 23 Sep 2024 07:57:17 -0700 Subject: [PATCH] feat: testing scenario (#58) * feat: simplify toolbox blocks for testing discussion * feat: add simpleCircle scenario * chore: format * chore: remove commented out code --- src/blocks/toolbox.js | 122 ----------------------------------------- test/index.html | 1 + test/loadTestBlocks.js | 74 +++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 122 deletions(-) diff --git a/src/blocks/toolbox.js b/src/blocks/toolbox.js index 12265bd..d7da467 100644 --- a/src/blocks/toolbox.js +++ b/src/blocks/toolbox.js @@ -18,28 +18,6 @@ export const toolbox = { }, }, }, - { - kind: 'block', - type: 'p5_stroke', - inputs: { - COLOR: { - shadow: { - type: 'colour_picker', - }, - }, - }, - }, - { - kind: 'block', - type: 'p5_fill', - inputs: { - COLOR: { - shadow: { - type: 'colour_picker', - }, - }, - }, - }, { kind: 'block', type: 'colour_random', @@ -59,105 +37,5 @@ export const toolbox = { }, }, }, - { - kind: 'block', - type: 'p5_ellipse', - inline: 'true', - inputs: { - X: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - Y: { - shadow: { - type: 'math_number', - fields: { - NUM: 100, - }, - }, - }, - WIDTH: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - HEIGHT: { - shadow: { - type: 'math_number', - fields: { - NUM: 50, - }, - }, - }, - }, - }, - { - kind: 'block', - type: 'math_random_int', - inputs: { - FROM: { - shadow: { - type: 'math_number', - fields: { - NUM: 0, - }, - }, - }, - TO: { - shadow: { - type: 'math_number', - fields: { - NUM: 400, - }, - }, - }, - }, - }, - { - kind: 'block', - type: 'controls_repeat_ext', - inputs: { - TIMES: { - block: { - type: 'math_number', - fields: { - NUM: 5, - }, - }, - }, - }, - }, - { - kind: 'block', - type: 'math_arithmetic', - fields: { - OP: 'ADD', - }, - inputs: { - A: { - shadow: { - type: 'math_number', - fields: { - NUM: 1, - }, - }, - }, - B: { - shadow: { - type: 'math_number', - fields: { - NUM: 1, - }, - }, - }, - }, - }, ], }; diff --git a/test/index.html b/test/index.html index 3b7ec48..fb574cc 100644 --- a/test/index.html +++ b/test/index.html @@ -93,6 +93,7 @@ onchange="document.forms.options.submit()"> + diff --git a/test/loadTestBlocks.js b/test/loadTestBlocks.js index a65433a..a6a4645 100644 --- a/test/loadTestBlocks.js +++ b/test/loadTestBlocks.js @@ -176,6 +176,79 @@ const blankCanvas = { }, }; +const simpleCircle = { + 'blocks': { + 'languageVersion': 0, + 'blocks': [ + { + 'type': 'p5_setup', + 'id': '5.{;T}3Qv}Awi:1M$:ut', + 'x': 0, + 'y': 75, + 'deletable': false, + 'inputs': { + 'STATEMENTS': { + 'block': { + 'type': 'p5_canvas', + 'id': 'spya_H-5F=K8+DhedX$y', + 'deletable': false, + 'movable': false, + 'fields': { + 'WIDTH': 400, + 'HEIGHT': 400, + }, + 'next': { + 'block': { + 'type': 'p5_background_color', + 'id': 'i/Hvi~^DYffkN/WpT_Ck', + 'inputs': { + 'COLOR': { + 'shadow': { + 'type': 'colour_picker', + 'id': 'B:zpi7kg+.GF_Dutd9GL', + 'fields': { + 'COLOUR': '#9999ff', + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + 'type': 'p5_draw', + 'id': '3iI4f%2#Gmk}=OjI7(8h', + 'x': 0, + 'y': 332, + 'deletable': false, + 'inputs': { + 'STATEMENTS': { + 'block': { + 'type': 'simple_circle', + 'id': '_}!@OHwjAb,2Gi8nT0}L', + 'inline': true, + 'inputs': { + 'COLOR': { + 'shadow': { + 'type': 'colour_picker', + 'id': 'gq(POne}j:hVw%C3t{vx', + 'fields': { + 'COLOUR': '#f59b42', + }, + }, + }, + }, + }, + }, + }, + }, + ], + }, +}; + /** * Loads saved state from local storage into the given workspace. * @param {Blockly.Workspace} workspace Blockly workspace to load into. @@ -185,6 +258,7 @@ export const load = function (workspace, scenarioString) { const scenarioMap = { 'blank': blankCanvas, 'sun': sunnyDay, + 'simpleCircle': simpleCircle, }; const data = JSON.stringify(scenarioMap[scenarioString]);