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.RenderScript; 23 24public class UT_struct extends UnitTest { 25 26 public UT_struct(Context ctx) { 27 super("Struct", ctx); 28 } 29 30 public void run() { 31 RenderScript pRS = createRenderScript(true); 32 ScriptC_struct s = new ScriptC_struct(pRS); 33 34 ScriptField_Point2 p = new ScriptField_Point2(pRS, 1); 35 ScriptField_Point2.Item i = new ScriptField_Point2.Item(); 36 int val = 100; 37 i.x = val; 38 i.y = val; 39 p.set(i, 0, true); 40 s.bind_point2(p); 41 s.invoke_struct_test(val); 42 pRS.finish(); 43 44 val = 200; 45 p.set_x(0, val, true); 46 p.set_y(0, val, true); 47 s.invoke_struct_test(val); 48 pRS.finish(); 49 p.getAllocation().destroy(); 50 p.getElement().destroy(); 51 s.destroy(); 52 pRS.destroy(); 53 } 54} 55