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#define FML_USED_ON_EMBEDDER
6
7#include "flutter/flow/surface_frame.h"
8#include "flutter/testing/testing.h"
9
10namespace flutter {
11
12TEST(FlowTest, SurfaceFrameDoesNotSubmitInDtor) {
13 SurfaceFrame::FramebufferInfo framebuffer_info;
14 auto surface_frame = std::make_unique<SurfaceFrame>(
15 /*surface=*/args: nullptr, args&: framebuffer_info,
16 /*submit_callback=*/
17 args: [](const SurfaceFrame&, DlCanvas*) {
18 EXPECT_FALSE(true);
19 return true;
20 },
21 args: SkISize::Make(w: 800, h: 600));
22 surface_frame.reset();
23}
24
25TEST(FlowTest, SurfaceFrameDoesNotHaveEmptyCanvas) {
26 SurfaceFrame::FramebufferInfo framebuffer_info;
27 SurfaceFrame frame(
28 /*surface=*/nullptr, framebuffer_info,
29 /*submit_callback=*/[](const SurfaceFrame&, DlCanvas*) { return true; },
30 /*frame_size=*/SkISize::Make(w: 800, h: 600),
31 /*context_result=*/nullptr, /*display_list_fallback=*/true);
32
33 EXPECT_FALSE(frame.Canvas()->GetLocalClipBounds().isEmpty());
34 EXPECT_FALSE(frame.Canvas()->QuickReject(SkRect::MakeLTRB(10, 10, 50, 50)));
35}
36
37} // namespace flutter
38

source code of flutter_engine/flutter/flow/surface_frame_unittests.cc