|
4 | 4 |
|
5 | 5 | using namespace libscratchcpp; |
6 | 6 |
|
| 7 | +TEST(StageTest, IsStage) |
| 8 | +{ |
| 9 | + Stage stage; |
| 10 | + ASSERT_TRUE(stage.isStage()); |
| 11 | +} |
| 12 | + |
| 13 | +TEST(StageTest, Tempo) |
| 14 | +{ |
| 15 | + Stage stage; |
| 16 | + ASSERT_EQ(stage.tempo(), 60); |
| 17 | + stage.setTempo(120); |
| 18 | + ASSERT_EQ(stage.tempo(), 120); |
| 19 | +} |
| 20 | + |
7 | 21 | TEST(StageTest, VideoState) |
8 | 22 | { |
9 | 23 | Stage stage; |
10 | 24 | ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); // default |
11 | 25 | ASSERT_EQ(stage.videoStateStr(), "off"); |
12 | 26 |
|
13 | 27 | stage.setVideoState(Stage::VideoState::On); |
| 28 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::On); |
14 | 29 | ASSERT_EQ(stage.videoStateStr(), "on"); |
15 | 30 |
|
16 | 31 | stage.setVideoState(Stage::VideoState::OnFlipped); |
| 32 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::OnFlipped); |
17 | 33 | ASSERT_EQ(stage.videoStateStr(), "on-flipped"); |
18 | 34 |
|
19 | 35 | stage.setVideoState(Stage::VideoState::Off); |
| 36 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); |
| 37 | + ASSERT_EQ(stage.videoStateStr(), "off"); |
| 38 | + |
| 39 | + stage.setVideoState("invalid"); |
| 40 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); // shouldn't change |
| 41 | + ASSERT_EQ(stage.videoStateStr(), "off"); |
| 42 | + |
| 43 | + stage.setVideoState("on"); |
| 44 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::On); |
| 45 | + ASSERT_EQ(stage.videoStateStr(), "on"); |
| 46 | + |
| 47 | + stage.setVideoState("on-flipped"); |
| 48 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::OnFlipped); |
| 49 | + ASSERT_EQ(stage.videoStateStr(), "on-flipped"); |
| 50 | + |
| 51 | + stage.setVideoState("off"); |
| 52 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); |
20 | 53 | ASSERT_EQ(stage.videoStateStr(), "off"); |
| 54 | + |
| 55 | + stage.setVideoState(std::string("invalid")); |
| 56 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); // shouldn't change |
| 57 | + ASSERT_EQ(stage.videoStateStr(), "off"); |
| 58 | + |
| 59 | + stage.setVideoState(std::string("on")); |
| 60 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::On); |
| 61 | + ASSERT_EQ(stage.videoStateStr(), "on"); |
| 62 | + |
| 63 | + stage.setVideoState(std::string("on-flipped")); |
| 64 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::OnFlipped); |
| 65 | + ASSERT_EQ(stage.videoStateStr(), "on-flipped"); |
| 66 | + |
| 67 | + stage.setVideoState(std::string("off")); |
| 68 | + ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); |
| 69 | + ASSERT_EQ(stage.videoStateStr(), "off"); |
| 70 | +} |
| 71 | + |
| 72 | +TEST(StageTest, VideoTransparency) |
| 73 | +{ |
| 74 | + Stage stage; |
| 75 | + ASSERT_EQ(stage.videoTransparency(), 50); |
| 76 | + stage.setVideoTransparency(100); |
| 77 | + ASSERT_EQ(stage.videoTransparency(), 100); |
| 78 | +} |
| 79 | + |
| 80 | +TEST(StageTest, TextToSpeechLanguage) |
| 81 | +{ |
| 82 | + Stage stage; |
| 83 | + ASSERT_EQ(stage.textToSpeechLanguage(), ""); |
| 84 | + stage.setTextToSpeechLanguage("English"); |
| 85 | + ASSERT_EQ(stage.textToSpeechLanguage(), "English"); |
21 | 86 | } |
0 commit comments