TestShaderCompilation tests whether the `LoadShader` method will indeed report errors iff (one of) the GLSL-shaders is incorrect.
(t *testing.T)
| 36 | // TestShaderCompilation tests whether the `LoadShader` method will indeed report errors iff |
| 37 | // (one of) the GLSL-shaders is incorrect. |
| 38 | func TestShaderCompilation(t *testing.T) { |
| 39 | engo.Run(engo.RunOptions{ |
| 40 | NoRun: true, |
| 41 | HeadlessMode: true, |
| 42 | }, &testScene{}) |
| 43 | engo.CreateWindow("", 100, 100, false, 1) |
| 44 | defer engo.DestroyWindow() |
| 45 | |
| 46 | var err error |
| 47 | |
| 48 | _, err = LoadShader(correctVertShader, correctFragShader) |
| 49 | assert.NoError(t, err) |
| 50 | |
| 51 | _, err = LoadShader(correctVertShader, incorrectFragShader) |
| 52 | assert.IsType(t, FragmentShaderCompilationError{}, err) |
| 53 | |
| 54 | _, err = LoadShader(incorrectVertShader, correctFragShader) |
| 55 | assert.IsType(t, VertexShaderCompilationError{}, err) |
| 56 | |
| 57 | _, err = LoadShader(incorrectVertShader, incorrectFragShader) |
| 58 | assert.Error(t, err) // don't really care which one it is |
| 59 | } |
| 60 | |
| 61 | var correctVertShader = ` |
| 62 | attribute vec2 in_Position; |
nothing calls this directly
no test coverage detected