File tree Expand file tree Collapse file tree 4 files changed +98
-0
lines changed
Expand file tree Collapse file tree 4 files changed +98
-0
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,19 @@ target_link_libraries(
1313)
1414
1515gtest_discover_tests(iscratchsprite_test)
16+
17+ # iscratchstage_test
18+ add_executable (
19+ iscratchstage_test
20+ iscratchstage_test.cpp
21+ teststageinterface.cpp
22+ teststageinterface.h
23+ )
24+
25+ target_link_libraries (
26+ iscratchstage_test
27+ GTest::gtest_main
28+ scratchcpp
29+ )
30+
31+ gtest_discover_tests(iscratchstage_test)
Original file line number Diff line number Diff line change 1+ #include " scratch/stage.h"
2+ #include " teststageinterface.h"
3+ #include " ../common.h"
4+
5+ #define INIT_STAGE () stage.setInterface(&stageInterface);
6+
7+ using namespace libscratchcpp ;
8+
9+ Stage stage;
10+ TestStageInterface stageInterface;
11+
12+ TEST (IScratchStageTest, Tempo)
13+ {
14+ INIT_STAGE ();
15+ stage.setTempo (120 );
16+ ASSERT_EQ (stageInterface.tempo , 120 );
17+ stage.setTempo (55 );
18+ ASSERT_EQ (stage.tempo (), 55 );
19+ }
20+
21+ TEST (IScratchStageTest, VideoState)
22+ {
23+ INIT_STAGE ();
24+ stage.setVideoState (Stage::VideoState::On);
25+ ASSERT_EQ (stageInterface.videoState , Stage::VideoState::On);
26+ stage.setVideoState (Stage::VideoState::OnFlipped);
27+ ASSERT_EQ (stageInterface.videoState , Stage::VideoState::OnFlipped);
28+ }
29+
30+ TEST (IScratchStageTest, CostumeData)
31+ {
32+ INIT_STAGE ();
33+ // TODO: Add tests for costume data
34+ }
Original file line number Diff line number Diff line change 1+ #include " teststageinterface.h"
2+
3+ TestStageInterface::TestStageInterface ()
4+ {
5+ }
6+
7+ void TestStageInterface::setTempo (int tempo)
8+ {
9+ this ->tempo = tempo;
10+ }
11+
12+ void TestStageInterface::setVideoState (Stage::VideoState videoState)
13+ {
14+ this ->videoState = videoState;
15+ }
16+
17+ void TestStageInterface::setVideoTransparency (int videoTransparency)
18+ {
19+ this ->videoTrasparency = videoTransparency;
20+ }
21+
22+ void TestStageInterface::setCostume (const char *data)
23+ {
24+ costumeData = data;
25+ }
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < iscratchstage.h>
4+
5+ using namespace libscratchcpp ;
6+
7+ class TestStageInterface : public IScratchStage
8+ {
9+ public:
10+ TestStageInterface ();
11+
12+ void setTempo (int tempo) override ;
13+ void setVideoState (Stage::VideoState videoState) override ;
14+ void setVideoTransparency (int videoTransparency) override ;
15+
16+ void setCostume (const char *data) override ;
17+
18+ int tempo = 60 ;
19+ Stage::VideoState videoState = Stage::VideoState::Off;
20+ int videoTrasparency = 50 ;
21+
22+ const char *costumeData = nullptr ;
23+ };
You can’t perform that action at this time.
0 commit comments