blob: fa94d9354230fd5808c07ca9492c4f8cafaa0e81 [file] [log] [blame]
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/type/depth_multisampled_texture.h"
#include "src/tint/type/external_texture.h"
#include "src/tint/type/sampled_texture.h"
#include "src/tint/type/storage_texture.h"
#include "src/tint/type/test_helper.h"
namespace tint::type {
namespace {
using DepthMultisampledTextureTest = TestHelper;
TEST_F(DepthMultisampledTextureTest, Creation) {
auto* a = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
auto* b = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
EXPECT_EQ(a, b);
}
TEST_F(DepthMultisampledTextureTest, Hash) {
auto* a = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
auto* b = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
EXPECT_EQ(a->unique_hash, b->unique_hash);
}
TEST_F(DepthMultisampledTextureTest, Equals) {
auto* a = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
auto* b = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
EXPECT_TRUE(a->Equals(*a));
EXPECT_TRUE(a->Equals(*b));
EXPECT_FALSE(a->Equals(Void{}));
}
TEST_F(DepthMultisampledTextureTest, Dim) {
DepthMultisampledTexture d(ast::TextureDimension::k2d);
EXPECT_EQ(d.dim(), ast::TextureDimension::k2d);
}
TEST_F(DepthMultisampledTextureTest, FriendlyName) {
DepthMultisampledTexture d(ast::TextureDimension::k2d);
EXPECT_EQ(d.FriendlyName(Symbols()), "texture_depth_multisampled_2d");
}
TEST_F(DepthMultisampledTextureTest, Clone) {
auto* a = create<DepthMultisampledTexture>(ast::TextureDimension::k2d);
type::Manager mgr;
type::CloneContext ctx{{nullptr}, {nullptr, &mgr}};
auto* dt = a->Clone(ctx);
EXPECT_EQ(dt->dim(), ast::TextureDimension::k2d);
}
} // namespace
} // namespace tint::type