summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/tests/gles_conformance_tests/gles_conformance_tests.h
blob: df911b0349f52512a3bde767517fab9ed573f20c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//

#ifndef CONFORMANCE_TESTS_CONFORMANCE_TEST_H_
#define CONFORMANCE_TESTS_CONFORMANCE_TEST_H_

#include "gtest/gtest.h"

#include <EGL/egl.h>
#include <EGL/eglext.h>

#include <string>

struct D3D9
{
    static EGLNativeDisplayType GetNativeDisplay()
    {
        return EGL_DEFAULT_DISPLAY;
    }
};

struct D3D11
{
    static EGLNativeDisplayType GetNativeDisplay()
    {
        return EGL_D3D11_ONLY_DISPLAY_ANGLE;
    }
};

#define CONFORMANCE_TESTS_ES2 2
#define CONFORMANCE_TESTS_ES3 3

#if CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES2
    typedef testing::Types<D3D9, D3D11> ConformanceTestTypes;
#elif CONFORMANCE_TESTS_TYPE == CONFORMANCE_TESTS_ES3
    typedef testing::Types<D3D11> ConformanceTestTypes;
#else
#   error "Unknown CONFORMANCE_TESTS_TYPE"
#endif

#define DEFINE_CONFORMANCE_TEST_CLASS(name) \
    template <typename T> class name : public ConformanceTest<T> { }; \
    TYPED_TEST_CASE(name, ConformanceTestTypes);

template <typename T>
class ConformanceTest : public testing::Test
{
  public:
    ConformanceTest()
        : mNativeDisplay(T::GetNativeDisplay())
    {
    }

  protected:
    void run(const std::string &testPath)
    {
        RunConformanceTest(testPath, mNativeDisplay);
    }

  private:
    EGLNativeDisplayType mNativeDisplay;
};

void RunConformanceTest(const std::string &testPath, EGLNativeDisplayType nativeDisplay);

#endif // CONFORMANCE_TESTS_CONFORMANCE_TEST_H_