Flutter Engine
The Flutter Engine
mock_canvas_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/testing/mock_canvas.h"
6
7#include "flutter/testing/canvas_test.h"
8#include "gtest/gtest.h"
9
10namespace flutter {
11namespace testing {
12
14
15#ifndef NDEBUG
16TEST_F(MockCanvasTest, DrawRRectDies) {
17 EXPECT_DEATH_IF_SUPPORTED(mock_canvas().DrawRRect(SkRRect(), DlPaint()), "");
18}
19#endif
20
22 const SkRect rect = SkRect::MakeWH(5.0f, 5.0f);
24 const auto expected_draw_calls = std::vector{
26
27 mock_canvas().DrawRect(rect, paint);
28 EXPECT_EQ(mock_canvas().draw_calls(), expected_draw_calls);
29}
30
31} // namespace testing
32} // namespace flutter
const Paint & paint
Definition: color_source.cc:38
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
TEST_F(DisplayListTest, Defaults)
CanvasTestBase<::testing::Test > CanvasTest
Definition: canvas_test.h:31
flutter::DlPaint DlPaint
static constexpr SkRect MakeWH(float w, float h)
Definition: SkRect.h:609
static constexpr DlColor kGreen()
Definition: dl_color.h:25