@@ -849,3 +849,39 @@ TEST_F(SoundBlocksTest, PlayUntilDone_Stage)
849849 thread.run ();
850850 ASSERT_TRUE (thread.isFinished ());
851851}
852+
853+ TEST_F (SoundBlocksTest, StopAllSounds_Sprite)
854+ {
855+ auto sprite = std::make_shared<Sprite>();
856+
857+ ScriptBuilder builder (m_extension.get (), m_engine, sprite);
858+ builder.addBlock (" sound_stopallsounds" );
859+ auto block = builder.currentBlock ();
860+
861+ Compiler compiler (&m_engineMock, sprite.get ());
862+ auto code = compiler.compile (block);
863+ Script script (sprite.get (), block, &m_engineMock);
864+ script.setCode (code);
865+ Thread thread (sprite.get (), &m_engineMock, &script);
866+
867+ EXPECT_CALL (m_engineMock, stopSounds ());
868+ thread.run ();
869+ }
870+
871+ TEST_F (SoundBlocksTest, StopAllSounds_Stage)
872+ {
873+ auto stage = std::make_shared<Stage>();
874+
875+ ScriptBuilder builder (m_extension.get (), m_engine, stage);
876+ builder.addBlock (" sound_stopallsounds" );
877+ auto block = builder.currentBlock ();
878+
879+ Compiler compiler (&m_engineMock, stage.get ());
880+ auto code = compiler.compile (block);
881+ Script script (stage.get (), block, &m_engineMock);
882+ script.setCode (code);
883+ Thread thread (stage.get (), &m_engineMock, &script);
884+
885+ EXPECT_CALL (m_engineMock, stopSounds ());
886+ thread.run ();
887+ }
0 commit comments