Home | History | Annotate | Download | only in unittest
      1 // This file is automatically generated from
      2 // frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py
      3 /*
      4  * Copyright (C) 2017 The Android Open Source Project
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 
     19 package com.android.rs.unittest;
     20 
     21 import android.content.Context;
     22 import android.support.v8.renderscript.Allocation;
     23 import android.support.v8.renderscript.Element;
     24 import android.support.v8.renderscript.RenderScript;
     25 import android.support.v8.renderscript.Type;
     26 
     27 public class UT_refcount extends UnitTest {
     28     private Type mT;
     29     private Allocation mA;
     30 
     31     public UT_refcount(Context ctx) {
     32         super("Refcount", ctx);
     33     }
     34 
     35     private void initializeGlobals(RenderScript RS, ScriptC_refcount s) {
     36         Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
     37         int X = 500;
     38         int Y = 700;
     39         typeBuilder.setX(X).setY(Y);
     40         mT = typeBuilder.create();
     41         mA = Allocation.createTyped(RS, mT);
     42         s.set_globalA(mA);
     43     }
     44 
     45     public void run() {
     46         RenderScript pRS = createRenderScript(true);
     47         ScriptC_refcount s = new ScriptC_refcount(pRS);
     48         initializeGlobals(pRS, s);
     49         s.invoke_refcount_test();
     50         pRS.finish();
     51         mA.destroy();
     52         mT.destroy();
     53         s.destroy();
     54         pRS.destroy();
     55     }
     56 }
     57