forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
surface_frame_unittests.cc
38 lines (31 loc) · 1.2 KB
/
surface_frame_unittests.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#define FML_USED_ON_EMBEDDER
#include "flutter/flow/surface_frame.h"
#include "flutter/testing/testing.h"
namespace flutter {
TEST(FlowTest, SurfaceFrameDoesNotSubmitInDtor) {
SurfaceFrame::FramebufferInfo framebuffer_info;
auto surface_frame = std::make_unique<SurfaceFrame>(
/*surface=*/nullptr, framebuffer_info,
/*submit_callback=*/
[](const SurfaceFrame&, SkCanvas*) {
EXPECT_FALSE(true);
return true;
},
SkISize::Make(800, 600));
surface_frame.reset();
}
TEST(FlowTest, SurfaceFrameDoesNotHaveEmptyCanvas) {
SurfaceFrame::FramebufferInfo framebuffer_info;
SurfaceFrame frame(
/*surface=*/nullptr, framebuffer_info,
/*submit_callback=*/[](const SurfaceFrame&, SkCanvas*) { return true; },
/*frame_size=*/SkISize::Make(800, 600),
/*context_result=*/nullptr, /*display_list_fallback=*/true);
EXPECT_FALSE(frame.SkiaCanvas()->getLocalClipBounds().isEmpty());
EXPECT_FALSE(
frame.SkiaCanvas()->quickReject(SkRect::MakeLTRB(10, 10, 50, 50)));
}
} // namespace flutter