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"
7
8#include "gtest/gtest.h"
9
10namespace impeller {
11namespace testing {
12
13#define CAPABILITY_TEST(name, default_value) \
14 TEST(CapabilitiesTest, name) { \
15 auto defaults = CapabilitiesBuilder().Build(); \
16 ASSERT_EQ(defaults->name(), default_value); \
17 auto opposite = CapabilitiesBuilder().Set##name(!default_value).Build(); \
18 ASSERT_EQ(opposite->name(), !default_value); \
19 }
20
21CAPABILITY_TEST(SupportsOffscreenMSAA, false);
22CAPABILITY_TEST(SupportsSSBO, false);
23CAPABILITY_TEST(SupportsTextureToTextureBlits, false);
24CAPABILITY_TEST(SupportsFramebufferFetch, false);
25CAPABILITY_TEST(SupportsCompute, false);
26CAPABILITY_TEST(SupportsComputeSubgroups, false);
27CAPABILITY_TEST(SupportsReadFromResolve, false);
28CAPABILITY_TEST(SupportsDecalSamplerAddressMode, false);
29CAPABILITY_TEST(SupportsDeviceTransientTextures, false);
30
31TEST(CapabilitiesTest, DefaultColorFormat) {
32 auto defaults = CapabilitiesBuilder().Build();
33 EXPECT_EQ(defaults->GetDefaultColorFormat(), PixelFormat::kUnknown);
34 auto mutated = CapabilitiesBuilder()
36 .Build();
37 EXPECT_EQ(mutated->GetDefaultColorFormat(), PixelFormat::kB10G10R10A10XR);
38}
39
40TEST(CapabilitiesTest, DefaultStencilFormat) {
41 auto defaults = CapabilitiesBuilder().Build();
42 EXPECT_EQ(defaults->GetDefaultStencilFormat(), PixelFormat::kUnknown);
43 auto mutated = CapabilitiesBuilder()
45 .Build();
46 EXPECT_EQ(mutated->GetDefaultStencilFormat(), PixelFormat::kS8UInt);
47}
48
49TEST(CapabilitiesTest, DefaultDepthStencilFormat) {
50 auto defaults = CapabilitiesBuilder().Build();
51 EXPECT_EQ(defaults->GetDefaultDepthStencilFormat(), PixelFormat::kUnknown);
52 auto mutated = CapabilitiesBuilder()
54 .Build();
55 EXPECT_EQ(mutated->GetDefaultDepthStencilFormat(),
57}
58
59TEST(CapabilitiesTest, DefaultGlyphAtlasFormat) {
60 auto defaults = CapabilitiesBuilder().Build();
61 EXPECT_EQ(defaults->GetDefaultGlyphAtlasFormat(), PixelFormat::kUnknown);
62 auto mutated = CapabilitiesBuilder()
64 .Build();
65 EXPECT_EQ(mutated->GetDefaultGlyphAtlasFormat(), PixelFormat::kA8UNormInt);
66}
67
68} // namespace testing
69} // namespace impeller
CapabilitiesBuilder & SetDefaultColorFormat(PixelFormat value)
CapabilitiesBuilder & SetDefaultStencilFormat(PixelFormat value)
CapabilitiesBuilder & SetDefaultGlyphAtlasFormat(PixelFormat value)
std::unique_ptr< Capabilities > Build()
CapabilitiesBuilder & SetDefaultDepthStencilFormat(PixelFormat value)
TEST(AiksCanvasTest, EmptyCullRect)
CAPABILITY_TEST(SupportsOffscreenMSAA, false)