Skip to content

Commit

Permalink
CATROID-1339 "Add to backpack" option missing for "Define" bricks
Browse files Browse the repository at this point in the history
  • Loading branch information
friendo97 committed Feb 3, 2022
1 parent c744b5d commit b6dbc05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2021 The Catrobat Team
* Copyright (C) 2010-2022 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -153,4 +153,13 @@ class BrickContextMenuTest(
fun testExpectedHelp() {
assertTrue(contextMenuItems.contains(R.string.brick_context_dialog_help))
}

@Test
fun testExpectedAddToBackpack() {
val showsAddToBackpack: Boolean = when (brick) {
is UserDefinedReceiverBrick, is WhenStartedBrick -> contextMenuItems.contains(R.string.backpack_add)
else -> !contextMenuItems.contains(R.string.backpack_add)
}
assertTrue(showsAddToBackpack)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2021 The Catrobat Team
* Copyright (C) 2010-2022 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -662,6 +662,7 @@ public static List<Integer> getContextMenuItems(Brick brick) {
List<Integer> items = new ArrayList<>();

if (brick instanceof UserDefinedReceiverBrick) {
items.add(R.string.backpack_add);
items.add(R.string.brick_context_dialog_delete_definition);
items.add(R.string.brick_context_dialog_move_definition);
items.add(R.string.brick_context_dialog_help);
Expand Down

0 comments on commit b6dbc05

Please sign in to comment.