diff --git a/pages/SyntaxCase/utsAndroid.uvue b/pages/SyntaxCase/utsAndroid.uvue
index 10952251fbc4f69d1a521b7f470f0aff5f3d7c3f..ae9290cbd6fbf172fe1f3e08d7fb100c5330a544 100644
--- a/pages/SyntaxCase/utsAndroid.uvue
+++ b/pages/SyntaxCase/utsAndroid.uvue
@@ -9,6 +9,7 @@
+
@@ -50,6 +51,7 @@
import {
getAppContextTest,
getUniActivityTest,
+ getJavaClassTest,
getAppTempPathTest,
typeofClickTest,
gotoSystemPermissionActivityTest,
@@ -123,6 +125,18 @@ export default {
// 取消注册生命周期
unRegLifecycle()
},
+ getJavaClassClick() {
+ if (getJavaClassTest()) {
+ uni.showToast({
+ title: '测试通过'
+ })
+ } else {
+ uni.showToast({
+ icon: 'error',
+ title: '测试失败'
+ })
+ }
+ },
getAppContextClick() {
if (getAppContextTest()) {
uni.showToast({
diff --git a/pages/SyntaxCase/utsAndroid.vue b/pages/SyntaxCase/utsAndroid.vue
index 7ba1af6f8584e28c1edebb0c125fb532a46e4d6f..711baf62cdebb338927447cba11b12b5bc9f277e 100644
--- a/pages/SyntaxCase/utsAndroid.vue
+++ b/pages/SyntaxCase/utsAndroid.vue
@@ -8,6 +8,7 @@
+
@@ -45,6 +46,7 @@
import {
getAppContextTest,
getUniActivityTest,
+ getJavaClassTest,
getAppTempPathTest,
typeofClickTest,
gotoSystemPermissionActivityTest,
@@ -114,6 +116,18 @@
// 取消注册生命周期
unRegLifecycle();
},
+ getJavaClassClick() {
+ if (getJavaClassTest()) {
+ uni.showToast({
+ title: '测试通过'
+ })
+ } else {
+ uni.showToast({
+ icon: 'error',
+ title: '测试失败'
+ })
+ }
+ },
getAppContextClick() {
if (getAppContextTest()) {
uni.showToast({
diff --git a/uni_modules/uts-platform-api/utssdk/app-android/index.uts b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
index 2ce5704bed2655637f1117e1c67076a8989afd58..3b69f4ed795a419c975fc2fe69c460ac180b3851 100644
--- a/uni_modules/uts-platform-api/utssdk/app-android/index.uts
+++ b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
@@ -23,6 +23,20 @@ export function getAppContextTest() : boolean {
return true
}
+
+export function getJavaClassTest() : boolean {
+ let classObj1 = UTSAndroid.getJavaClass(UTSAndroid.getDispatcher())
+ if("io.dcloud.uts.task.UTSTaskDispatcher" == classObj1.name){
+ return true
+ }
+ let classObj2 = UTSAndroid.getJavaClass(UTSAndroid.getAppContext()!)
+ if("io.dcloud.uniapp.UniApplication" == classObj2.name){
+ return true
+ }
+ return false
+}
+
+
/**
* UTSAndroid.getUniActivity 测试示例
* https://uniapp.dcloud.net.cn/plugin/uts-for-android.html#_4-2-1-getuniactivity
diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts
index 8e762416bc3b63f6a371789d55fc2b7d8ad45b6e..8775305759cc869d9aafb8186f5165b34e2c8df8 100644
--- a/uni_modules/uts-tests/utssdk/Number.uts
+++ b/uni_modules/uts-tests/utssdk/Number.uts
@@ -89,8 +89,14 @@ export function testNumber() : Result {
expect((123456789987654).toString(16)).toEqual("7048861cc146");
expect((-0xff).toString(2)).toEqual("-11111111");
const a = 1e38
- expect(a.toString(16)).toEqual("4b3b4ca85a86c4000000000000000000");
- expect(a.toString(2)).toEqual("1001011001110110100110010101000010110101000011011000100000000000000000000000000000000000000000000000000000000000000000000000000")
+
+ expect(a.toString(16).substring(0,12)).toEqual("4b3b4ca85a86");
+ expect(a.toString(16).length).toEqual(32);
+ expect(a.toString(16).substring(23)).toEqual("000000000");
+
+ expect(a.toString(2).length).toEqual(127);
+ expect(a.toString(2).substring(0,32)).toEqual("10010110011101101001100101010000");
+ expect(a.toString(2).substring(100)).toEqual("000000000000000000000000000");
const b = 1e22
expect(b.toString(12)).toEqual("27373a86ba1a194a65054");