|
3 | 3 | #include <scratchcpp/variable.h> |
4 | 4 | #include <scratchcpp/list.h> |
5 | 5 | #include <scratchcpp/costume.h> |
| 6 | +#include <scratchcpp/sound.h> |
6 | 7 | #include <scratchcpp/rect.h> |
7 | 8 | #include <scratchcpp/project.h> |
8 | 9 | #include <enginemock.h> |
@@ -63,6 +64,12 @@ TEST(SpriteTest, Clone) |
63 | 64 | sprite.addVariable(var2); |
64 | 65 | auto c1 = std::make_shared<Costume>("costume1", "", "svg"); |
65 | 66 | sprite.addCostume(c1); |
| 67 | + auto s1 = std::make_shared<Sound>("sound1", "a", "wav"); |
| 68 | + auto s2 = std::make_shared<Sound>("sound2", "b", "wav"); |
| 69 | + auto s3 = std::make_shared<Sound>("sound3", "c", "wav"); |
| 70 | + sprite.addSound(s1); |
| 71 | + sprite.addSound(s2); |
| 72 | + sprite.addSound(s3); |
66 | 73 |
|
67 | 74 | auto list1 = std::make_shared<List>("c", "list1"); |
68 | 75 | list1->push_back("item1"); |
@@ -111,6 +118,14 @@ TEST(SpriteTest, Clone) |
111 | 118 | ASSERT_EQ(*clone->listAt(1), std::deque<Value>({ "test" })); |
112 | 119 | ASSERT_EQ(clone->listAt(1)->target(), clone); |
113 | 120 |
|
| 121 | + ASSERT_EQ(clone->sounds().size(), 3); |
| 122 | + ASSERT_EQ(clone->soundAt(0)->id(), "a"); |
| 123 | + ASSERT_EQ(clone->soundAt(0)->name(), "sound1"); |
| 124 | + ASSERT_EQ(clone->soundAt(0)->dataFormat(), "wav"); |
| 125 | + ASSERT_EQ(clone->soundAt(2)->id(), "c"); |
| 126 | + ASSERT_EQ(clone->soundAt(2)->name(), "sound3"); |
| 127 | + ASSERT_EQ(clone->soundAt(2)->dataFormat(), "wav"); |
| 128 | + |
114 | 129 | ASSERT_EQ(clone->costumeIndex(), 1); |
115 | 130 | ASSERT_EQ(clone->layerOrder(), 5); |
116 | 131 | ASSERT_EQ(clone->volume(), 50); |
|
0 commit comments