Flutter Windows Embedder
manager_unittests.cc
Go to the documentation of this file.
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 
6 
7 #include "gtest/gtest.h"
8 
9 namespace flutter {
10 namespace testing {
11 
12 namespace {
13 
14 // Whether ANGLE can create an OpenGL ES context of |client_version| on
15 // |manager|'s display.
16 bool CanCreateGLESContext(const egl::Manager& manager, EGLint client_version) {
17  const EGLint attributes[] = {EGL_CONTEXT_CLIENT_VERSION, client_version,
18  EGL_NONE};
19  EGLContext context = ::eglCreateContext(
20  manager.egl_display(), manager.egl_config(), EGL_NO_CONTEXT, attributes);
21  if (context == EGL_NO_CONTEXT) {
22  ::eglGetError(); // Clear the error.
23  return false;
24  }
25  ::eglDestroyContext(manager.egl_display(), context);
26  return true;
27 }
28 
29 } // namespace
30 
31 TEST(EGLManagerTest, FeatureLevel10CapLimitsToOpenGLES2) {
32  // Create an uncapped manager first to verify this machine supports OpenGL ES
33  // 3.0; otherwise the cap has nothing to limit and the test proves nothing.
35  /*allow_inverted_surface=*/false);
36  ASSERT_NE(uncapped, nullptr);
37  if (!CanCreateGLESContext(*uncapped, 3)) {
38  GTEST_SKIP() << "This machine only supports OpenGL ES 2.0.";
39  }
40 
42  /*allow_inverted_surface=*/false,
43  egl::D3DFeatureLevel{10, 0});
44  ASSERT_NE(capped, nullptr);
45  EXPECT_TRUE(CanCreateGLESContext(*capped, 2));
46  EXPECT_FALSE(CanCreateGLESContext(*capped, 3));
47 }
48 
49 } // namespace testing
50 } // namespace flutter
static std::unique_ptr< Manager > Create(GpuPreference gpu_preference, bool allow_inverted_surface, std::optional< D3DFeatureLevel > max_feature_level=std::nullopt)
Definition: manager.cc:61
TEST(AccessibilityBridgeWindows, GetParent)