From 934241c3c833e2a0e42408e189f31a64f1f186d1 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Wed, 20 Dec 2023 15:56:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20date/number.tostring=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AndroidManifest.xml | 19 ++++++++++--------- .../utssdk/app-android/index.uts | 5 +++-- uni_modules/uts-tests/utssdk/Date.uts | 14 ++++++++++++-- uni_modules/uts-tests/utssdk/Number.uts | 1 + 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index eae83d6..2111f4c 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -6,14 +6,15 @@ > - - - - - - - + + + + + + + + diff --git a/uni_modules/uts-nativepage/utssdk/app-android/index.uts b/uni_modules/uts-nativepage/utssdk/app-android/index.uts index 5820a8c..386d6e5 100644 --- a/uni_modules/uts-nativepage/utssdk/app-android/index.uts +++ b/uni_modules/uts-nativepage/utssdk/app-android/index.uts @@ -194,8 +194,9 @@ class RootActivityStartListener extends OnClickListener{ } override onClick(v?: View):void{ - let intent = Intent("uni.UNI70BE9D0.RootPackageActivity") - host.startActivity(intent) + // 需要开发者替换成自己的包名,并且与AndroidManifest.xml 中保持一致 + let intent = Intent("uni.UNI70BE9D0.RootPackageActivity") + host.startActivity(intent) } } diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index b5daea0..5df20cd 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -9,7 +9,16 @@ export function testDate() : Result { const secondsElapsed = Math.floor(millis / 1000) expect(secondsElapsed).toEqual(2); }, 2000) - }) + }) + test('new Date', () => { + let date1 = new Date('1992-02-02'); + console.log("1111",date1.getTime()) + expect(date1.getTime()).toEqual(696988800000); + let date2 = new Date('1992-2-02'); + console.log("2222",date2.getTime()) + expect(date2.getTime()).toEqual(696960000000); + }) + test('valueOf', () => { const date1 = new Date('December 17, 1995 03:24:00'); expect(date1.valueOf()).toEqual(819141840000); @@ -104,7 +113,8 @@ export function testDate() : Result { expect(new Date(2016, 6, 6, 13, 59, 59, 999).getHours()).toEqual(13); // subsequent millisecond expect(new Date(2016, 6, 6, 13, 59, 59, 1000).getHours()).toEqual(14); - }) + }) + test('getMilliseconds', () => { const moonLanding = new Date('July 20, 69 00:20:18'); moonLanding.setMilliseconds(123); diff --git a/uni_modules/uts-tests/utssdk/Number.uts b/uni_modules/uts-tests/utssdk/Number.uts index 0e1a0fb..2dca1ed 100644 --- a/uni_modules/uts-tests/utssdk/Number.uts +++ b/uni_modules/uts-tests/utssdk/Number.uts @@ -84,6 +84,7 @@ export function testNumber() : Result { expect((6).toString(2)).toEqual("110"); expect((254).toString(16)).toEqual("fe"); expect((-10).toString(2)).toEqual("-1010"); + expect((-0xff).toString(2)).toEqual("-11111111"); }) -- GitLab