Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c2b8938

Browse files
author
jonahwilliams
committed
remove test opt outs.
1 parent 3e21b07 commit c2b8938

File tree

2 files changed

+99
-101
lines changed

2 files changed

+99
-101
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -242,66 +242,65 @@ TEST_P(AiksTest, DrawRectAbsorbsClears) {
242242
ASSERT_EQ(render_pass->GetCommands().size(), 0llu);
243243
}
244244

245-
// TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRRect) {
246-
// Canvas canvas;
247-
// canvas.DrawRRect(Rect::MakeXYWH(0, 0, 300, 300), {5.0, 5.0},
248-
// {.color = Color::Red(), .blend_mode =
249-
// BlendMode::kSource});
250-
// canvas.DrawRRect(Rect::MakeXYWH(0, 0, 300, 300), {5.0, 5.0},
251-
// {.color = Color::CornflowerBlue().WithAlpha(0.75),
252-
// .blend_mode = BlendMode::kSourceOver});
253-
254-
// std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
255-
// Picture picture = canvas.EndRecordingAsPicture();
256-
// std::shared_ptr<Context> real_context = GetContext();
257-
// std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
258-
// AiksContext renderer(mock_context, nullptr);
259-
// std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
260-
261-
// ASSERT_EQ(spy->render_passes_.size(), 1llu);
262-
// std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
263-
// ASSERT_EQ(render_pass->GetCommands().size(), 2llu);
264-
// }
265-
266-
// TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRotation) {
267-
// Canvas canvas;
268-
// canvas.Translate(Vector3(150.0, 150.0, 0.0));
269-
// canvas.Rotate(Degrees(45.0));
270-
// canvas.Translate(Vector3(-150.0, -150.0, 0.0));
271-
// canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
272-
// {.color = Color::Red(), .blend_mode = BlendMode::kSource});
273-
274-
// std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
275-
// Picture picture = canvas.EndRecordingAsPicture();
276-
// std::shared_ptr<Context> real_context = GetContext();
277-
// std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
278-
// AiksContext renderer(mock_context, nullptr);
279-
// std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
280-
281-
// ASSERT_EQ(spy->render_passes_.size(), 1llu);
282-
// std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
283-
// ASSERT_EQ(render_pass->GetCommands().size(), 1llu);
284-
// }
285-
286-
// TEST_P(AiksTest, DrawRectAbsorbsClearsNegative) {
287-
// Canvas canvas;
288-
// canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
289-
// {.color = Color::Red(), .blend_mode = BlendMode::kSource});
290-
// canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
291-
// {.color = Color::CornflowerBlue().WithAlpha(0.75),
292-
// .blend_mode = BlendMode::kSourceOver});
293-
294-
// std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
295-
// Picture picture = canvas.EndRecordingAsPicture();
296-
// std::shared_ptr<Context> real_context = GetContext();
297-
// std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
298-
// AiksContext renderer(mock_context, nullptr);
299-
// std::shared_ptr<Image> image = picture.ToImage(renderer, {301, 301});
300-
301-
// ASSERT_EQ(spy->render_passes_.size(), 1llu);
302-
// std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
303-
// ASSERT_EQ(render_pass->GetCommands().size(), 2llu);
304-
// }
245+
TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRRect) {
246+
Canvas canvas;
247+
canvas.DrawRRect(Rect::MakeXYWH(0, 0, 300, 300), {5.0, 5.0},
248+
{.color = Color::Red(), .blend_mode = BlendMode::kSource});
249+
canvas.DrawRRect(Rect::MakeXYWH(0, 0, 300, 300), {5.0, 5.0},
250+
{.color = Color::CornflowerBlue().WithAlpha(0.75),
251+
.blend_mode = BlendMode::kSourceOver});
252+
253+
std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
254+
Picture picture = canvas.EndRecordingAsPicture();
255+
std::shared_ptr<Context> real_context = GetContext();
256+
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
257+
AiksContext renderer(mock_context, nullptr);
258+
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
259+
260+
ASSERT_EQ(spy->render_passes_.size(), 1llu);
261+
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
262+
ASSERT_EQ(render_pass->GetCommands().size(), 2llu);
263+
}
264+
265+
TEST_P(AiksTest, DrawRectAbsorbsClearsNegativeRotation) {
266+
Canvas canvas;
267+
canvas.Translate(Vector3(150.0, 150.0, 0.0));
268+
canvas.Rotate(Degrees(45.0));
269+
canvas.Translate(Vector3(-150.0, -150.0, 0.0));
270+
canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
271+
{.color = Color::Red(), .blend_mode = BlendMode::kSource});
272+
273+
std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
274+
Picture picture = canvas.EndRecordingAsPicture();
275+
std::shared_ptr<Context> real_context = GetContext();
276+
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
277+
AiksContext renderer(mock_context, nullptr);
278+
std::shared_ptr<Image> image = picture.ToImage(renderer, {300, 300});
279+
280+
ASSERT_EQ(spy->render_passes_.size(), 1llu);
281+
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
282+
ASSERT_EQ(render_pass->GetCommands().size(), 1llu);
283+
}
284+
285+
TEST_P(AiksTest, DrawRectAbsorbsClearsNegative) {
286+
Canvas canvas;
287+
canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
288+
{.color = Color::Red(), .blend_mode = BlendMode::kSource});
289+
canvas.DrawRect(Rect::MakeXYWH(0, 0, 300, 300),
290+
{.color = Color::CornflowerBlue().WithAlpha(0.75),
291+
.blend_mode = BlendMode::kSourceOver});
292+
293+
std::shared_ptr<ContextSpy> spy = ContextSpy::Make();
294+
Picture picture = canvas.EndRecordingAsPicture();
295+
std::shared_ptr<Context> real_context = GetContext();
296+
std::shared_ptr<ContextMock> mock_context = spy->MakeContext(real_context);
297+
AiksContext renderer(mock_context, nullptr);
298+
std::shared_ptr<Image> image = picture.ToImage(renderer, {301, 301});
299+
300+
ASSERT_EQ(spy->render_passes_.size(), 1llu);
301+
std::shared_ptr<RenderPass> render_pass = spy->render_passes_[0];
302+
ASSERT_EQ(render_pass->GetCommands().size(), 2llu);
303+
}
305304

306305
TEST_P(AiksTest, ClipRectElidesNoOpClips) {
307306
Canvas canvas(Rect::MakeXYWH(0, 0, 100, 100));

shell/gpu/gpu_surface_metal_impeller_unittests.mm

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -97,63 +97,62 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override
9797
ASSERT_TRUE(frame->Submit());
9898
}
9999

100-
// TESTING!
101-
// TEST(GPUSurfaceMetalImpeller, ResetHostBufferBasedOnFrameBoundary) {
102-
// auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
103-
// delegate->SetDevice();
100+
TEST(GPUSurfaceMetalImpeller, ResetHostBufferBasedOnFrameBoundary) {
101+
auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
102+
delegate->SetDevice();
104103

105-
// auto context = CreateImpellerContext();
106-
// std::unique_ptr<Surface> surface =
107-
// std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
104+
auto context = CreateImpellerContext();
105+
std::unique_ptr<Surface> surface =
106+
std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
108107

109-
// ASSERT_TRUE(surface->IsValid());
108+
ASSERT_TRUE(surface->IsValid());
110109

111-
// auto& host_buffer = surface->GetAiksContext()->GetContentContext().GetTransientsBuffer();
110+
auto& host_buffer = surface->GetAiksContext()->GetContentContext().GetTransientsBuffer();
112111

113-
// EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 0u);
112+
EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 0u);
114113

115-
// auto frame = surface->AcquireFrame(SkISize::Make(100, 100));
116-
// frame->set_submit_info({.frame_boundary = false});
114+
auto frame = surface->AcquireFrame(SkISize::Make(100, 100));
115+
frame->set_submit_info({.frame_boundary = false});
117116

118-
// ASSERT_TRUE(frame->Submit());
119-
// EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 0u);
117+
ASSERT_TRUE(frame->Submit());
118+
EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 0u);
120119

121-
// frame = surface->AcquireFrame(SkISize::Make(100, 100));
122-
// frame->set_submit_info({.frame_boundary = true});
120+
frame = surface->AcquireFrame(SkISize::Make(100, 100));
121+
frame->set_submit_info({.frame_boundary = true});
123122

124-
// ASSERT_TRUE(frame->Submit());
125-
// EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 1u);
126-
// }
123+
ASSERT_TRUE(frame->Submit());
124+
EXPECT_EQ(host_buffer.GetStateForTest().current_frame, 1u);
125+
}
127126

128-
// #ifdef IMPELLER_DEBUG
129-
// TEST(GPUSurfaceMetalImpeller, CreatesImpellerCaptureScope) {
130-
// auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
131-
// delegate->SetDevice();
127+
#ifdef IMPELLER_DEBUG
128+
TEST(GPUSurfaceMetalImpeller, CreatesImpellerCaptureScope) {
129+
auto delegate = std::make_shared<TestGPUSurfaceMetalDelegate>();
130+
delegate->SetDevice();
132131

133-
// auto context = CreateImpellerContext();
132+
auto context = CreateImpellerContext();
134133

135-
// EXPECT_FALSE(context->GetCaptureManager()->CaptureScopeActive());
134+
EXPECT_FALSE(context->GetCaptureManager()->CaptureScopeActive());
136135

137-
// std::unique_ptr<Surface> surface =
138-
// std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
139-
// auto frame_1 = surface->AcquireFrame(SkISize::Make(100, 100));
140-
// frame_1->set_submit_info({.frame_boundary = false});
136+
std::unique_ptr<Surface> surface =
137+
std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
138+
auto frame_1 = surface->AcquireFrame(SkISize::Make(100, 100));
139+
frame_1->set_submit_info({.frame_boundary = false});
141140

142-
// EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
141+
EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
143142

144-
// std::unique_ptr<Surface> surface_2 =
145-
// std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
146-
// auto frame_2 = surface->AcquireFrame(SkISize::Make(100, 100));
147-
// frame_2->set_submit_info({.frame_boundary = true});
143+
std::unique_ptr<Surface> surface_2 =
144+
std::make_unique<GPUSurfaceMetalImpeller>(delegate.get(), context);
145+
auto frame_2 = surface->AcquireFrame(SkISize::Make(100, 100));
146+
frame_2->set_submit_info({.frame_boundary = true});
148147

149-
// EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
148+
EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
150149

151-
// ASSERT_TRUE(frame_1->Submit());
152-
// EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
153-
// ASSERT_TRUE(frame_2->Submit());
154-
// EXPECT_FALSE(context->GetCaptureManager()->CaptureScopeActive());
155-
// }
156-
// #endif // IMPELLER_DEBUG
150+
ASSERT_TRUE(frame_1->Submit());
151+
EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive());
152+
ASSERT_TRUE(frame_2->Submit());
153+
EXPECT_FALSE(context->GetCaptureManager()->CaptureScopeActive());
154+
}
155+
#endif // IMPELLER_DEBUG
157156

158157
} // namespace testing
159158
} // namespace flutter

0 commit comments

Comments
 (0)