blob: ab85d1ff3252899eb4f6c242738ef6aad5b60db9 [file] [log] [blame]
Austin Kinross18b931d2014-09-29 12:58:31 -07001#include "ANGLETest.h"
2
3// These tests are designed to ensure that the various configurations of the test fixtures work as expected.
4// If one of these tests fails, then it is likely that some of the other tests are being configured incorrectly.
5// For example, they might be using the D3D11 renderer when the test is meant to be using the D3D9 renderer.
6
7// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
8typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>,
9 TFT<Gles::Three, Rend::WARP>, TFT<Gles::Two, Rend::WARP>,
10 TFT<Gles::Two, Rend::D3D9> > TestFixtureTypes;
11TYPED_TEST_CASE(RendererTest, TestFixtureTypes);
12
13template<typename T>
14class RendererTest : public ANGLETest
15{
16 protected:
17 RendererTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
18 {
19 setWindowWidth(128);
20 setWindowHeight(128);
21 }
22
23 T fixtureType;
24};
25
26TYPED_TEST(RendererTest, RequestedRendererCreated)
27{
28 std::string rendererString = std::string(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
29 std::transform(rendererString.begin(), rendererString.end(), rendererString.begin(), ::tolower);
30
31 std::string versionString = std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
32 std::transform(versionString.begin(), versionString.end(), versionString.begin(), ::tolower);
33
34 // Ensure that the renderer string contains D3D11, if we requested a D3D11 renderer.
35 if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE || fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
36 {
37 ASSERT_NE(rendererString.find(std::string("direct3d11")), std::string::npos);
38 }
39
40 // Ensure that the renderer string contains D3D9, if we requested a D3D9 renderer.
41 if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
42 {
43 ASSERT_NE(rendererString.find(std::string("direct3d9")), std::string::npos);
44 }
45
46 // Ensure that the renderer uses WARP, if we requested it.
47 if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
48 {
49 ASSERT_NE(rendererString.find(std::string("microsoft basic render")), std::string::npos);
50 }
51
52 // Ensure that the renderer string contains GL ES 3.0, if we requested a GL ES 3.0
53 if (fixtureType.GetGlesMajorVersion() == 3)
54 {
55 ASSERT_NE(versionString.find(std::string("es 3.0")), std::string::npos);
56 }
57
58 // Ensure that the version string contains GL ES 2.0, if we requested GL ES 2.0
59 if (fixtureType.GetGlesMajorVersion() == 2)
60 {
61 ASSERT_NE(versionString.find(std::string("es 2.0")), std::string::npos);
62 }
63}