5 #include "flutter/testing/testing.h"
28 auto context = CreateContext();
34 ASSERT_NE(builder,
nullptr);
48 auto context = CreateContext();
50 const auto window_size = GetWindowSize();
69 color = {1.0, 0.0, 0.0, 1.0};
73 auto dl = Adopt<DisplayList>(
77 OpenPlaygroundHere([&](
const auto& context,
const auto& surface) ->
bool {
84 auto compressed = LoadFixtureImageCompressed(
85 flutter::testing::OpenFixtureAsMapping(
"boston.jpg"));
86 ASSERT_NE(compressed,
nullptr);
87 auto decompressed = compressed->Decode().ConvertToRGBA();
88 ASSERT_TRUE(decompressed.IsValid());
90 mapping.
data = decompressed.GetAllocation()->GetMapping();
91 mapping.
length = decompressed.GetAllocation()->GetSize();
93 auto context = GetInteropContext();
96 desc.
size = {decompressed.GetSize().
width, decompressed.GetSize().height};
99 context.GetC(), &desc, &mapping,
nullptr));
100 ASSERT_TRUE(texture);
107 auto dl = Adopt<DisplayList>(
110 OpenPlaygroundHere([&](
const auto& context,
const auto& surface) ->
bool {
117 auto context = GetInteropContext();
119 auto impeller_context = context->GetContext();
121 if (impeller_context->GetBackendType() !=
123 GTEST_SKIP() <<
"This test works with OpenGL handles is only suitable for "
129 const auto& gl = gl_context.GetReactor()->GetProcTable();
131 constexpr
ISize external_texture_size = {200, 300};
135 texture_data.
Truncate(
Bytes{external_texture_size.Area() * 4u},
false));
139 for (
size_t i = 0; i < external_texture_size.Area() * 4u; i += 4u) {
140 memcpy(texture_data.
GetBuffer() + i, kClearColor.data(), 4);
143 GLuint external_texture = GL_NONE;
144 gl.GenTextures(1u, &external_texture);
145 ASSERT_NE(external_texture, 0u);
146 gl.BindTexture(GL_TEXTURE_2D, external_texture);
147 gl.TexImage2D(GL_TEXTURE_2D,
150 external_texture_size.width,
151 external_texture_size.height,
160 desc.
size = {external_texture_size.
width, external_texture_size.height};
167 ASSERT_TRUE(texture);
177 auto dl = Adopt<DisplayList>(
180 OpenPlaygroundHere([&](
const auto& context,
const auto& surface) ->
bool {
189 ASSERT_TRUE(type_context);
194 ASSERT_TRUE(builder);
220 std::string text =
"the ⚡️ quick ⚡️ brown 🦊 fox jumps over the lazy dog 🐶.";
224 reinterpret_cast<const uint8_t*
>(text.data()),
228 auto paragraph = Adopt<Paragraph>(
230 ASSERT_TRUE(paragraph);
238 auto dl = Adopt<DisplayList>(
242 OpenPlaygroundHere([&](
const auto& context,
const auto& surface) ->
bool {