Flutter Engine
Loading...
Searching...
No Matches
offscreen_surface_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 "
flutter/flow/layers/offscreen_surface.h
"
6
7
#include <memory>
8
9
#include "gtest/gtest.h"
10
11
namespace
flutter::testing
{
12
13
TEST
(OffscreenSurfaceTest, EmptySurfaceIsInvalid) {
14
auto
surface
= std::make_unique<OffscreenSurface>(
nullptr
,
DlISize
());
15
ASSERT_FALSE(
surface
->IsValid());
16
}
17
18
TEST
(OffscreenSurfaceTest, OnexOneSurfaceIsValid) {
19
auto
surface
= std::make_unique<OffscreenSurface>(
nullptr
,
DlISize
(1, 1));
20
ASSERT_TRUE(
surface
->IsValid());
21
}
22
23
TEST
(OffscreenSurfaceTest, PaintSurfaceBlack) {
24
auto
surface
= std::make_unique<OffscreenSurface>(
nullptr
,
DlISize
(1, 1));
25
26
DlCanvas
* canvas =
surface
->GetCanvas();
27
canvas->
Clear
(
DlColor::kBlack
());
28
canvas->
Flush
();
29
30
auto
raster_data =
surface
->GetRasterData(
false
);
31
const
uint32_t* actual =
32
reinterpret_cast<
const
uint32_t*
>
(raster_data->data());
33
34
// picking black as the color since byte ordering seems to matter.
35
ASSERT_EQ(actual[0], 0xFF000000u);
36
}
37
38
}
// namespace flutter::testing
flutter::DlCanvas
Developer-facing API for rendering anything within the engine.
Definition
dl_canvas.h:32
flutter::DlCanvas::Clear
void Clear(DlColor color)
Definition
dl_canvas.h:104
flutter::DlCanvas::Flush
virtual void Flush()=0
surface
VkSurfaceKHR surface
Definition
main.cc:65
flutter::testing
Definition
native_assets_unittests.cc:10
flutter::testing::TEST
TEST(NativeAssetsManagerTest, NoAvailableAssets)
Definition
native_assets_unittests.cc:68
flutter::DlISize
impeller::ISize32 DlISize
Definition
dl_geometry_types.h:26
offscreen_surface.h
flutter::DlColor::kBlack
static constexpr DlColor kBlack()
Definition
dl_color.h:69
flow
layers
offscreen_surface_unittests.cc
Generated on Thu Nov 6 2025 16:11:21 for Flutter Engine by
1.9.8