UT_small_struct_2.java revision 0d13f3929129bf7e34bde1ed3670195c37a180eb
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 19package com.android.rs.unittest; 20 21import android.content.Context; 22import android.support.v8.renderscript.Allocation; 23import android.support.v8.renderscript.RenderScript; 24import android.support.v8.renderscript.Type; 25 26// Same as UT_small_struct.java except for names of classes and of test. 27 28public class UT_small_struct_2 extends UnitTest { 29 private Allocation A; 30 private Allocation B; 31 private static final int dimX = 3; 32 private static final int dimY = 2; 33 34 public UT_small_struct_2(Context ctx) { 35 super("Small Structs 2", ctx); 36 } 37 38 private void initializeGlobals(RenderScript RS, ScriptC_small_struct_2 s) { 39 s.set_gDimX(dimX); 40 s.set_gDimY(dimY); 41 42 Type.Builder builderA = new Type.Builder(RS, ScriptField_small_struct_2.createElement(RS)); 43 builderA.setX(dimX); 44 builderA.setY(dimY); 45 46 A = Allocation.createTyped(RS, builderA.create()); 47 s.set_A(A); 48 49 Type.Builder builderB = new Type.Builder(RS, ScriptField_struct_of_struct_2.createElement(RS)); 50 builderB.setX(dimX); 51 builderB.setY(dimY); 52 53 B = Allocation.createTyped(RS, builderB.create()); 54 s.set_B(B); 55 return; 56 } 57 58 public void run() { 59 RenderScript pRS = createRenderScript(true); 60 ScriptC_small_struct_2 s = new ScriptC_small_struct_2(pRS); 61 62 initializeGlobals(pRS, s); 63 s.forEach_setStruct(A); 64 s.forEach_setArrayOfStruct(B); 65 s.invoke_test(); 66 67 pRS.finish(); 68 pRS.destroy(); 69 } 70} 71