Skip to content

Commit 14756a6

Browse files
committed
Add Stage test
1 parent 66366f4 commit 14756a6

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

test/scratch_classes/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ target_link_libraries(
3939
)
4040

4141
gtest_discover_tests(sprite_test)
42+
43+
# stage_test
44+
add_executable(
45+
stage_test
46+
stage_test.cpp
47+
)
48+
49+
target_link_libraries(
50+
stage_test
51+
GTest::gtest_main
52+
scratchcpp
53+
)
54+
55+
gtest_discover_tests(stage_test)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "scratch/stage.h"
2+
#include "../common.h"
3+
4+
using namespace libscratchcpp;
5+
6+
TEST(StageTest, VideoState)
7+
{
8+
Stage stage;
9+
ASSERT_EQ(stage.videoState(), Stage::VideoState::Off); // default
10+
ASSERT_EQ(stage.videoStateStr(), "off");
11+
12+
stage.setVideoState(Stage::VideoState::On);
13+
ASSERT_EQ(stage.videoStateStr(), "on");
14+
15+
stage.setVideoState(Stage::VideoState::OnFlipped);
16+
ASSERT_EQ(stage.videoStateStr(), "on-flipped");
17+
18+
stage.setVideoState(Stage::VideoState::Off);
19+
ASSERT_EQ(stage.videoStateStr(), "off");
20+
}

0 commit comments

Comments
 (0)