1#ifndef _TCUTESTPACKAGE_HPP 2#define _TCUTESTPACKAGE_HPP 3/*------------------------------------------------------------------------- 4 * drawElements Quality Program Tester Core 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 Base class for a test case. 24 *//*--------------------------------------------------------------------*/ 25 26#include "tcuDefs.hpp" 27#include "tcuTestCase.hpp" 28#include "tcuTestCaseWrapper.hpp" 29 30namespace tcu 31{ 32 33/*--------------------------------------------------------------------*//*! 34 * \brief Base class for test packages. 35 * 36 * Test packages are root-level test groups. Test case exposes couple of 37 * extra customization points. Test package can define custom TestCaseWrapper 38 * and archive (usually ResourcePrefix around default archive) for resources. 39 * 40 * Test package is typically responsible of setting up rendering context 41 * for test cases. 42 *//*--------------------------------------------------------------------*/ 43class TestPackage : public TestNode 44{ 45public: 46 TestPackage (TestContext& testCtx, const char* name, const char* description); 47 virtual ~TestPackage (void); 48 49 virtual IterateResult iterate (void); 50 51 virtual TestCaseWrapper& getTestCaseWrapper (void) = DE_NULL; 52 virtual Archive& getArchive (void) = DE_NULL; 53}; 54 55// TestPackageRegistry 56 57typedef TestPackage* (*TestPackageCreateFunc) (TestContext& testCtx); 58 59class TestPackageRegistry 60{ 61public: 62 struct PackageInfo 63 { 64 PackageInfo (std::string name_, TestPackageCreateFunc createFunc_) : name(name_), createFunc(createFunc_) {} 65 66 std::string name; 67 TestPackageCreateFunc createFunc; 68 }; 69 70 static TestPackageRegistry* getSingleton (void); 71 static void destroy (void); 72 73 void registerPackage (const char* name, TestPackageCreateFunc createFunc); 74 const std::vector<PackageInfo*>& getPackageInfos (void) const; 75 PackageInfo* getPackageInfoByName (const char* name) const; 76 TestPackage* createPackage (const char* name, TestContext& testCtx) const; 77 78private: 79 TestPackageRegistry (void); 80 ~TestPackageRegistry (void); 81 82 static TestPackageRegistry* getOrDestroy (bool isCreate); 83 84 // Member variables. 85 std::vector<PackageInfo*> m_packageInfos; 86}; 87 88// TestPackageDescriptor 89 90class TestPackageDescriptor 91{ 92public: 93 TestPackageDescriptor (const char* name, TestPackageCreateFunc createFunc); 94 ~TestPackageDescriptor (void); 95}; 96 97// TestPackageRoot 98 99class TestPackageRoot : public TestNode 100{ 101public: 102 TestPackageRoot (TestContext& testCtx); 103 TestPackageRoot (TestContext& testCtx, const std::vector<TestNode*>& children); 104 virtual ~TestPackageRoot (void); 105 106 virtual IterateResult iterate (void); 107}; 108 109} // tcu 110 111#endif // _TCUTESTPACKAGE_HPP 112