File tree Expand file tree Collapse file tree 4 files changed +24
-12
lines changed Expand file tree Collapse file tree 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
177177
178178bool SpriteModel::touchingColor (const libscratchcpp::Value &color, const libscratchcpp::Value &mask) const
179179{
180- return false ;
180+ return m_renderedTarget-> touchingColor (color, mask) ;
181181}
182182
183183libscratchcpp::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
114114
115115bool StageModel::touchingColor (const libscratchcpp::Value &color, const libscratchcpp::Value &mask) const
116116{
117- return false ;
117+ return m_renderedTarget-> touchingColor (color, mask) ;
118118}
119119
120120void StageModel::loadCostume ()
Original file line number Diff line number Diff line change @@ -388,12 +388,18 @@ TEST(SpriteModelTest, TouchingColor)
388388 RenderedTargetMock renderedTarget;
389389 model.setRenderedTarget (&renderedTarget);
390390
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 ));
394394
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));
397403}
398404
399405TEST (SpriteModelTest, RenderedTarget)
Original file line number Diff line number Diff line change @@ -181,12 +181,18 @@ TEST(StageModelTest, TouchingColor)
181181 RenderedTargetMock renderedTarget;
182182 model.setRenderedTarget (&renderedTarget);
183183
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 ));
187187
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));
190196}
191197
192198TEST (StageModelTest, RenderedTarget)
You can’t perform that action at this time.
0 commit comments