diff options
Diffstat (limited to 'tests')
4 files changed, 156 insertions, 2 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index 1e2a888..895963a 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -906,7 +906,7 @@ public class TestShellActivity extends Activity implements LayoutTestController // this enables cpu upload path (as opposed to gpu upload path) // and it's only meant to be a temporary workaround! settings.setProperty("enable_cpu_upload_path", "true"); - settings.setProperty(WebViewProperties.gfxUseMinimalMemory, "false"); + settings.setProperty("use_minimal_memory", "false"); } private WebView mWebView; @@ -977,4 +977,4 @@ public class TestShellActivity extends Activity implements LayoutTestController private boolean mIsGeolocationPermissionSet; private boolean mGeolocationPermission; private Map mPendingGeolocationPermissionCallbacks; -}
\ No newline at end of file +} diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java index 2293678..eaada5f 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java @@ -67,6 +67,7 @@ public class RSTestCore { unitTests.add(new UT_primitives(this, mRes, mCtx)); unitTests.add(new UT_constant(this, mRes, mCtx)); unitTests.add(new UT_vector(this, mRes, mCtx)); + unitTests.add(new UT_array_init(this, mRes, mCtx)); unitTests.add(new UT_rsdebug(this, mRes, mCtx)); unitTests.add(new UT_rstime(this, mRes, mCtx)); unitTests.add(new UT_rstypes(this, mRes, mCtx)); diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java new file mode 100644 index 0000000..b98b753 --- /dev/null +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 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. + */ + +package com.android.rs.test; + +import android.content.Context; +import android.content.res.Resources; +import android.renderscript.*; + +public class UT_array_init extends UnitTest { + private Resources mRes; + + protected UT_array_init(RSTestCore rstc, Resources res, Context ctx) { + super(rstc, "Array Init", ctx); + mRes = res; + } + + private void checkInit(ScriptC_array_init s) { + float[] fa = s.get_fa(); + _RS_ASSERT("fa[0] == 1.0", fa[0] == 1.0); + _RS_ASSERT("fa[1] == 9.9999f", fa[1] == 9.9999f); + _RS_ASSERT("fa[2] == 0", fa[2] == 0); + _RS_ASSERT("fa[3] == 0", fa[3] == 0); + _RS_ASSERT("fa.length == 4", fa.length == 4); + + double[] da = s.get_da(); + _RS_ASSERT("da[0] == 7.0", da[0] == 7.0); + _RS_ASSERT("da[1] == 8.88888", da[1] == 8.88888); + _RS_ASSERT("da.length == 2", da.length == 2); + + byte[] ca = s.get_ca(); + _RS_ASSERT("ca[0] == 'a'", ca[0] == 'a'); + _RS_ASSERT("ca[1] == 7", ca[1] == 7); + _RS_ASSERT("ca[2] == 'b'", ca[2] == 'b'); + _RS_ASSERT("ca[3] == 'c'", ca[3] == 'c'); + _RS_ASSERT("ca.length == 4", ca.length == 4); + + short[] sa = s.get_sa(); + _RS_ASSERT("sa[0] == 1", sa[0] == 1); + _RS_ASSERT("sa[1] == 1", sa[1] == 1); + _RS_ASSERT("sa[2] == 2", sa[2] == 2); + _RS_ASSERT("sa[3] == 3", sa[3] == 3); + _RS_ASSERT("sa.length == 4", sa.length == 4); + + int[] ia = s.get_ia(); + _RS_ASSERT("ia[0] == 5", ia[0] == 5); + _RS_ASSERT("ia[1] == 8", ia[1] == 8); + _RS_ASSERT("ia[2] == 0", ia[2] == 0); + _RS_ASSERT("ia[3] == 0", ia[3] == 0); + _RS_ASSERT("ia.length == 4", ia.length == 4); + + long[] la = s.get_la(); + _RS_ASSERT("la[0] == 13", la[0] == 13); + _RS_ASSERT("la[1] == 21", la[1] == 21); + _RS_ASSERT("la.length == 4", la.length == 2); + + long[] lla = s.get_lla(); + _RS_ASSERT("lla[0] == 34", lla[0] == 34); + _RS_ASSERT("lla[1] == 0", lla[1] == 0); + _RS_ASSERT("lla[2] == 0", lla[2] == 0); + _RS_ASSERT("lla[3] == 0", lla[3] == 0); + _RS_ASSERT("lla.length == 4", lla.length == 4); + + boolean[] ba = s.get_ba(); + _RS_ASSERT("ba[0] == true", ba[0] == true); + _RS_ASSERT("ba[1] == false", ba[1] == false); + _RS_ASSERT("ba[2] == false", ba[2] == false); + _RS_ASSERT("ba.length == 3", ba.length == 3); + } + + public void run() { + RenderScript pRS = RenderScript.create(mCtx); + ScriptC_array_init s = new ScriptC_array_init(pRS, mRes, R.raw.array_init); + pRS.setMessageHandler(mRsMessage); + checkInit(s); + s.invoke_array_init_test(); + pRS.finish(); + waitForMessage(); + pRS.destroy(); + passTest(); + } +} diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs new file mode 100644 index 0000000..842249a --- /dev/null +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs @@ -0,0 +1,58 @@ +#include "shared.rsh" + +// Testing constant array initialization +float fa[4] = {1.0, 9.9999f}; +double da[2] = {7.0, 8.88888}; +char ca[4] = {'a', 7, 'b', 'c'}; +short sa[4] = {1, 1, 2, 3}; +int ia[4] = {5, 8}; +long la[2] = {13, 21}; +long long lla[4] = {34}; +bool ba[3] = {true, false}; + +void array_init_test() { + bool failed = false; + + _RS_ASSERT(fa[0] == 1.0); + _RS_ASSERT(fa[1] == 9.9999f); + _RS_ASSERT(fa[2] == 0); + _RS_ASSERT(fa[3] == 0); + + _RS_ASSERT(da[0] == 7.0); + _RS_ASSERT(da[1] == 8.88888); + + _RS_ASSERT(ca[0] == 'a'); + _RS_ASSERT(ca[1] == 7); + _RS_ASSERT(ca[2] == 'b'); + _RS_ASSERT(ca[3] == 'c'); + + _RS_ASSERT(sa[0] == 1); + _RS_ASSERT(sa[1] == 1); + _RS_ASSERT(sa[2] == 2); + _RS_ASSERT(sa[3] == 3); + + _RS_ASSERT(ia[0] == 5); + _RS_ASSERT(ia[1] == 8); + _RS_ASSERT(ia[2] == 0); + _RS_ASSERT(ia[3] == 0); + + _RS_ASSERT(la[0] == 13); + _RS_ASSERT(la[1] == 21); + + _RS_ASSERT(lla[0] == 34); + _RS_ASSERT(lla[1] == 0); + _RS_ASSERT(lla[2] == 0); + _RS_ASSERT(lla[3] == 0); + + _RS_ASSERT(ba[0] == true); + _RS_ASSERT(ba[1] == false); + _RS_ASSERT(ba[2] == false); + + if (failed) { + rsSendToClientBlocking(RS_MSG_TEST_FAILED); + } + else { + rsSendToClientBlocking(RS_MSG_TEST_PASSED); + } +} + |