From 68ecb051d0f31516d3daf1510b3e9238aa902162 Mon Sep 17 00:00:00 2001 From: m0_75226990 Date: Tue, 9 Jul 2024 17:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E9=81=BF=E5=85=8DiOS=E7=BC=96=E8=AF=91=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-syntaxcase/utssdk/index.uts | 24 +------------------ .../uts-syntaxcase/utssdk/interface.uts | 22 ++++++++++++++++- uni_modules/uts-tests/utssdk/ArrayBuffer.uts | 3 ++- uni_modules/uts-tests/utssdk/TDataView.uts | 2 ++ .../uts-tests/utssdk/TFloat32Array.uts | 4 ++++ .../uts-tests/utssdk/TFloat64Array.uts | 5 +++- uni_modules/uts-tests/utssdk/TInt16Array.uts | 5 +++- uni_modules/uts-tests/utssdk/TInt32Array.uts | 4 ++++ uni_modules/uts-tests/utssdk/TInt8Array.uts | 5 +++- uni_modules/uts-tests/utssdk/TUInt8Array.uts | 4 ++++ .../uts-tests/utssdk/TUInt8ClampedArray.uts | 4 ++++ uni_modules/uts-tests/utssdk/TUint16Array.uts | 7 +++++- uni_modules/uts-tests/utssdk/TUint32Array.uts | 4 ++++ 13 files changed, 64 insertions(+), 29 deletions(-) diff --git a/uni_modules/uts-syntaxcase/utssdk/index.uts b/uni_modules/uts-syntaxcase/utssdk/index.uts index 7c1de1e..0c18337 100644 --- a/uni_modules/uts-syntaxcase/utssdk/index.uts +++ b/uni_modules/uts-syntaxcase/utssdk/index.uts @@ -1,23 +1,6 @@ -import { RequestTask, SyncOptions } from "./interface.uts"; +import { RequestTask, SyncOptions, AsyncOptions, SyntaxResult, SyncResult, TestOptions } from "./interface.uts"; import { log } from "./utils.uts"; -export type AsyncOptions = { - type : string; - success : (res : string) => void; - fail : (res : string) => void; - complete : (res : string) => void; -}; -export type { - SyncOptions -} from "./interface.uts"; - -type SyntaxResult = { - name : string -}; - -type SyncResult = { - msg : string -} /** * 导出一个属性 @@ -115,11 +98,6 @@ export async function testAsyncParam3(id : number, name : string, opts : AsyncOp } -export type TestOptions = { - name : string; - callback : (res : string) => void; -}; - export class Test { id : number; name : string; diff --git a/uni_modules/uts-syntaxcase/utssdk/interface.uts b/uni_modules/uts-syntaxcase/utssdk/interface.uts index 3a29e46..4a7e8fd 100644 --- a/uni_modules/uts-syntaxcase/utssdk/interface.uts +++ b/uni_modules/uts-syntaxcase/utssdk/interface.uts @@ -8,4 +8,24 @@ export interface RequestTask { abort() : RequestTask onCallback(callback : (res : string) => void) : void sync(options : SyncOptions) : string -} \ No newline at end of file +} + +export type AsyncOptions = { + type : string; + success : (res : string) => void; + fail : (res : string) => void; + complete : (res : string) => void; +}; + +export type SyntaxResult = { + name : string +}; + +export type SyncResult = { + msg : string +} + +export type TestOptions = { + name : string; + callback : (res : string) => void; +}; \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/ArrayBuffer.uts b/uni_modules/uts-tests/utssdk/ArrayBuffer.uts index 2f66bd1..9908c31 100644 --- a/uni_modules/uts-tests/utssdk/ArrayBuffer.uts +++ b/uni_modules/uts-tests/utssdk/ArrayBuffer.uts @@ -23,6 +23,7 @@ const int16 = new TInt16Array() export function testArrayBuffer() : Result { return describe("ArrayBuffer", () => { + // #ifdef APP-ANDROID //dataview start test('dataview_constructor', () => { tDataView.setConstructor() @@ -725,7 +726,7 @@ export function testArrayBuffer() : Result { test('uint32_arrayBufferSlice', () => { uint32.arrayBufferSlice() }) - + // #endif //uint32 end }) } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TDataView.uts b/uni_modules/uts-tests/utssdk/TDataView.uts index 3e03ce5..4191e6a 100644 --- a/uni_modules/uts-tests/utssdk/TDataView.uts +++ b/uni_modules/uts-tests/utssdk/TDataView.uts @@ -18,6 +18,7 @@ export class TDataView { // this.setUint8(); // this.testMix(); } + // #ifdef APP-ANDROID setConstructor() { let buffer = new ArrayBuffer(16); let dataview = new DataView(buffer); @@ -327,4 +328,5 @@ class LittleEndian { this.uint8View_[byteOffset + 3] * (1 << 24) ); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TFloat32Array.uts b/uni_modules/uts-tests/utssdk/TFloat32Array.uts index 682836a..ffed4d8 100644 --- a/uni_modules/uts-tests/utssdk/TFloat32Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat32Array.uts @@ -7,6 +7,7 @@ import { export class TFloat32Array { test() { + // #ifdef APP-ANDROID this.testfloat32(); this.testConstructor(); this.testSet(); @@ -31,7 +32,9 @@ export class TFloat32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } + // #ifdef APP-ANDROID from(){ var float32Array= Float32Array.from([1, 2, 3], (v: number, _: number):number => v + v); expect(float32Array.toString()).toEqual('2,4,6'); @@ -285,4 +288,5 @@ export class TFloat32Array { let sliced = new Float32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TFloat64Array.uts b/uni_modules/uts-tests/utssdk/TFloat64Array.uts index 5317351..92e7e23 100644 --- a/uni_modules/uts-tests/utssdk/TFloat64Array.uts +++ b/uni_modules/uts-tests/utssdk/TFloat64Array.uts @@ -7,6 +7,7 @@ import { export class TFloat64Array { test() { + // #ifdef APP-ANDROID this.testfloat64(); this.testConstructor(); this.testSet(); @@ -31,8 +32,9 @@ export class TFloat64Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - +// #ifdef APP-ANDROID testfloat64() { let float32 = new Float64Array(2); float32[0] = 42; @@ -276,4 +278,5 @@ export class TFloat64Array { let sliced = new Float64Array(res); expect(sliced[0]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TInt16Array.uts b/uni_modules/uts-tests/utssdk/TInt16Array.uts index f9f7145..d527a0d 100644 --- a/uni_modules/uts-tests/utssdk/TInt16Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt16Array.uts @@ -7,6 +7,7 @@ import { export class TInt16Array { test() { + // #ifdef APP-ANDROID this.testConstructor(); this.testSet(); this.testCopyWith(); @@ -30,9 +31,10 @@ export class TInt16Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - +// #ifdef APP-ANDROID testConstructor() { let buffer = new ArrayBuffer(16); let float32 = new Int16Array(buffer); @@ -250,4 +252,5 @@ export class TInt16Array { let sliced = new Int16Array(res); expect(sliced[0]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TInt32Array.uts b/uni_modules/uts-tests/utssdk/TInt32Array.uts index 9ef3aee..c837b5d 100644 --- a/uni_modules/uts-tests/utssdk/TInt32Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt32Array.uts @@ -7,6 +7,7 @@ import { export class TInt32Array { test() { + // #ifdef APP-ANDROID this.testfloat32(); this.testConstructor(); this.testSet(); @@ -31,8 +32,10 @@ export class TInt32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } +// #ifdef APP-ANDROID testfloat32() { let float32 = new Int32Array(2); float32[0] = 42; @@ -266,4 +269,5 @@ export class TInt32Array { let sliced = new Int32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } diff --git a/uni_modules/uts-tests/utssdk/TInt8Array.uts b/uni_modules/uts-tests/utssdk/TInt8Array.uts index e89f52e..76f6c44 100644 --- a/uni_modules/uts-tests/utssdk/TInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TInt8Array.uts @@ -8,6 +8,7 @@ import { export class TInt8Array { test() { + // #ifdef APP-ANDROID this.testConstructor(); this.testSet(); this.testCopyWith(); @@ -31,9 +32,10 @@ export class TInt8Array { this.subarray(); this.values(); this.arrayBufferSlice(); + //#endif } - +// #ifdef APP-ANDROID testConstructor() { let buffer = new ArrayBuffer(16); let int8View = new Int8Array(buffer); @@ -261,4 +263,5 @@ export class TInt8Array { let sliced = new Int8Array(res); expect(sliced[0]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TUInt8Array.uts b/uni_modules/uts-tests/utssdk/TUInt8Array.uts index c4b417b..41a2444 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8Array.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8Array.uts @@ -7,6 +7,7 @@ import { export class TUint8Array { test() { + // #ifdef APP-ANDROID this.testMAX(); this.testConstructor(); this.testSet(); @@ -31,7 +32,9 @@ export class TUint8Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } + // #ifdef APP-ANDROID from() { var s = new Set([1, 2, 3]); var unit8 = Uint8Array.from(s); @@ -264,4 +267,5 @@ export class TUint8Array { let sliced = new Uint8Array(res); expect(sliced[0]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts index 862e803..6eb8fca 100644 --- a/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts +++ b/uni_modules/uts-tests/utssdk/TUInt8ClampedArray.uts @@ -7,6 +7,7 @@ import { export class TUint8ClampedArray { test() { + // #ifdef APP-ANDROID this.testMAX(); this.testConstructor(); this.testSet(); @@ -31,8 +32,10 @@ export class TUint8ClampedArray { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } +// #ifdef APP-ANDROID testMAX() { let float32 = new Uint8ClampedArray(16); float32[0] = 255; @@ -259,4 +262,5 @@ export class TUint8ClampedArray { let sliced = new Uint8ClampedArray(res); expect(sliced[0]).toEqual(42); } + // #endif } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TUint16Array.uts b/uni_modules/uts-tests/utssdk/TUint16Array.uts index 06f5a7c..efd8253 100644 --- a/uni_modules/uts-tests/utssdk/TUint16Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint16Array.uts @@ -7,6 +7,7 @@ import { export class TUint16Array { test() { + // #ifdef APP-ANDROID this.testfloat32(); this.testConstructor(); this.testSet(); @@ -31,8 +32,10 @@ export class TUint16Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } - + + // #ifdef APP-ANDROID testfloat32() { let float32 = new Uint16Array(2); float32[0] = 42; @@ -273,4 +276,6 @@ export class TUint16Array { let sliced = new Uint16Array(res); expect(sliced[0]).toEqual(42); } + // #endif + } \ No newline at end of file diff --git a/uni_modules/uts-tests/utssdk/TUint32Array.uts b/uni_modules/uts-tests/utssdk/TUint32Array.uts index ac621d7..a1716b3 100644 --- a/uni_modules/uts-tests/utssdk/TUint32Array.uts +++ b/uni_modules/uts-tests/utssdk/TUint32Array.uts @@ -7,6 +7,7 @@ import { export class TUint32Array { test() { + // #ifdef APP-ANDROID this.testfloat32(); this.testConstructor(); this.testSet(); @@ -31,8 +32,10 @@ export class TUint32Array { this.subarray(); this.values(); this.arrayBufferSlice(); + // #endif } +// #ifdef APP-ANDROID testfloat32() { let float32 = new Uint32Array(2); float32[0] = 42; @@ -273,4 +276,5 @@ export class TUint32Array { let sliced = new Uint32Array(res); expect(sliced[1]).toEqual(42); } + // #endif } \ No newline at end of file -- GitLab