Add a proper test for an RS target API that is too high.
Change-Id: I19a233b85303d3d3eaf54f9c2875a87c4d27a260
diff --git a/tests/res/raw/set_target_api_too_high.bc b/tests/res/raw/set_target_api_too_high.bc
new file mode 100644
index 0000000..95b2026
--- /dev/null
+++ b/tests/res/raw/set_target_api_too_high.bc
Binary files differ
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ScriptC_set_target_api_too_high.java b/tests/tests/renderscript/src/android/renderscript/cts/ScriptC_set_target_api_too_high.java
new file mode 100644
index 0000000..f54ab46
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ScriptC_set_target_api_too_high.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011-2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * This file is auto-generated. DO NOT MODIFY!
+ * The source Renderscript file: set_target_api_16.rs
+ */
+package android.renderscript.cts;
+
+import android.renderscript.*;
+import android.content.res.Resources;
+
+/**
+ * @hide
+ */
+public class ScriptC_set_target_api_too_high extends ScriptC {
+ private static final String __rs_resource_name = "set_target_api_too_high";
+ // Constructor
+ public ScriptC_set_target_api_too_high(RenderScript rs) {
+ this(rs,
+ rs.getApplicationContext().getResources(),
+ rs.getApplicationContext().getResources().getIdentifier(
+ __rs_resource_name, "raw",
+ rs.getApplicationContext().getPackageName()));
+ }
+
+ public ScriptC_set_target_api_too_high(RenderScript rs, Resources resources, int id) {
+ super(rs, resources, id);
+ }
+
+ private final static int mExportFuncIdx_check = 0;
+ public void invoke_check(int version) {
+ FieldPacker check_fp = new FieldPacker(4);
+ check_fp.addI32(version);
+ invoke(mExportFuncIdx_check, check_fp);
+ }
+
+}
+
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/VersionTest.java b/tests/tests/renderscript/src/android/renderscript/cts/VersionTest.java
index 6c9e7e9..e455a70 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/VersionTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/VersionTest.java
@@ -17,6 +17,7 @@
package android.renderscript.cts;
import android.renderscript.RenderScript.RSMessageHandler;
+import android.renderscript.RSRuntimeException;
import com.android.cts.stub.R;
/**
@@ -82,4 +83,16 @@
waitForMessage();
checkForErrors();
}
+
+ public void testVersion_too_high() {
+ try {
+ ScriptC_set_target_api_too_high test_too_high =
+ new ScriptC_set_target_api_too_high(mRS,
+ mRes,
+ R.raw.set_target_api_too_high);
+ fail("should throw RSRuntimeException");
+ } catch (RSRuntimeException e) {
+ }
+ checkForErrors();
+ }
}