forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock_canvas_unittests.cc
More file actions
32 lines (24 loc) · 906 Bytes
/
mock_canvas_unittests.cc
File metadata and controls
32 lines (24 loc) · 906 Bytes
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
// 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.
#include "flutter/testing/mock_canvas.h"
#include "flutter/testing/canvas_test.h"
#include "gtest/gtest.h"
namespace flutter {
namespace testing {
using MockCanvasTest = CanvasTest;
#ifndef NDEBUG
TEST_F(MockCanvasTest, DrawRRectDies) {
EXPECT_DEATH_IF_SUPPORTED(mock_canvas().DrawRRect(SkRRect(), DlPaint()), "");
}
#endif
TEST_F(MockCanvasTest, DrawCalls) {
const SkRect rect = SkRect::MakeWH(5.0f, 5.0f);
const DlPaint paint = DlPaint(DlColor::kGreen());
const auto expected_draw_calls = std::vector{
MockCanvas::DrawCall{0, MockCanvas::DrawRectData{rect, paint}}};
mock_canvas().DrawRect(rect, paint);
EXPECT_EQ(mock_canvas().draw_calls(), expected_draw_calls);
}
} // namespace testing
} // namespace flutter