• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 emugl {
20 
21 class SnapshotGlUnpackAlignmentTest
22     : public SnapshotSetValueTest<GLuint>,
23       public ::testing::WithParamInterface<GLuint> {
stateCheck(GLuint expected)24     void stateCheck(GLuint expected) override {
25         EXPECT_TRUE(compareGlobalGlInt(gl, GL_UNPACK_ALIGNMENT, expected));
26     }
stateChange()27     void stateChange() override {
28         gl->glPixelStorei(GL_UNPACK_ALIGNMENT, *m_changed_value);
29     }
30 };
31 
TEST_P(SnapshotGlUnpackAlignmentTest,SetUnpackAlign)32 TEST_P(SnapshotGlUnpackAlignmentTest, SetUnpackAlign) {
33     setExpectedValues(4, GetParam());
34     doCheckedSnapshot();
35 }
36 
37 INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels,
38                          SnapshotGlUnpackAlignmentTest,
39                          ::testing::Values(1, 2, 4, 8));
40 
41 class SnapshotGlPackAlignmentTest
42     : public SnapshotSetValueTest<GLuint>,
43       public ::testing::WithParamInterface<GLuint> {
stateCheck(GLuint expected)44     void stateCheck(GLuint expected) override {
45         EXPECT_TRUE(compareGlobalGlInt(gl, GL_PACK_ALIGNMENT, expected));
46     }
stateChange()47     void stateChange() override {
48         gl->glPixelStorei(GL_PACK_ALIGNMENT, *m_changed_value);
49     }
50 };
51 
TEST_P(SnapshotGlPackAlignmentTest,SetPackAlign)52 TEST_P(SnapshotGlPackAlignmentTest, SetPackAlign) {
53     setExpectedValues(4, GetParam());
54     doCheckedSnapshot();
55 }
56 
57 INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels,
58                          SnapshotGlPackAlignmentTest,
59                          ::testing::Values(1, 2, 4, 8));
60 
61 }  // namespace emugl
62