summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2013-02-13 00:11:57 -0800
committerStephen Hines <srhines@google.com>2013-02-13 00:11:57 -0800
commit37352bb971323801e396e8040b6ceb69783315d2 (patch)
tree75997eda9616f1d58f1884a5f27e6d09a02df06a /tests/RenderScriptTests
parentdac6ed0b69b23ab25757085dd5ce68092516ee2f (diff)
downloadframeworks_base-37352bb971323801e396e8040b6ceb69783315d2.zip
frameworks_base-37352bb971323801e396e8040b6ceb69783315d2.tar.gz
frameworks_base-37352bb971323801e396e8040b6ceb69783315d2.tar.bz2
Add tests for the new clipped kernel Java reflection.
Change-Id: Idb0444823711da356ae0ac025aa79c6ff8068373
Diffstat (limited to 'tests/RenderScriptTests')
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java17
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs20
2 files changed, 18 insertions, 19 deletions
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java
index 782f788..97f3a32 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java
@@ -33,6 +33,10 @@ public class UT_foreach_bounds extends UnitTest {
Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
int X = 5;
int Y = 7;
+ final int xStart = 2;
+ final int xEnd = 5;
+ final int yStart = 3;
+ final int yEnd = 6;
s.set_dimX(X);
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
@@ -41,12 +45,16 @@ public class UT_foreach_bounds extends UnitTest {
s.set_s(s);
s.set_ain(A);
s.set_aout(A);
- s.set_xStart(2);
- s.set_xEnd(5);
- s.set_yStart(3);
- s.set_yEnd(6);
+ s.set_xStart(xStart);
+ s.set_xEnd(xEnd);
+ s.set_yStart(yStart);
+ s.set_yEnd(yEnd);
s.forEach_zero(A);
+ Script.LaunchOptions sc = new Script.LaunchOptions();
+ sc.setX(xStart, xEnd).setY(yStart, yEnd);
+ s.forEach_root(A, sc);
+
return;
}
@@ -55,6 +63,7 @@ public class UT_foreach_bounds extends UnitTest {
ScriptC_foreach_bounds s = new ScriptC_foreach_bounds(pRS);
pRS.setMessageHandler(mRsMessage);
initializeGlobals(pRS, s);
+ s.invoke_verify_root();
s.invoke_foreach_bounds_test();
pRS.finish();
waitForMessage();
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs
index 89df090..fa76390 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs
@@ -7,6 +7,8 @@ int xEnd = 0;
int yStart = 0;
int yEnd = 0;
+static bool failed = false;
+
rs_script s;
rs_allocation aRaw;
rs_allocation ain;
@@ -27,9 +29,6 @@ static bool test_root_output() {
for (j = 0; j < dimY; j++) {
for (i = 0; i < dimX; i++) {
int v = rsGetElementAt_int(aRaw, i, j);
- rsDebug("i: ", i);
- rsDebug("j: ", j);
- rsDebug("a[j][i]: ", v);
if (i < xStart || i >= xEnd || j < yStart || j >= yEnd) {
_RS_ASSERT(v == 0);
} else {
@@ -48,20 +47,11 @@ static bool test_root_output() {
return failed;
}
-void foreach_bounds_test() {
- static bool failed = false;
-
- rs_script_call_t rssc = {0};
- rssc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
- rssc.xStart = xStart;
- rssc.xEnd = xEnd;
- rssc.yStart = yStart;
- rssc.yEnd = yEnd;
-
- rsForEach(s, ain, aout, NULL, 0, &rssc);
-
+void verify_root() {
failed |= test_root_output();
+}
+void foreach_bounds_test() {
if (failed) {
rsSendToClientBlocking(RS_MSG_TEST_FAILED);
}