Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
checkerboard_contents_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <memory>
6#include <optional>
7
8#include "gtest/gtest.h"
9
16
17namespace impeller {
18namespace testing {
19
21
22#ifdef IMPELLER_DEBUG
23TEST(EntityTest, HasNulloptCoverage) {
24 auto contents = std::make_shared<CheckerboardContents>();
25
26 Entity entity;
27 ASSERT_EQ(contents->GetCoverage(entity), std::nullopt);
28}
29
30TEST_P(EntityTest, RendersWithoutError) {
31 auto contents = std::make_shared<CheckerboardContents>();
32 contents->SetColor(Color::Aqua());
33 contents->SetSquareSize(10);
34
35 auto content_context = GetContentContext();
36 auto buffer = content_context->GetContext()->CreateCommandBuffer();
37 auto render_target =
38 GetContentContext()->GetRenderTargetCache()->CreateOffscreenMSAA(
39 *content_context->GetContext(), {100, 100},
40 /*mip_count=*/1);
41 auto render_pass = buffer->CreateRenderPass(render_target);
42 auto recording_pass = std::make_shared<RecordingRenderPass>(
43 render_pass, GetContext(), render_target);
44
45 Entity entity;
46
47 ASSERT_TRUE(recording_pass->GetCommands().empty());
48 ASSERT_TRUE(contents->Render(*content_context, entity, *recording_pass));
49 ASSERT_FALSE(recording_pass->GetCommands().empty());
50
51 if (GetParam() == PlaygroundBackend::kMetal) {
52 recording_pass->EncodeCommands();
53 }
54}
55#endif // IMPELLER_DEBUG
56
57} // namespace testing
58} // namespace impeller
#define TEST(S, s, D, expected)
static const uint8_t buffer[]
TEST_P(AiksTest, CanRenderAdvancedBlendColorFilterWithSaveLayer)
static constexpr Color Aqua()
Definition color.h:282