Skip to content

Commit c9d7d1c

Browse files
committed
Fix dropdown menus in pen blocks
scratchcpp/libscratchcpp#558
1 parent 2188a1e commit c9d7d1c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/blocks/penblocks.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ void PenBlocks::compileChangePenColorParamBy(libscratchcpp::Compiler *compiler)
8585
{
8686
Input *input = compiler->input(COLOR_PARAM);
8787

88-
if (input->type() != Input::Type::ObscuredShadow) {
89-
assert(input->pointsToDropdownMenu());
88+
if (input->pointsToDropdownMenu()) {
9089
std::string value = input->selectedMenuItem();
9190
BlockFunc f = nullptr;
9291

@@ -114,8 +113,7 @@ void PenBlocks::compileSetPenColorParamTo(Compiler *compiler)
114113
{
115114
Input *input = compiler->input(COLOR_PARAM);
116115

117-
if (input->type() != Input::Type::ObscuredShadow) {
118-
assert(input->pointsToDropdownMenu());
116+
if (input->pointsToDropdownMenu()) {
119117
std::string value = input->selectedMenuItem();
120118
BlockFunc f = nullptr;
121119

test/blocks/pen_blocks_test.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class PenBlocksTest : public testing::Test
5454
else {
5555
auto input = addNullInput(block, name, id);
5656
auto menu = std::make_shared<Block>(block->id() + "_menu", block->opcode() + "_menu");
57+
menu->setShadow(true);
5758
input->setValueBlock(menu);
5859
addDropdownField(menu, name, -1, selectedValue, -1);
5960
}

0 commit comments

Comments
 (0)