@@ -911,3 +911,58 @@ TEST_F(LooksBlocksTest, SwitchCostumeTo)
911911 ASSERT_EQ (stage->costumeIndex (), 0 );
912912 }
913913}
914+
915+ TEST_F (LooksBlocksTest, NextCostume)
916+ {
917+ {
918+ auto sprite = std::make_shared<Sprite>();
919+ auto costume1 = std::make_shared<Costume>(" costume1" , " a" , " png" );
920+ auto costume2 = std::make_shared<Costume>(" costume2" , " b" , " png" );
921+ auto testCostume = std::make_shared<Costume>(" test" , " c" , " svg" );
922+ sprite->addCostume (costume1);
923+ sprite->addCostume (costume2);
924+ sprite->addCostume (testCostume);
925+
926+ ScriptBuilder builder (m_extension.get (), m_engine, sprite);
927+
928+ builder.addBlock (" looks_nextcostume" );
929+ builder.build ();
930+
931+ sprite->setCostumeIndex (0 );
932+ builder.run ();
933+ ASSERT_EQ (sprite->costumeIndex (), 1 );
934+
935+ builder.run ();
936+ ASSERT_EQ (sprite->costumeIndex (), 2 );
937+
938+ builder.run ();
939+ ASSERT_EQ (sprite->costumeIndex (), 0 );
940+ }
941+
942+ m_engine->clear ();
943+
944+ {
945+ auto stage = std::make_shared<Stage>();
946+ auto costume1 = std::make_shared<Costume>(" costume1" , " a" , " png" );
947+ auto costume2 = std::make_shared<Costume>(" costume2" , " b" , " png" );
948+ auto testCostume = std::make_shared<Costume>(" test" , " c" , " svg" );
949+ stage->addCostume (costume1);
950+ stage->addCostume (costume2);
951+ stage->addCostume (testCostume);
952+
953+ ScriptBuilder builder (m_extension.get (), m_engine, stage);
954+
955+ builder.addBlock (" looks_nextcostume" );
956+ builder.build ();
957+
958+ stage->setCostumeIndex (0 );
959+ builder.run ();
960+ ASSERT_EQ (stage->costumeIndex (), 1 );
961+
962+ builder.run ();
963+ ASSERT_EQ (stage->costumeIndex (), 2 );
964+
965+ builder.run ();
966+ ASSERT_EQ (stage->costumeIndex (), 0 );
967+ }
968+ }
0 commit comments