提交 1ed4b2ab 编写于 作者: M mahaifeng

[arraybuffer]1.0支持arraybuffer

上级 b8fbad5c
......@@ -9,7 +9,7 @@ import { TUint8Array } from './TUInt8Array.uts'
import { TUint8ClampedArray } from './TUInt8ClampedArray.uts'
import { TUint16Array } from './TUint16Array.uts'
import { TUint32Array } from './TUint32Array.uts'
// #ifdef UNI-APP-X && APP-ANDROID
// #ifdef APP-ANDROID
import ByteBuffer from 'java.nio.ByteBuffer';
// #endif
......@@ -26,7 +26,7 @@ const int16 = new TInt16Array()
export function testArrayBuffer() : Result {
return describe("ArrayBuffer", () => {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
test('arraybuffer_isview', () => {
// #TEST ArrayBuffer.isView
var arrayBuffer = new ArrayBuffer(16)
......@@ -42,7 +42,7 @@ export function testArrayBuffer() : Result {
expect(isViewA).toEqual(false);
})
// #ifdef UNI-APP-X && APP-ANDROID
// #ifdef APP-ANDROID
test('arraybuffer_toByteBuffer', () => {
// #TEST ArrayBuffer.fromByteBuffer,ArrayBuffer.toByteBuffer
var byteBuffer = ByteBuffer.allocate(100)
......
......@@ -18,7 +18,7 @@ export class TDataView {
// this.setUint8();
// this.testMix();
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
setConstructor() {
let buffer = new ArrayBuffer(16);
let dataview = new DataView(buffer);
......
......@@ -7,7 +7,7 @@ import {
export class TFloat32Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testfloat32();
this.testConstructor();
this.testSet();
......@@ -34,7 +34,7 @@ export class TFloat32Array {
this.arrayBufferSlice();
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
from() {
var float32Array = Float32Array.from([1, 2, 3], (v : number, _ : number) : number => v + v);
expect(float32Array.toString()).toEqual('2,4,6');
......
......@@ -7,7 +7,7 @@ import {
export class TFloat64Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testfloat64();
this.testConstructor();
this.testSet();
......@@ -34,7 +34,7 @@ export class TFloat64Array {
this.arrayBufferSlice();
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testfloat64() {
let float64 = new Float64Array(2);
float64[0] = 42;
......
......@@ -7,7 +7,7 @@ import {
export class TInt16Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testConstructor();
this.testSet();
this.testCopyWith();
......@@ -34,7 +34,7 @@ export class TInt16Array {
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testConstructor() {
let buffer = new ArrayBuffer(16);
......
......@@ -7,7 +7,7 @@ import {
export class TInt32Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testInt32Array();
this.testConstructor();
......@@ -36,7 +36,7 @@ export class TInt32Array {
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testInt32Array() {
let int32 = new Int32Array(2);
......
......@@ -8,7 +8,7 @@ import {
export class TInt8Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testConstructor();
this.testSet();
......@@ -36,7 +36,7 @@ export class TInt8Array {
//#endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testConstructor() {
let buffer = new ArrayBuffer(16);
......
......@@ -7,7 +7,7 @@ import {
export class TUint8Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testMAX();
this.testConstructor();
......@@ -35,7 +35,7 @@ export class TUint8Array {
this.arrayBufferSlice();
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
from() {
var s = new Set([1, 2, 3]);
......
......@@ -7,7 +7,7 @@ import {
export class TUint8ClampedArray {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testMAX();
this.testConstructor();
......@@ -36,7 +36,7 @@ export class TUint8ClampedArray {
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testMAX() {
let uint8Clamped = new Uint8ClampedArray(16);
......
......@@ -7,7 +7,7 @@ import {
export class TUint16Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testuint16();
this.testConstructor();
this.testSet();
......@@ -35,7 +35,7 @@ export class TUint16Array {
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testuint16() {
let uint16 = new Uint16Array(2);
uint16[0] = 42;
......
......@@ -7,7 +7,7 @@ import {
export class TUint32Array {
test() {
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
this.testuint32();
this.testConstructor();
......@@ -36,7 +36,7 @@ export class TUint32Array {
// #endif
}
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
testuint32() {
let uint32 = new Uint32Array(2);
uint32[0] = 42;
......
......@@ -42,7 +42,7 @@ export function runTests() : UTSJSONObject {
const consoleRes = testConsole();
const UTSJSONObjectRes = testUTSJSONObject();
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
// #ifdef APP-ANDROID || WEB
const ArrayBufferRes = testArrayBuffer();
// #endif
const NativeCodeRes = testNativeCode();
......@@ -52,7 +52,7 @@ export function runTests() : UTSJSONObject {
String: StringRes,
Error: ErrorRes,
Json: JsonRes,
JSONLarge:JSONLargeRes,
JSONLarge: JSONLargeRes,
Number: NumberRes,
Map: MapRes,
Set: SetRes,
......@@ -63,11 +63,11 @@ export function runTests() : UTSJSONObject {
ForLoop: ForLoopRes,
Global: GlobalRes,
Type: TypeRes,
console:consoleRes,
UTSJSONObject:UTSJSONObjectRes,
// #ifdef (UNI-APP-X && APP-ANDROID) || WEB
ArrayBuffer:ArrayBufferRes,
console: consoleRes,
UTSJSONObject: UTSJSONObjectRes,
// #ifdef APP-ANDROID || WEB
ArrayBuffer: ArrayBufferRes,
// #endif
NativeCode:NativeCodeRes
NativeCode: NativeCodeRes
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册