Loading tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java +13 −4 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } Loading @@ -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(); Loading tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs +5 −15 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 { Loading @@ -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); } Loading Loading
tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java +13 −4 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; } Loading @@ -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(); Loading
tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs +5 −15 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 { Loading @@ -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); } Loading