mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
ed30d77ab9
`//flutter/testing` now contains a lot of utilities used by other test targets. This includes stuff like working with render targets that use either OpenGL or Metal, fixtures for interacting with the Dart VM, test assertion predicates, etc.. However, these utilities themselves are not tested as part of a standalone test suite. Instead, only the test targets that include it exercise these utilities. Since these are no longer trivial, a new test target has been added that tests the testing utilities directly.
35 lines
939 B
C++
35 lines
939 B
C++
// 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_surface.h"
|
|
#include "flutter/testing/testing.h"
|
|
|
|
namespace flutter {
|
|
namespace testing {
|
|
|
|
TEST(TestMetalSurface, EmptySurfaceIsInvalid) {
|
|
if (!TestMetalSurface::PlatformSupportsMetal()) {
|
|
GTEST_SKIP();
|
|
}
|
|
|
|
auto surface = TestMetalSurface::Create();
|
|
ASSERT_NE(surface, nullptr);
|
|
ASSERT_FALSE(surface->IsValid());
|
|
}
|
|
|
|
TEST(TestMetalSurface, CanCreateValidTestMetalSurface) {
|
|
if (!TestMetalSurface::PlatformSupportsMetal()) {
|
|
GTEST_SKIP();
|
|
}
|
|
|
|
auto surface = TestMetalSurface::Create(SkISize::Make(100, 100));
|
|
ASSERT_NE(surface, nullptr);
|
|
ASSERT_TRUE(surface->IsValid());
|
|
ASSERT_NE(surface->GetSurface(), nullptr);
|
|
ASSERT_NE(surface->GetGrContext(), nullptr);
|
|
}
|
|
|
|
} // namespace testing
|
|
} // namespace flutter
|