Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package android.opengl.cts;
     17 
     18 import android.content.Intent;
     19 import android.opengl.GLES20;
     20 import android.test.ActivityInstrumentationTestCase2;
     21 
     22 public class ProgramTest extends ActivityInstrumentationTestCase2<OpenGLES20ActivityOne> {
     23 
     24     private OpenGLES20ActivityOne mActivity;
     25 
     26     public ProgramTest() {
     27         super(OpenGLES20ActivityOne.class);
     28     }
     29 
     30     private OpenGLES20ActivityOne getShaderActivity(int viewType, int viewIndex) {
     31         Intent intent = new Intent();
     32         intent.putExtra(OpenGLES20NativeActivityOne.EXTRA_VIEW_TYPE, viewType);
     33         intent.putExtra(OpenGLES20NativeActivityOne.EXTRA_VIEW_INDEX, viewIndex);
     34         setActivityIntent(intent);
     35         OpenGLES20ActivityOne activity = getActivity();
     36         assertTrue(activity.waitForFrameDrawn());
     37         return activity;
     38     }
     39 
     40     public void test_glAttachShader_program() throws Throwable {
     41         mActivity = getShaderActivity(Constants.PROGRAM, 1);
     42         int error = mActivity.glGetError();
     43         assertEquals(GLES20.GL_INVALID_OPERATION, error);
     44     }
     45 }
     46