diff --git a/pages/advance/advance.vue b/pages/advance/advance.vue index c319bda8a2a590631d0f2484865bfabc45ff3b47..3f37c4e97369db72ec0ae844f824e6d9fd58a389 100644 --- a/pages/advance/advance.vue +++ b/pages/advance/advance.vue @@ -24,7 +24,8 @@ clearIntervalTask, playAssetAudio, getMetaConfig, - quitApp + quitApp, + arrayConvert } from "../../uni_modules/uts-advance"; export default { @@ -89,6 +90,9 @@ }, { name: "退出当前应用", function: "testQuitApp" + },{ + name: "数组转换测试", + function: "testArrayConvert" }] }, { @@ -212,6 +216,15 @@ testQuitApp() { quitApp() }, + testArrayConvert() { + let convertRet = arrayConvert() + if(convertRet){ + uni.showToast({ + icon: "none", + title: '数组转换成功' + }); + } + }, testMetaRead() { let ret = getMetaConfig(); uni.showToast({ diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts index 8f50709f29913584894bb7f672506a06b6e6fd57..0f8a2f594deb35505afd11c3583f6ffd1f518a5f 100644 --- a/uni_modules/uts-advance/utssdk/app-android/index.uts +++ b/uni_modules/uts-advance/utssdk/app-android/index.uts @@ -506,4 +506,33 @@ export class User { } +export function arrayConvert():boolean{ + let b1 = byteArrayOf(-1,2,0,3,4,5) + let c1 = UTSArray.fromNative(b1) + if(!(c1 instanceof UTSArray)){ + return false + } + + + let b2 = longArrayOf(-1,2,0,3,4,5) + let c2 = UTSArray.fromNative(b2) + if(!(c2 instanceof UTSArray)){ + return false + } + + + let b3 = shortArrayOf(-1,2,0,3,4,5) + let c3 = UTSArray.fromNative(b3) + if(!(c3 instanceof UTSArray)){ + return false + } + + let b4 = intArrayOf(-1,2,0,3,4,5) + let c4 = UTSArray.fromNative(b4) + if(!(c4 instanceof UTSArray)){ + return false + } + + return true +}