Skip to content

Conversation

@cpcallen
Copy link
Collaborator

  • Remove an unnecessary round trip through JSON.stringify + JSON.parse when loading tests blocks.
  • Rename "move test blocks" to "move start test blocks"
  • Create "move statement test blocks" and a new test suite "Statement move tests", for testing movement of statement blocks.
    • Move the existing test for constrained movement following unconstrained movement to the new suite.
  • Add tests for constrained movment of a simple stack block left/right/up/down.
  • Add tests for constrained movment of a complex stack block (one with statement inputs) left/right/up/down.

Part of #696.

Also remove an unnecessary round trip through JSON.stringify + JSON.parse.
Introduce moveStatementTestBlocks and suite 'Statement move tests',
for testing movement of statement blocks.

Move the existing test for constrained movement following
unconstrained movement to the new suite.
Introduce a new helper function, testMove, that encapsulates
the work needed to test moving a block through a constrained
move, checking candidate connections and final position.

Use this helper to reimplement the move left/right test as
two separate tests.
Modify getConnectionCandidate to also return the index of
candidateConnection.local in the list of connections returned
from block.getConnections_(true), so we can check wich connection
on the moving block is being used to connect.

For the simple mover case this is not very interesting (it's
normally index 0, for the previous connection, occasionally
index 1 if the moving block will be the new top block in a stack)
but this will be more important for tests involving moving more
complexly-shaped blocks.
Add a new, E-shaped block with ID complex_mover to
moveStatementTestBlocks, and update expected test results for
statement move tests.
Note that this test verifies current behaviour which, due to
bug RaspberryPiFoundation#702, does not conform to the desired behaviour.  There are
TODOs to update tests to desired behaviour when bug is fixed.
@cpcallen cpcallen requested a review from a team as a code owner August 26, 2025 16:40
@cpcallen cpcallen requested review from RoboErikG and removed request for a team August 26, 2025 16:40
@cpcallen cpcallen merged commit 2af65b8 into RaspberryPiFoundation:main Aug 27, 2025
6 of 8 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Blockly 2025 Aug 27, 2025
@cpcallen cpcallen deleted the test/696/stack branch August 28, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants