Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: gpu/command_buffer/service/context_state_unittest.cc

Issue 1136713003: Add ES3 commands GetVertexAttribI{u}iv to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use overloading functions instead of template Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "gpu/command_buffer/service/context_state.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace gpu {
10 namespace gles2 {
11
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]);
21 }
22
23 TEST(ContextStateVec4Test, SetGetFloatValues) {
24 Vec4 v;
25
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]);
33 }
34 }
35
36 TEST(ContextStateVec4Test, SetGetIntValues) {
37 Vec4 v;
38
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]);
46 }
47 }
48
49 TEST(ContextStateVec4Test, SetGetUIntValues) {
50 Vec4 v;
51
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]);
59 }
60 }
61
62 TEST(ContextStateVec4Test, Equal) {
63 Vec4 v1, v2;
64
65 const GLint kIntValues[4] = { 2, 3, 4, 5 };
66 const GLuint kUIntValues[4] = { 2, 3, 4, 5 };
67
68 v1.SetValues(kIntValues);
69 v2.SetValues(kUIntValues);
70 EXPECT_FALSE(v1.Equal(v2));
71 EXPECT_FALSE(v2.Equal(v1));
72
73 v2.SetValues(kIntValues);
74 EXPECT_TRUE(v1.Equal(v2));
75 EXPECT_TRUE(v2.Equal(v1));
76
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));
81 }
82
83 } // namespace gles2
84 } // namespace gpu
85
86
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698