forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script that runs engine unit tests and Dart tests of engine APIs (flu…
…tter#3372) The Dart tests were migrated from the flutter/test/engine suite in the framework repository
- Loading branch information
1 parent
7019432
commit d92d4c1
Showing
7 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.packages | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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)); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// 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); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: engine_tests | ||
dependencies: | ||
test: 0.12.15+4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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)); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// 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); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/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 |