@@ -495,3 +495,34 @@ TEST_F(LooksBlocksTest, SetEffectTo)
495495 builder.run ();
496496 }
497497}
498+
499+ TEST_F (LooksBlocksTest, ClearGraphicEffects)
500+ {
501+ auto sprite = std::make_shared<Sprite>();
502+ sprite->setEngine (m_engine);
503+
504+ ScriptBuilder builder (m_extension.get (), m_engine, sprite);
505+ IGraphicsEffect *effect1 = ScratchConfiguration::getGraphicsEffect (" WHIRL" );
506+ IGraphicsEffect *effect2 = ScratchConfiguration::getGraphicsEffect (" GHOST" );
507+ IGraphicsEffect *effect3 = ScratchConfiguration::getGraphicsEffect (" MOSAIC" );
508+ ASSERT_TRUE (effect1);
509+ ASSERT_TRUE (effect2);
510+ ASSERT_TRUE (effect3);
511+
512+ builder.addBlock (" looks_cleargraphiceffects" );
513+ auto block = builder.currentBlock ();
514+
515+ Compiler compiler (m_engine, sprite.get ());
516+ auto code = compiler.compile (block);
517+ Script script (sprite.get (), block, m_engine);
518+ script.setCode (code);
519+ Thread thread (sprite.get (), m_engine, &script);
520+
521+ sprite->setGraphicsEffectValue (effect1, 86.84 );
522+ sprite->setGraphicsEffectValue (effect2, -5.18 );
523+ sprite->setGraphicsEffectValue (effect3, 12.98 );
524+ thread.run ();
525+ ASSERT_EQ (sprite->graphicsEffectValue (effect1), 0 );
526+ ASSERT_EQ (sprite->graphicsEffectValue (effect2), 0 );
527+ ASSERT_EQ (sprite->graphicsEffectValue (effect3), 0 );
528+ }
0 commit comments