Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: sky/tests/raw/color_bounds.dart

Issue 1179413008: If Color constructor is passed a value > 0xFFFFFFFF, Sky crashes (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Now with tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/painting/Color.dart ('k') | sky/tests/raw/color_bounds-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tests/raw/color_bounds.dart
diff --git a/sky/tests/raw/color_bounds.dart b/sky/tests/raw/color_bounds.dart
new file mode 100644
index 0000000000000000000000000000000000000000..aa63d2b6c3fe198b846d2a08d9c7ed5a692b5922
--- /dev/null
+++ b/sky/tests/raw/color_bounds.dart
@@ -0,0 +1,35 @@
+import 'dart:sky' as sky;
+
+import '../resources/third_party/unittest/unittest.dart';
+import '../resources/unit.dart';
+
+void main() {
+ initUnit();
+
+ test("paint set to black", () {
+ sky.Color c = new sky.Color(0x00000000);
+ sky.Paint p = new sky.Paint();
+ p.color = c;
+ expect(c.toString(), equals('Color(0x00000000)'));
+ });
+
+ test("color created with out of bounds value", () {
+ try {
+ sky.Color c = new sky.Color(0x100 << 24);
+ sky.Paint p = new sky.Paint();
+ p.color = c;
+ } catch (e) {
+ expect(e != null, equals(true));
+ }
+ });
+
+ test("color created with wildly out of bounds value", () {
+ try {
+ sky.Color c = new sky.Color(1 << 1000000);
+ sky.Paint p = new sky.Paint();
+ p.color = c;
+ } catch (e) {
+ expect(e != null, equals(true));
+ }
+ });
+}
« no previous file with comments | « sky/engine/core/painting/Color.dart ('k') | sky/tests/raw/color_bounds-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698