forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_metal_surface_unittests.cc
42 lines (33 loc) · 1.14 KB
/
test_metal_surface_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
39
40
41
42
// 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/test_metal_context.h"
#include "flutter/testing/test_metal_surface.h"
#include "flutter/testing/testing.h"
namespace flutter {
namespace testing {
#ifdef SHELL_ENABLE_METAL
TEST(TestMetalSurface, EmptySurfaceIsInvalid) {
if (!TestMetalSurface::PlatformSupportsMetal()) {
GTEST_SKIP();
}
TestMetalContext metal_context = TestMetalContext();
auto surface = TestMetalSurface::Create(metal_context);
ASSERT_NE(surface, nullptr);
ASSERT_FALSE(surface->IsValid());
}
TEST(TestMetalSurface, CanCreateValidTestMetalSurface) {
if (!TestMetalSurface::PlatformSupportsMetal()) {
GTEST_SKIP();
}
TestMetalContext metal_context = TestMetalContext();
auto surface =
TestMetalSurface::Create(metal_context, SkISize::Make(100, 100));
ASSERT_NE(surface, nullptr);
ASSERT_TRUE(surface->IsValid());
ASSERT_NE(surface->GetSurface(), nullptr);
ASSERT_NE(surface->GetGrContext(), nullptr);
}
#endif
} // namespace testing
} // namespace flutter