Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / gpu / command_buffer / service / context_state_unittest.cc
blob5a835dec4f5ea4858cdba18ba20cfc747d766375
1 // Copyright (c) 2015 The Chromium 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.
5 #include "gpu/command_buffer/service/context_state.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace gpu {
10 namespace gles2 {
12 TEST(ContextStateVec4Test, DefaultValues) {
13 Vec4 v;
14 EXPECT_EQ(Vec4::kFloat, v.type());
15 GLfloat f[4];
16 v.GetValues(f);
17 EXPECT_EQ(0.f, f[0]);
18 EXPECT_EQ(0.f, f[1]);
19 EXPECT_EQ(0.f, f[2]);
20 EXPECT_EQ(1.f, f[3]);
23 TEST(ContextStateVec4Test, SetGetFloatValues) {
24 Vec4 v;
26 const GLfloat kFloatValues[4] = { 2.f, 3.f, 4.f, 5.f };
27 v.SetValues(kFloatValues);
28 EXPECT_EQ(Vec4::kFloat, v.type());
29 GLfloat fv[4];
30 v.GetValues(fv);
31 for (size_t ii = 0; ii < 4; ++ii) {
32 EXPECT_EQ(kFloatValues[ii], fv[ii]);
36 TEST(ContextStateVec4Test, SetGetIntValues) {
37 Vec4 v;
39 const GLint kIntValues[4] = { 2, 3, -4, 5 };
40 v.SetValues(kIntValues);
41 EXPECT_EQ(Vec4::kInt, v.type());
42 GLint iv[4];
43 v.GetValues(iv);
44 for (size_t ii = 0; ii < 4; ++ii) {
45 EXPECT_EQ(kIntValues[ii], iv[ii]);
49 TEST(ContextStateVec4Test, SetGetUIntValues) {
50 Vec4 v;
52 const GLuint kUIntValues[4] = { 2, 3, 4, 5 };
53 v.SetValues(kUIntValues);
54 EXPECT_EQ(Vec4::kUInt, v.type());
55 GLuint uiv[4];
56 v.GetValues(uiv);
57 for (size_t ii = 0; ii < 4; ++ii) {
58 EXPECT_EQ(kUIntValues[ii], uiv[ii]);
62 TEST(ContextStateVec4Test, Equal) {
63 Vec4 v1, v2;
65 const GLint kIntValues[4] = { 2, 3, 4, 5 };
66 const GLuint kUIntValues[4] = { 2, 3, 4, 5 };
68 v1.SetValues(kIntValues);
69 v2.SetValues(kUIntValues);
70 EXPECT_FALSE(v1.Equal(v2));
71 EXPECT_FALSE(v2.Equal(v1));
73 v2.SetValues(kIntValues);
74 EXPECT_TRUE(v1.Equal(v2));
75 EXPECT_TRUE(v2.Equal(v1));
77 const GLint kIntValues2[4] = { 2, 3, 4, 6 };
78 v2.SetValues(kIntValues2);
79 EXPECT_FALSE(v1.Equal(v2));
80 EXPECT_FALSE(v2.Equal(v1));
83 } // namespace gles2
84 } // namespace gpu