Hash :
1a01b4b3
Author :
Date :
2019-11-11T16:41:07
Refactor end2end test macros This is a foundational CL to enabling the end2end tests on swiftshader. Refactored infrastructure with new ANGLE_INSTANTIATE_TEST_ES* macros that will run tests over all various combinations of all platforms for different ES versions. Just skipping failing tests initially to get the refactor landed. Bug: angleproject:4081 Bug: angleproject:4092 Change-Id: I017f6c3267179e49b6ae08cc7488096b423dcdb5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1904635 Commit-Queue: Tobin Ehlis <tobine@google.com> Reviewed-by: Courtney Goeltzenleuchter <courtneygo@google.com>
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
//
// Copyright 2018 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.
//
// MatrixLoadTest.cpp: Tests basic usage of glColor4(f|ub|x).
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "common/matrix_utils.h"
#include "util/random_utils.h"
#include <stdint.h>
using namespace angle;
class MatrixLoadTest : public ANGLETest
{
protected:
MatrixLoadTest()
{
setWindowWidth(32);
setWindowHeight(32);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
}
};
// Checks that a matrix can be loaded.
TEST_P(MatrixLoadTest, Basic)
{
angle::Mat4 testMatrix(0.0f, 4.0f, 8.0f, 12.0f, 1.0f, 5.0f, 9.0f, 10.0f, 2.0f, 6.0f, 10.0f,
14.0f, 3.0f, 7.0f, 11.0f, 15.0f);
angle::Mat4 outputMatrix;
glLoadMatrixf(testMatrix.data());
EXPECT_GL_NO_ERROR();
glGetFloatv(GL_MODELVIEW_MATRIX, outputMatrix.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(testMatrix, outputMatrix);
}
// Checks that loading a matrix doesn't affect the matrix below in the stack.
TEST_P(MatrixLoadTest, PushPop)
{
glPushMatrix();
angle::Mat4 testMatrix(0.0f, 4.0f, 8.0f, 12.0f, 1.0f, 5.0f, 9.0f, 10.0f, 2.0f, 6.0f, 10.0f,
14.0f, 3.0f, 7.0f, 11.0f, 15.0f);
angle::Mat4 outputMatrix;
glLoadMatrixf(testMatrix.data());
EXPECT_GL_NO_ERROR();
glGetFloatv(GL_MODELVIEW_MATRIX, outputMatrix.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(testMatrix, outputMatrix);
glPopMatrix();
glGetFloatv(GL_MODELVIEW_MATRIX, outputMatrix.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(angle::Mat4(), outputMatrix);
}
// Checks that matrices can be loaded for each type of matrix.
TEST_P(MatrixLoadTest, Modes)
{
angle::Mat4 testMatrix(0.0f, 4.0f, 8.0f, 12.0f, 1.0f, 5.0f, 9.0f, 10.0f, 2.0f, 6.0f, 10.0f,
14.0f, 3.0f, 7.0f, 11.0f, 15.0f);
angle::Mat4 outputMatrix;
std::vector<std::pair<GLenum, GLenum>> modeTypes = {{GL_PROJECTION, GL_PROJECTION_MATRIX},
{GL_MODELVIEW, GL_MODELVIEW_MATRIX},
{GL_TEXTURE, GL_TEXTURE_MATRIX}};
for (auto modeType : modeTypes)
{
auto mode = modeType.first;
auto matrixType = modeType.second;
glMatrixMode(mode);
EXPECT_GL_NO_ERROR();
glGetFloatv(matrixType, outputMatrix.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(angle::Mat4(), outputMatrix);
glLoadMatrixf(testMatrix.data());
glGetFloatv(matrixType, outputMatrix.data());
EXPECT_GL_NO_ERROR();
EXPECT_EQ(testMatrix, outputMatrix);
}
}
ANGLE_INSTANTIATE_TEST_ES1(MatrixLoadTest);