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 | #ifndef TESTING_CANVAS_TEST_H_ |
6 | #define TESTING_CANVAS_TEST_H_ |
7 | |
8 | #include "flutter/fml/macros.h" |
9 | #include "flutter/testing/mock_canvas.h" |
10 | #include "gtest/gtest.h" |
11 | |
12 | namespace flutter { |
13 | namespace testing { |
14 | |
15 | // This fixture allows creating tests that make use of a mock |SkCanvas|. |
16 | template <typename BaseT> |
17 | class CanvasTestBase : public BaseT { |
18 | public: |
19 | CanvasTestBase() = default; |
20 | |
21 | MockCanvas& mock_canvas() { return canvas_; } |
22 | |
23 | private: |
24 | MockCanvas canvas_; |
25 | |
26 | FML_DISALLOW_COPY_AND_ASSIGN(CanvasTestBase); |
27 | }; |
28 | using CanvasTest = CanvasTestBase<::testing::Test>; |
29 | |
30 | } // namespace testing |
31 | } // namespace flutter |
32 | |
33 | #endif // TESTING_CANVAS_TEST_H_ |
34 | |