Lingfeng Yang | 0e6868f | 2020-11-03 12:32:59 -0800 | [diff] [blame] | 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 | |
Jason Macnak | ed0c9e6 | 2023-03-30 15:58:24 -0700 | [diff] [blame] | 19 | namespace gfxstream { |
| 20 | namespace gl { |
| 21 | namespace { |
Lingfeng Yang | 0e6868f | 2020-11-03 12:32:59 -0800 | [diff] [blame] | 22 | |
| 23 | class SnapshotGlUnpackAlignmentTest |
| 24 | : public SnapshotSetValueTest<GLuint>, |
| 25 | public ::testing::WithParamInterface<GLuint> { |
| 26 | void stateCheck(GLuint expected) override { |
| 27 | EXPECT_TRUE(compareGlobalGlInt(gl, GL_UNPACK_ALIGNMENT, expected)); |
| 28 | } |
| 29 | void stateChange() override { |
| 30 | gl->glPixelStorei(GL_UNPACK_ALIGNMENT, *m_changed_value); |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | TEST_P(SnapshotGlUnpackAlignmentTest, SetUnpackAlign) { |
| 35 | setExpectedValues(4, GetParam()); |
| 36 | doCheckedSnapshot(); |
| 37 | } |
| 38 | |
Kaiyi Li | 1f6758c | 2021-02-07 10:26:13 -0800 | [diff] [blame] | 39 | INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels, |
| 40 | SnapshotGlUnpackAlignmentTest, |
| 41 | ::testing::Values(1, 2, 4, 8)); |
Lingfeng Yang | 0e6868f | 2020-11-03 12:32:59 -0800 | [diff] [blame] | 42 | |
| 43 | class SnapshotGlPackAlignmentTest |
| 44 | : public SnapshotSetValueTest<GLuint>, |
| 45 | public ::testing::WithParamInterface<GLuint> { |
| 46 | void stateCheck(GLuint expected) override { |
| 47 | EXPECT_TRUE(compareGlobalGlInt(gl, GL_PACK_ALIGNMENT, expected)); |
| 48 | } |
| 49 | void stateChange() override { |
| 50 | gl->glPixelStorei(GL_PACK_ALIGNMENT, *m_changed_value); |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | TEST_P(SnapshotGlPackAlignmentTest, SetPackAlign) { |
| 55 | setExpectedValues(4, GetParam()); |
| 56 | doCheckedSnapshot(); |
| 57 | } |
| 58 | |
Kaiyi Li | 1f6758c | 2021-02-07 10:26:13 -0800 | [diff] [blame] | 59 | INSTANTIATE_TEST_SUITE_P(GLES2SnapshotPixels, |
| 60 | SnapshotGlPackAlignmentTest, |
| 61 | ::testing::Values(1, 2, 4, 8)); |
Lingfeng Yang | 0e6868f | 2020-11-03 12:32:59 -0800 | [diff] [blame] | 62 | |
Jason Macnak | ed0c9e6 | 2023-03-30 15:58:24 -0700 | [diff] [blame] | 63 | } // namespace |
| 64 | } // namespace gl |
| 65 | } // namespace gfxstream |