Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

STCC-134 Replace conversion error with warning #118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Scratch2Catrobat Converter
short_name: S2CC
version: 0.10.0
build_name: Aegean cat
build_number: 980
build_number: 984

;-------------------------------------------------------------------------------
[CATROBAT]
Expand Down
4 changes: 2 additions & 2 deletions src/scratchtocatrobat/converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1991,7 +1991,7 @@ def _convert_sound_block(self):
[sound_name], sound_list = self.arguments, self.sprite.getSoundList()
sound_data = {sound_info.getName(): sound_info for sound_info in sound_list}.get(sound_name)
if not sound_data:
raise ConversionError("Sprite does not contain sound with name={}".format(sound_name))
log.warning("Sprite does not contain sound with name={}".format(sound_name))
play_sound_brick = self.CatrobatClass()
play_sound_brick.setSound(sound_data)
return play_sound_brick
Expand All @@ -2001,7 +2001,7 @@ def _convert_sound_and_wait_block(self):
[sound_name], sound_list = self.arguments, self.sprite.getSoundList()
sound_data = {sound_info.getName(): sound_info for sound_info in sound_list}.get(sound_name)
if not sound_data:
raise ConversionError("Sprite does not contain sound with name={}".format(sound_name))
log.warning("Sprite does not contain sound with name={}".format(sound_name))
play_sound_and_wait_brick = self.CatrobatClass()
play_sound_and_wait_brick.setSound(sound_data)
return play_sound_and_wait_brick
Expand Down
10 changes: 6 additions & 4 deletions src/scratchtocatrobat/converter/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,11 +1011,12 @@ def test_can_convert_waitelapsedfrom_block(self):
assert formula_tree_seconds.value == "1"

# playSound:
def test_fail_convert_playsound_block_if_sound_missing(self):
def test_can_convert_playsound_block_if_sound_missing(self):
scratch_block = ["playSound:", "bird"]
bricks = self.block_converter._catrobat_bricks_from(scratch_block, DUMMY_CATR_SPRITE)
assert len(bricks) == 1
assert isinstance(bricks[0], catbricks.NoteBrick)
assert isinstance(bricks[0], catbricks.PlaySoundBrick)
assert bricks[0].sound is None

# playSound:
def test_can_convert_playsound_block(self):
Expand All @@ -1026,11 +1027,12 @@ def test_can_convert_playsound_block(self):
assert catr_brick.sound.getName() == expected_sound_name

# doPlaySoundAndWait
def test_fail_convert_doplaysoundandwait_block(self):
def test_can_convert_playsoundandwait_block_if_sound_missing(self):
scratch_block = ["doPlaySoundAndWait", "bird"]
bricks = self.block_converter._catrobat_bricks_from(scratch_block, DUMMY_CATR_SPRITE)
assert len(bricks) == 1
assert isinstance(bricks[0], catbricks.NoteBrick)
assert isinstance(bricks[0], catbricks.PlaySoundAndWaitBrick)
assert bricks[0].sound is None

# doPlaySoundAndWait
def test_can_convert_doplaysoundandwait_block(self):
Expand Down