File tree 4 files changed +24
-12
lines changed
4 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ bool SpriteModel::touchingColor(const libscratchcpp::Value &color) const
177
177
178
178
bool SpriteModel::touchingColor (const libscratchcpp::Value &color, const libscratchcpp::Value &mask) const
179
179
{
180
- return false ;
180
+ return m_renderedTarget-> touchingColor (color, mask) ;
181
181
}
182
182
183
183
libscratchcpp::Sprite *SpriteModel::sprite () const
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ bool StageModel::touchingColor(const libscratchcpp::Value &color) const
114
114
115
115
bool StageModel::touchingColor (const libscratchcpp::Value &color, const libscratchcpp::Value &mask) const
116
116
{
117
- return false ;
117
+ return m_renderedTarget-> touchingColor (color, mask) ;
118
118
}
119
119
120
120
void StageModel::loadCostume ()
Original file line number Diff line number Diff line change @@ -388,12 +388,18 @@ TEST(SpriteModelTest, TouchingColor)
388
388
RenderedTargetMock renderedTarget;
389
389
model.setRenderedTarget (&renderedTarget);
390
390
391
- Value color = 123 ;
392
- EXPECT_CALL (renderedTarget, touchingColor (color )).WillOnce (Return (false ));
393
- ASSERT_FALSE (model.touchingColor (color ));
391
+ Value color1 = 123 , color2 = 456 ;
392
+ EXPECT_CALL (renderedTarget, touchingColor (color1 )).WillOnce (Return (false ));
393
+ ASSERT_FALSE (model.touchingColor (color1 ));
394
394
395
- EXPECT_CALL (renderedTarget, touchingColor (color)).WillOnce (Return (true ));
396
- ASSERT_TRUE (model.touchingColor (color));
395
+ EXPECT_CALL (renderedTarget, touchingColor (color1)).WillOnce (Return (true ));
396
+ ASSERT_TRUE (model.touchingColor (color1));
397
+
398
+ EXPECT_CALL (renderedTarget, touchingColor (color1, color2)).WillOnce (Return (false ));
399
+ ASSERT_FALSE (model.touchingColor (color1, color2));
400
+
401
+ EXPECT_CALL (renderedTarget, touchingColor (color1, color2)).WillOnce (Return (true ));
402
+ ASSERT_TRUE (model.touchingColor (color1, color2));
397
403
}
398
404
399
405
TEST (SpriteModelTest, RenderedTarget)
Original file line number Diff line number Diff line change @@ -181,12 +181,18 @@ TEST(StageModelTest, TouchingColor)
181
181
RenderedTargetMock renderedTarget;
182
182
model.setRenderedTarget (&renderedTarget);
183
183
184
- Value color = 123 ;
185
- EXPECT_CALL (renderedTarget, touchingColor (color )).WillOnce (Return (false ));
186
- ASSERT_FALSE (model.touchingColor (color ));
184
+ Value color1 = 123 , color2 = 456 ;
185
+ EXPECT_CALL (renderedTarget, touchingColor (color1 )).WillOnce (Return (false ));
186
+ ASSERT_FALSE (model.touchingColor (color1 ));
187
187
188
- EXPECT_CALL (renderedTarget, touchingColor (color)).WillOnce (Return (true ));
189
- ASSERT_TRUE (model.touchingColor (color));
188
+ EXPECT_CALL (renderedTarget, touchingColor (color1)).WillOnce (Return (true ));
189
+ ASSERT_TRUE (model.touchingColor (color1));
190
+
191
+ EXPECT_CALL (renderedTarget, touchingColor (color1, color2)).WillOnce (Return (false ));
192
+ ASSERT_FALSE (model.touchingColor (color1, color2));
193
+
194
+ EXPECT_CALL (renderedTarget, touchingColor (color1, color2)).WillOnce (Return (true ));
195
+ ASSERT_TRUE (model.touchingColor (color1, color2));
190
196
}
191
197
192
198
TEST (StageModelTest, RenderedTarget)
You can’t perform that action at this time.
0 commit comments