xref: /aosp_15_r20/external/deqp/modules/gles3/functional/es3fApiCase.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _ES3FAPICASE_HPP
2 #define _ES3FAPICASE_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program OpenGL ES 3.0 Module
5  * -------------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief API test case.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tes3TestCase.hpp"
28 #include "gluCallLogWrapper.hpp"
29 #include "tcuTestLog.hpp"
30 
31 namespace deqp
32 {
33 namespace gles3
34 {
35 namespace Functional
36 {
37 
38 class ApiCase : public TestCase, protected glu::CallLogWrapper
39 {
40 public:
41     ApiCase(Context &context, const char *name, const char *description);
42     virtual ~ApiCase(void);
43 
44     IterateResult iterate(void);
45 
46 protected:
47     virtual void test(void) = DE_NULL;
48 
49     void expectError(uint32_t error);
50     void expectError(uint32_t error0, uint32_t error1);
51     void getSupportedExtensions(const uint32_t numSupportedValues, const uint32_t extension, std::vector<int> &values);
52     void checkBooleans(uint8_t value, uint8_t expected);
53     void checkBooleans(int32_t value, uint8_t expected);
54 
55     tcu::TestLog &m_log;
56 };
57 
58 // Helper macro for declaring ApiCases.
59 #define ES3F_ADD_API_CASE(NAME, DESCRIPTION, TEST_FUNC_BODY)                        \
60     do                                                                              \
61     {                                                                               \
62         class ApiCase_##NAME : public ApiCase                                       \
63         {                                                                           \
64         public:                                                                     \
65             ApiCase_##NAME(Context &context) : ApiCase(context, #NAME, DESCRIPTION) \
66             {                                                                       \
67             }                                                                       \
68                                                                                     \
69         protected:                                                                  \
70             void test(void) TEST_FUNC_BODY /* NOLINT(TEST_FUNC_BODY) */             \
71         };                                                                          \
72         addChild(new ApiCase_##NAME(m_context));                                    \
73     } while (false)
74 
75 } // namespace Functional
76 } // namespace gles3
77 } // namespace deqp
78 
79 #endif // _ES3FAPICASE_HPP
80