Add CTS_KHR_no_error test implementation
[platform/upstream/VK-GL-CTS.git] / external / openglcts / modules / common / glcNoDefaultContextPackage.cpp
1 /*-------------------------------------------------------------------------
2  * OpenGL Conformance Test Suite
3  * -----------------------------
4  *
5  * Copyright (c) 2017 The Khronos Group Inc.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */ /*!
20  * \file
21  * \brief OpenGL Conformance Test Package that does not have predefined GL context.
22  */ /*-------------------------------------------------------------------*/
23
24 #include "glcNoDefaultContextPackage.hpp"
25 #include "glcNoErrorTests.hpp"
26 #include "gluRenderContext.hpp"
27
28 namespace glcts
29 {
30 namespace nodefaultcontext
31 {
32 class TestCaseWrapper : public tcu::TestCaseExecutor
33 {
34 public:
35         TestCaseWrapper(void);
36         ~TestCaseWrapper(void);
37
38         void init(tcu::TestCase* testCase, const std::string& path);
39         void deinit(tcu::TestCase* testCase);
40         tcu::TestNode::IterateResult iterate(tcu::TestCase* testCase);
41 };
42
43 TestCaseWrapper::TestCaseWrapper(void)
44 {
45 }
46
47 TestCaseWrapper::~TestCaseWrapper(void)
48 {
49 }
50
51 void TestCaseWrapper::init(tcu::TestCase* testCase, const std::string&)
52 {
53         testCase->init();
54 }
55
56 void TestCaseWrapper::deinit(tcu::TestCase* testCase)
57 {
58         testCase->deinit();
59 }
60
61 tcu::TestNode::IterateResult TestCaseWrapper::iterate(tcu::TestCase* testCase)
62 {
63         const tcu::TestCase::IterateResult result = testCase->iterate();
64
65         return result;
66 }
67 } // nodefaultcontext
68
69 NoDefaultContextPackage::NoDefaultContextPackage(tcu::TestContext& testCtx, const char* name)
70         : tcu::TestPackage(testCtx, name, "CTS No Default Context Package")
71 {
72 }
73
74 NoDefaultContextPackage::~NoDefaultContextPackage(void)
75 {
76 }
77
78 tcu::TestCaseExecutor* NoDefaultContextPackage::createExecutor(void) const
79 {
80         return new nodefaultcontext::TestCaseWrapper();
81 }
82
83 void NoDefaultContextPackage::init(void)
84 {
85         tcu::TestCaseGroup* gl30Group = new tcu::TestCaseGroup(getTestContext(), "gl30", "");
86         gl30Group->addChild(new glcts::NoErrorTests(getTestContext(), glu::ApiType::core(3, 0)));
87         addChild(gl30Group);
88         tcu::TestCaseGroup* es2Group = new tcu::TestCaseGroup(getTestContext(), "es2", "");
89         es2Group->addChild(new glcts::NoErrorTests(getTestContext(), glu::ApiType::es(2, 0)));
90         addChild(es2Group);
91 }
92
93 } // glcts