mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
* change from build_runner to dart2js * add internalBootstrapBrowserTest to some of the tests * add internalBootstrapBrowserTest to all remaining tests * make tests build in paralel. Total time dropped from 586 to 177 seconds for 8 core MacBook * change isolates with pool * fixing analysis errors * skipping canvaskit tests for ios-safari * copy image files to the build directory * adding internalBootstrapBrowserTest to newly added tests * add internalBootstrapBrowserTest to faling path iterator test * necessary changes to make chrome windows work * in windows test in chrome instead of edge. our edge code was for legacy edge * do not run golden unit tests on Windows LUCI bots for now * addressing reviewer comments. Adding a method for deciding when to run integration tests. * remove lines that I forgot to remove * fixing analysis error. add issue for todo * add bootstap to a test file * adding bootstrap to another test * add internalBootstrapBrowserTest to a golden test * return test result in bat file. use archieve package to unzip * fixing logs for chrome_installer * use archieve and archieve entity instead of dynamic * adding comments for windows platform archieve part * addressing reviewer comments * change readme file
89 lines
3.2 KiB
Dart
89 lines
3.2 KiB
Dart
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// @dart = 2.6
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:test/test.dart';
|
|
import 'package:test/bootstrap/browser.dart';
|
|
import 'package:ui/ui.dart';
|
|
import 'package:ui/src/engine.dart';
|
|
|
|
void main() {
|
|
internalBootstrapBrowserTest(() => testMain);
|
|
}
|
|
|
|
void testMain() {
|
|
group('Write and read buffer round-trip', () {
|
|
test('of single byte', () {
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putUint8(201);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(1));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
expect(read.getUint8(), equals(201));
|
|
});
|
|
test('of 32-bit integer', () {
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putInt32(-9);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(4));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
expect(read.getInt32(), equals(-9));
|
|
});
|
|
test('of 64-bit integer', () {
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putInt64(-9000000000000);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(8));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
expect(read.getInt64(), equals(-9000000000000));
|
|
}, skip: isWeb);
|
|
test('of double', () {
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putFloat64(3.14);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(8));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
expect(read.getFloat64(), equals(3.14));
|
|
});
|
|
test('of 32-bit int list when unaligned', () {
|
|
final Int32List integers = Int32List.fromList(<int>[-99, 2, 99]);
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putUint8(9);
|
|
write.putInt32List(integers);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(16));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
read.getUint8();
|
|
expect(read.getInt32List(3), equals(integers));
|
|
});
|
|
test('of 64-bit int list when unaligned', () {
|
|
final Int64List integers = Int64List.fromList(<int>[-99, 2, 99]);
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putUint8(9);
|
|
write.putInt64List(integers);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(32));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
read.getUint8();
|
|
expect(read.getInt64List(3), equals(integers));
|
|
}, skip: isWeb);
|
|
test('of double list when unaligned', () {
|
|
final Float64List doubles =
|
|
Float64List.fromList(<double>[3.14, double.nan]);
|
|
final WriteBuffer write = WriteBuffer();
|
|
write.putUint8(9);
|
|
write.putFloat64List(doubles);
|
|
final ByteData written = write.done();
|
|
expect(written.lengthInBytes, equals(24));
|
|
final ReadBuffer read = ReadBuffer(written);
|
|
read.getUint8();
|
|
final Float64List readDoubles = read.getFloat64List(2);
|
|
expect(readDoubles[0], equals(3.14));
|
|
expect(readDoubles[1], isNaN);
|
|
});
|
|
});
|
|
}
|