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/test_metal_surface.h"
6#include "flutter/testing/testing.h"
7
8namespace flutter {
9namespace testing {
10
11TEST(TestMetalSurface, EmptySurfaceIsInvalid) {
12 if (!TestMetalSurface::PlatformSupportsMetal()) {
13 GTEST_SKIP();
14 }
15
16 auto surface = TestMetalSurface::Create();
17 ASSERT_NE(surface, nullptr);
18 ASSERT_FALSE(surface->IsValid());
19}
20
21TEST(TestMetalSurface, CanCreateValidTestMetalSurface) {
22 if (!TestMetalSurface::PlatformSupportsMetal()) {
23 GTEST_SKIP();
24 }
25
26 auto surface = TestMetalSurface::Create(SkISize::Make(100, 100));
27 ASSERT_NE(surface, nullptr);
28 ASSERT_TRUE(surface->IsValid());
29 ASSERT_NE(surface->GetSurface(), nullptr);
30 ASSERT_NE(surface->GetGrContext(), nullptr);
31}
32
33} // namespace testing
34} // namespace flutter
35