blob: 873dca8dd311ee3a47e41e4d7594788248f10fc2 [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001// Copyright 2021 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "src/tint/ast/external_texture.h"
16
17#include "src/tint/ast/test_helper.h"
dan sinclair3cbf3fc2023-01-21 19:16:15 +000018#include "src/tint/type/texture_dimension.h"
Ryan Harrisondbc13af2022-02-21 15:19:07 +000019
dan sinclair34323ac2022-04-07 18:39:35 +000020namespace tint::ast {
Ryan Harrisondbc13af2022-02-21 15:19:07 +000021namespace {
22
23using AstExternalTextureTest = TestHelper;
24
25TEST_F(AstExternalTextureTest, IsTexture) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000026 Texture* ty = create<ExternalTexture>();
27 EXPECT_FALSE(ty->Is<DepthTexture>());
28 EXPECT_TRUE(ty->Is<ExternalTexture>());
29 EXPECT_FALSE(ty->Is<MultisampledTexture>());
30 EXPECT_FALSE(ty->Is<SampledTexture>());
31 EXPECT_FALSE(ty->Is<StorageTexture>());
Ryan Harrisondbc13af2022-02-21 15:19:07 +000032}
33
34TEST_F(AstExternalTextureTest, Dim) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000035 auto* ty = create<ExternalTexture>();
dan sinclair3cbf3fc2023-01-21 19:16:15 +000036 EXPECT_EQ(ty->dim, type::TextureDimension::k2d);
Ryan Harrisondbc13af2022-02-21 15:19:07 +000037}
38
39TEST_F(AstExternalTextureTest, FriendlyName) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000040 auto* ty = create<ExternalTexture>();
41 EXPECT_EQ(ty->FriendlyName(Symbols()), "texture_external");
Ryan Harrisondbc13af2022-02-21 15:19:07 +000042}
43
44} // namespace
dan sinclair34323ac2022-04-07 18:39:35 +000045} // namespace tint::ast