• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Amber 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/dawn/pipeline_info.h"
16 
17 #include <cstdint>
18 
19 #include "dawn/dawncpp.h"
20 #include "gmock/gmock.h"
21 
22 namespace amber {
23 namespace dawn {
24 
25 namespace {
26 
27 using DawnComputePipelineInfoTest = testing::Test;
28 
TEST_F(DawnComputePipelineInfoTest,DefaultValueHasNoShader)29 TEST_F(DawnComputePipelineInfoTest, DefaultValueHasNoShader) {
30   ComputePipelineInfo cpi;
31   EXPECT_FALSE(static_cast<bool>(cpi.compute_shader));
32 }
33 
34 // We can't create Dawn shader modules without a Dawn device.
35 // So skip unit tests for those.
36 
37 using DawnRenderPipelineInfoTest = testing::Test;
38 
TEST_F(DawnRenderPipelineInfoTest,DefaultValuesForMembers)39 TEST_F(DawnRenderPipelineInfoTest, DefaultValuesForMembers) {
40   RenderPipelineInfo rpi;
41   EXPECT_FALSE(static_cast<bool>(rpi.vertex_shader));
42   EXPECT_FALSE(static_cast<bool>(rpi.fragment_shader));
43   EXPECT_FLOAT_EQ(0.0f, rpi.clear_color_value.r);
44   EXPECT_FLOAT_EQ(0.0f, rpi.clear_color_value.g);
45   EXPECT_FLOAT_EQ(0.0f, rpi.clear_color_value.b);
46   EXPECT_FLOAT_EQ(0.0f, rpi.clear_color_value.a);
47   EXPECT_FLOAT_EQ(1.0f, rpi.clear_depth_value);
48   EXPECT_EQ(0u, rpi.clear_stencil_value);
49 }
50 
51 }  // namespace
52 }  // namespace dawn
53 }  // namespace amber
54