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.content.res.Resources;
23import android.support.v8.renderscript.Allocation;
24import android.support.v8.renderscript.Element;
25import android.support.v8.renderscript.RenderScript;
26import android.support.v8.renderscript.Sampler;
27import android.support.v8.renderscript.Type;
28
29public class UT_apitest extends UnitTest {
30
31    public UT_apitest(Context ctx) {
32        super("API Test", ctx);
33    }
34
35    public void run() {
36        RenderScript pRS = createRenderScript(true);
37        ScriptC_apitest s = new ScriptC_apitest(pRS);
38        Element elem = Element.I8(pRS);
39        Type.Builder typeBuilder = new Type.Builder(pRS, elem);
40
41        int x = 5;
42        int y = 7;
43        int z = 0;  // Don't actually setZ()
44        s.set_x(x);
45        s.set_y(y);
46        s.set_z(z);
47        typeBuilder.setX(x).setY(y);
48        Type type = typeBuilder.create();
49        Allocation alloc = Allocation.createTyped(pRS, type);
50        Allocation allocDst = Allocation.createTyped(pRS, type);
51        Sampler sampler = Sampler.CLAMP_NEAREST(pRS);
52        s.set_elemNonNull(elem);
53        s.set_typeNonNull(type);
54        s.set_allocNonNull(alloc);
55        s.set_allocDst(allocDst);
56        s.set_samplerNonNull(sampler);
57        s.set_scriptNonNull(s);
58        s.bind_allocPtr(alloc);
59
60        s.invoke_api_test();
61        pRS.finish();
62        pRS.destroy();
63    }
64}
65