File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class LIBSCRATCHCPP_EXPORT Stage : public Target
2727 Stage (const Stage &) = delete ;
2828
2929 void setInterface (IStageHandler *newInterface);
30+ IStageHandler *getInterface () const ; // NOTE: This can't be called interface because of... Microsoft... (it wouldn't compile on Windows)
3031
3132 bool isStage () const override ;
3233
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ void Stage::setInterface(IStageHandler *newInterface)
2424 impl->iface ->init (this );
2525}
2626
27+ /* ! Returns the stage interface. */
28+ IStageHandler *Stage::getInterface () const
29+ {
30+ return impl->iface ;
31+ }
32+
2733/* ! Returns true. */
2834bool Stage::isStage () const
2935{
Original file line number Diff line number Diff line change 22#include < scratchcpp/costume.h>
33#include < enginemock.h>
44#include < graphicseffectmock.h>
5+ #include < stagehandlermock.h>
56
67#include " ../common.h"
78
@@ -13,6 +14,17 @@ TEST(StageTest, IsStage)
1314 ASSERT_TRUE (stage.isStage ());
1415}
1516
17+ TEST (SpriteTest, Interface)
18+ {
19+ Stage stage;
20+ ASSERT_EQ (stage.getInterface (), nullptr );
21+
22+ StageHandlerMock handler;
23+ EXPECT_CALL (handler, init);
24+ stage.setInterface (&handler);
25+ ASSERT_EQ (stage.getInterface (), &handler);
26+ }
27+
1628TEST (SpriteTest, CostumeIndex)
1729{
1830 Stage stage;
You can’t perform that action at this time.
0 commit comments