提交 d92d4c1b 编写于 作者: J Jason Simmons 提交者: GitHub

Script that runs engine unit tests and Dart tests of engine APIs (#3372)

The Dart tests were migrated from the flutter/test/engine suite in the
framework repository
上级 70194328
.packages
pubspec.lock
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:test/test.dart';
void main() {
test("color accessors should work", () {
Color foo = const Color(0x12345678);
expect(foo.alpha, equals(0x12));
expect(foo.red, equals(0x34));
expect(foo.green, equals(0x56));
expect(foo.blue, equals(0x78));
});
test("paint set to black", () {
Color c = const Color(0x00000000);
Paint p = new Paint();
p.color = c;
expect(c.toString(), equals('Color(0x00000000)'));
});
test("color created with out of bounds value", () {
try {
Color c = const Color(0x100 << 24);
Paint p = new Paint();
p.color = c;
} catch (e) {
expect(e != null, equals(true));
}
});
test("color created with wildly out of bounds value", () {
try {
Color c = const Color(1 << 1000000);
Paint p = new Paint();
p.color = c;
} catch (e) {
expect(e != null, equals(true));
}
});
}
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:test/test.dart';
void main() {
test("Should be able to build and layout a paragraph", () {
ParagraphBuilder builder = new ParagraphBuilder(new ParagraphStyle());
builder.addText('Hello');
Paragraph paragraph = builder.build();
expect(paragraph, isNotNull);
paragraph.layout(new ParagraphConstraints(width: 800.0));
expect(paragraph.width, isNonZero);
expect(paragraph.height, isNonZero);
});
}
name: engine_tests
dependencies:
test: 0.12.15+4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:ui';
import 'package:test/test.dart';
void main() {
test("rect accessors", () {
Rect r = new Rect.fromLTRB(1.0, 3.0, 5.0, 7.0);
expect(r.left, equals(1.0));
expect(r.top, equals(3.0));
expect(r.right, equals(5.0));
expect(r.bottom, equals(7.0));
});
test("rect created by width and height", () {
Rect r = new Rect.fromLTWH(1.0, 3.0, 5.0, 7.0);
expect(r.left, equals(1.0));
expect(r.top, equals(3.0));
expect(r.right, equals(6.0));
expect(r.bottom, equals(10.0));
});
test("rect intersection", () {
Rect r1 = new Rect.fromLTRB(0.0, 0.0, 100.0, 100.0);
Rect r2 = new Rect.fromLTRB(50.0, 50.0, 200.0, 200.0);
Rect r3 = r1.intersect(r2);
expect(r3.left, equals(50.0));
expect(r3.top, equals(50.0));
expect(r3.right, equals(100.0));
expect(r3.bottom, equals(100.0));
Rect r4 = r2.intersect(r1);
expect(r4, equals(r3));
});
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
void main() {
test('test smoke test -- this test SHOULD FAIL', () {
expect(false, isTrue);
});
}
#!/bin/bash
set -ex
out/host_debug_unopt/ftl_unittests
out/host_debug_unopt/synchronization_unittests
out/host_debug_unopt/wtf_unittests
pushd flutter/testing/dart
pub get
popd
# Verify that a failing test returns a failure code.
! out/host_debug_unopt/sky_shell --disable-observatory --disable-diagnostic --non-interactive --enable-checked-mode --packages=flutter/testing/dart/.packages flutter/testing/fail_test.dart
for TEST_SCRIPT in flutter/testing/dart/*.dart; do
out/host_debug_unopt/sky_shell --disable-observatory --disable-diagnostic --non-interactive --enable-checked-mode $TEST_SCRIPT
done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册