1 // Copyright (C) 2018 The Android Open Source Project
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 "GLSnapshotTesting.h"
16
17 #include <gtest/gtest.h>
18
19 namespace gfxstream {
20 namespace gl {
21 namespace {
22
23 class SnapshotGlUnpackAlignmentTest
24 : public SnapshotSetValueTest<GLuint>,
25 public ::testing::WithParamInterface<GLuint> {
stateCheck(GLuint expected)26 void stateCheck(GLuint expected) override {
27 EXPECT_TRUE(compareGlobalGlInt(gl, GL_UNPACK_ALIGNMENT, expected));
28 }
stateChange()29 void stateChange() override {
30 gl->glPixelStorei(GL_UNPACK_ALIGNMENT, *m_changed_value);
31 }
32 };
33
TEST_P(SnapshotGlUnpackAlignmentTest,SetUnpackAlign)34 TEST_P(SnapshotGlUnpackAlignmentTest, SetUnpackAlign) {
35 setExpectedValues(4, GetParam());
36 doCheckedSnapshot();
37 }
38
39 INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels,
40 SnapshotGlUnpackAlignmentTest,
41 ::testing::Values(1, 2, 4, 8));
42
43 class SnapshotGlPackAlignmentTest
44 : public SnapshotSetValueTest<GLuint>,
45 public ::testing::WithParamInterface<GLuint> {
stateCheck(GLuint expected)46 void stateCheck(GLuint expected) override {
47 EXPECT_TRUE(compareGlobalGlInt(gl, GL_PACK_ALIGNMENT, expected));
48 }
stateChange()49 void stateChange() override {
50 gl->glPixelStorei(GL_PACK_ALIGNMENT, *m_changed_value);
51 }
52 };
53
TEST_P(SnapshotGlPackAlignmentTest,SetPackAlign)54 TEST_P(SnapshotGlPackAlignmentTest, SetPackAlign) {
55 setExpectedValues(4, GetParam());
56 doCheckedSnapshot();
57 }
58
59 INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels,
60 SnapshotGlPackAlignmentTest,
61 ::testing::Values(1, 2, 4, 8));
62
63 } // namespace
64 } // namespace gl
65 } // namespace gfxstream
66