es31fNegativeTestShared.hpp revision ab44fc6da25bb126919615ad2ded101695251161
1#ifndef _ES31FNEGATIVETESTSHARED_HPP
2#define _ES31FNEGATIVETESTSHARED_HPP
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL ES 3.1 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 Shared structures for ES 3.1 negative API tests
24 *//*--------------------------------------------------------------------*/
25
26#include "tcuDefs.hpp"
27#include "glwDefs.hpp"
28#include "gluCallLogWrapper.hpp"
29#include "tes31TestCase.hpp"
30
31namespace tcu
32{
33
34class ResultCollector;
35
36} // tcu
37
38namespace deqp
39{
40namespace gles31
41{
42namespace Functional
43{
44namespace NegativeTestShared
45{
46
47class ErrorCase : public TestCase
48{
49public:
50								ErrorCase		(Context& ctx, const char* name, const char* desc);
51	virtual 					~ErrorCase		(void) {}
52
53	virtual void				expectError		(glw::GLenum error0, glw::GLenum error1) = 0;
54};
55
56class NegativeTestContext : public glu::CallLogWrapper
57{
58public:
59								NegativeTestContext		(ErrorCase& host, glu::RenderContext& renderCtx, const glu::ContextInfo& ctxInfo, tcu::TestLog& log, tcu::ResultCollector& results, bool enableLog);
60								~NegativeTestContext	();
61
62	const tcu::ResultCollector&	getResults				(void) const;
63
64	void						fail					(const std::string& msg);
65	int							getInteger				(glw::GLenum pname) const;
66	const glu::RenderContext&	getRenderContext		(void) const { return m_renderCtx; }
67	const glu::ContextInfo& 	getContextInfo			(void) const { return m_ctxInfo; }
68	void						beginSection			(const std::string& desc);
69	void						endSection				(void);
70
71	void						expectError				(glw::GLenum error);
72	void						expectError				(glw::GLenum error0, glw::GLenum error1);
73
74protected:
75	ErrorCase&					m_host;
76
77private:
78	glu::RenderContext&			m_renderCtx;
79	const glu::ContextInfo& 	m_ctxInfo;
80	tcu::ResultCollector&		m_results;
81	int							m_openSections;
82};
83
84typedef void (*TestFunc)(NegativeTestContext& ctx);
85
86struct FunctionContainer
87{
88	TestFunc	function;
89	const char* name;
90	const char* desc;
91};
92
93} // NegativeTestShared
94} // Functional
95} // gles31
96} // deqp
97
98#endif // _ES31FNEGATIVETESTSHARED_HPP
99