1 // 2 // Copyright 2014 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #ifndef CONFORMANCE_TESTS_CONFORMANCE_TEST_H_ 8 #define CONFORMANCE_TESTS_CONFORMANCE_TEST_H_ 9 10 #include "gtest/gtest.h" 11 12 #include <EGL/egl.h> 13 #include <EGL/eglext.h> 14 15 #include <string> 16 17 struct D3D9 18 { GetNativeDisplayD3D919 static EGLNativeDisplayType GetNativeDisplay() { return EGL_DEFAULT_DISPLAY; } 20 }; 21 22 struct D3D11 23 { GetNativeDisplayD3D1124 static EGLNativeDisplayType GetNativeDisplay() { return EGL_D3D11_ONLY_DISPLAY_ANGLE; } 25 }; 26 27 #define CONFORMANCE_TESTS_ES2 2 28 #define CONFORMANCE_TESTS_ES3 3 29 30 #if CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES2 31 typedef testing::Types<D3D9, D3D11> ConformanceTestTypes; 32 #elif CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES3 33 typedef testing::Types<D3D11> ConformanceTestTypes; 34 #else 35 # error "Unknown CONFORMANCE_TESTS_TYPE" 36 #endif 37 38 #define DEFINE_CONFORMANCE_TEST_CLASS(name) \ 39 template <typename T> \ 40 class name : public ConformanceTest<T> \ 41 {}; \ 42 TYPED_TEST_SUITE(name, ConformanceTestTypes); 43 44 template <typename T> 45 class ConformanceTest : public testing::Test 46 { 47 public: ConformanceTest()48 ConformanceTest() : mNativeDisplay(T::GetNativeDisplay()) {} 49 50 protected: run(const std::string & testPath)51 void run(const std::string &testPath) { RunConformanceTest(testPath, mNativeDisplay); } 52 53 private: 54 EGLNativeDisplayType mNativeDisplay; 55 }; 56 57 void RunConformanceTest(const std::string &testPath, EGLNativeDisplayType nativeDisplay); 58 59 #endif // CONFORMANCE_TESTS_CONFORMANCE_TEST_H_ 60