Flutter Engine
The Flutter Engine
capabilities_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
5#include "flutter/testing/testing.h" // IWYU pragma: keep
6#include "gtest/gtest.h"
9
10namespace impeller {
11namespace testing {
12
13TEST(CapabilitiesGLES, CanInitializeWithDefaults) {
14 auto mock_gles = MockGLES::Init();
15
16 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
17
18 EXPECT_FALSE(capabilities->SupportsOffscreenMSAA());
19 EXPECT_FALSE(capabilities->SupportsSSBO());
20 EXPECT_FALSE(capabilities->SupportsTextureToTextureBlits());
21 EXPECT_FALSE(capabilities->SupportsFramebufferFetch());
22 EXPECT_FALSE(capabilities->SupportsCompute());
23 EXPECT_FALSE(capabilities->SupportsComputeSubgroups());
24 EXPECT_FALSE(capabilities->SupportsReadFromResolve());
25 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
26 EXPECT_FALSE(capabilities->SupportsDeviceTransientTextures());
27
28 EXPECT_EQ(capabilities->GetDefaultColorFormat(),
30 EXPECT_EQ(capabilities->GetDefaultStencilFormat(), PixelFormat::kS8UInt);
31 EXPECT_EQ(capabilities->GetDefaultDepthStencilFormat(),
33}
34
35TEST(CapabilitiesGLES, SupportsDecalSamplerAddressMode) {
36 auto const extensions = std::vector<const unsigned char*>{
37 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
38 reinterpret_cast<const unsigned char*>("GL_EXT_texture_border_clamp"), //
39 };
40 auto mock_gles = MockGLES::Init(extensions);
41 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
42 EXPECT_TRUE(capabilities->SupportsDecalSamplerAddressMode());
43}
44
45TEST(CapabilitiesGLES, SupportsDecalSamplerAddressModeNotOES) {
46 auto const extensions = std::vector<const unsigned char*>{
47 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
48 reinterpret_cast<const unsigned char*>("GL_OES_texture_border_clamp"), //
49 };
50 auto mock_gles = MockGLES::Init(extensions);
51 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
52 EXPECT_FALSE(capabilities->SupportsDecalSamplerAddressMode());
53}
54
55TEST(CapabilitiesGLES, SupportsFramebufferFetch) {
56 auto const extensions = std::vector<const unsigned char*>{
57 reinterpret_cast<const unsigned char*>("GL_KHR_debug"), //
58 reinterpret_cast<const unsigned char*>(
59 "GL_EXT_shader_framebuffer_fetch"), //
60 };
61 auto mock_gles = MockGLES::Init(extensions);
62 auto capabilities = mock_gles->GetProcTable().GetCapabilities();
63 EXPECT_TRUE(capabilities->SupportsFramebufferFetch());
64}
65
66} // namespace testing
67} // namespace impeller
The Vulkan layers and extensions wrangler.
static std::shared_ptr< MockGLES > Init(const std::optional< std::vector< const unsigned char * > > &extensions=std::nullopt, const char *version_string="OpenGL ES 3.0", ProcTableGLES::Resolver resolver=kMockResolverGLES)
Returns an initialized |MockGLES| instance.
Definition: mock_gles.cc:166
TEST(AiksCanvasTest, EmptyCullRect)
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678