• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.shadows;
2 
3 import static com.google.common.truth.Truth.assertThat;
4 
5 import android.opengl.GLES20;
6 import androidx.test.ext.junit.runners.AndroidJUnit4;
7 import org.junit.Test;
8 import org.junit.runner.RunWith;
9 
10 /** Test for {@link GLES20} */
11 @RunWith(AndroidJUnit4.class)
12 public final class ShadowGLES20Test {
13 
14   @Test
glGenFramebuffers()15   public void glGenFramebuffers() {
16     int[] framebuffers = new int[1];
17     GLES20.glGenFramebuffers(1, framebuffers, 0);
18     assertThat(framebuffers[0]).isAtLeast(1);
19   }
20 
21   @Test
glGenTextures()22   public void glGenTextures() {
23     int[] textures = new int[1];
24     GLES20.glGenTextures(1, textures, 0);
25     assertThat(textures[0]).isAtLeast(1);
26   }
27 
28   @Test
glCreateShader_invalidEnum()29   public void glCreateShader_invalidEnum() {
30     assertThat(GLES20.glCreateShader(-99999)).isEqualTo(GLES20.GL_INVALID_ENUM);
31   }
32 
33   @Test
glCreateShader_validEnum()34   public void glCreateShader_validEnum() {
35     assertThat(GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER)).isAtLeast(1);
36   }
37 
38   @Test
glCreateProgram()39   public void glCreateProgram() {
40     assertThat(GLES20.glCreateProgram()).isAtLeast(1);
41   }
42 
43   @Test
glGetShaderiv_compileStatus()44   public void glGetShaderiv_compileStatus() {
45     int[] params = new int[1];
46     GLES20.glGetShaderiv(1, GLES20.GL_COMPILE_STATUS, params, 0);
47     assertThat(params[0]).isEqualTo(GLES20.GL_TRUE);
48   }
49 
50   @Test
glGetProgramiv_compileStatus()51   public void glGetProgramiv_compileStatus() {
52     int[] params = new int[1];
53     GLES20.glGetProgramiv(1, GLES20.GL_LINK_STATUS, params, 0);
54     assertThat(params[0]).isEqualTo(GLES20.GL_TRUE);
55   }
56 }
57