| 151 | }; |
| 152 | |
| 153 | TEST_F(RasterContextTests, canRasterSimpleScene) { |
| 154 | _contentLayer->setBackgroundColor(Color::red()); |
| 155 | |
| 156 | auto centerLayer = makeLayer<Layer>(_resources); |
| 157 | centerLayer->setBackgroundColor(Color::blue()); |
| 158 | centerLayer->setFrame(Rect::makeXYWH(1, 1, 2, 2)); |
| 159 | _contentLayer->addChild(centerLayer); |
| 160 | _contentLayer->setFrame(Rect::makeXYWH(0, 0, 4, 4)); |
| 161 | |
| 162 | auto result = raster(); |
| 163 | ASSERT_TRUE(result) << result.description(); |
| 164 | |
| 165 | ASSERT_EQ(*result.value(), |
| 166 | std::initializer_list<Color>({ |
| 167 | // clang-format off |
| 168 | Color::red(), Color::red(), Color::red(), Color::red(), |
| 169 | Color::red(), Color::blue(), Color::blue(), Color::red(), |
| 170 | Color::red(), Color::blue(), Color::blue(), Color::red(), |
| 171 | Color::red(), Color::red(), Color::red(), Color::red(), |
| 172 | // clang-format on |
| 173 | })); |
| 174 | |
| 175 | ASSERT_EQ(0, _bitmapFactory->createdBitmapCount); |
| 176 | } |
| 177 | |
| 178 | TEST_F(RasterContextTests, scalesSceneToBitmap) { |
| 179 | _contentLayer->setBackgroundColor(Color::red()); |
nothing calls this directly
no test coverage detected