From 3fa08165767dfaf9458cb48d15f09a6b47c5039c Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 16 Jun 2015 17:02:58 -0700 Subject: [PATCH] Add some basic tests for the material buttons Specifically, RaisedButton, FlatButton, and FloatingActionButton. These just test that these classes work in their default configurations. R=ianh@google.com, jackson@chromium.org Review URL: https://codereview.chromium.org/1193453005. --- .../tests/widgets/buttons-expected.txt | 50 +++++++++++++++++++ engine/src/flutter/tests/widgets/buttons.dart | 28 +++++++++++ 2 files changed, 78 insertions(+) create mode 100644 engine/src/flutter/tests/widgets/buttons-expected.txt create mode 100644 engine/src/flutter/tests/widgets/buttons.dart diff --git a/engine/src/flutter/tests/widgets/buttons-expected.txt b/engine/src/flutter/tests/widgets/buttons-expected.txt new file mode 100644 index 0000000000..1ae64e7914 --- /dev/null +++ b/engine/src/flutter/tests/widgets/buttons-expected.txt @@ -0,0 +1,50 @@ +CONSOLE: TestRenderView enabled +CONSOLE: +PAINT FOR FRAME #1 ---------------------------------------------- +1 | TestDisplayList() constructor: 800.0 x 600.0 +------------------------------------------------------------------------ +CONSOLE: +PAINT FOR FRAME #2 ---------------------------------------------- +2 | TestDisplayList() constructor: 800.0 x 600.0 +2 | paintChild RenderPositionedBox at Point(0.0, 0.0) +2 | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | paintChild RenderPadding at Point(348.0, 274.0) +2 | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | paintChild RenderConstrainedBox at Point(8.0, 8.0) +2 | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0))) +2 | | | | paintChild RenderPositionedBox at Point(8.0, 0.0) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderParagraph at Point(6.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +------------------------------------------------------------------------ +CONSOLE: +PAINT FOR FRAME #3 ---------------------------------------------- +3 | TestDisplayList() constructor: 800.0 x 600.0 +3 | paintChild RenderPositionedBox at Point(0.0, 0.0) +3 | | TestDisplayList() constructor: 800.0 x 600.0 +3 | | paintChild RenderPadding at Point(348.0, 274.0) +3 | | | TestDisplayList() constructor: 800.0 x 600.0 +3 | | | paintChild RenderConstrainedBox at Point(8.0, 8.0) +3 | | | | TestDisplayList() constructor: 800.0 x 600.0 +3 | | | | drawRRect(Instance of 'RRect', Paint(Color(0xfffafafa))) +3 | | | | paintChild RenderPositionedBox at Point(8.0, 0.0) +3 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +3 | | | | | paintChild RenderParagraph at Point(6.0, 10.0) +3 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +------------------------------------------------------------------------ +CONSOLE: +PAINT FOR FRAME #4 ---------------------------------------------- +4 | TestDisplayList() constructor: 800.0 x 600.0 +4 | paintChild RenderPositionedBox at Point(0.0, 0.0) +4 | | TestDisplayList() constructor: 800.0 x 600.0 +4 | | paintChild RenderDecoratedBox at Point(372.0, 272.0) +4 | | | TestDisplayList() constructor: 800.0 x 600.0 +4 | | | drawCircle(28.0, 28.0, 28.0, Paint(Color(0xfff44336))) +4 | | | saveLayer(Rect.fromLTRB(0.0, 0.0, 56.0, 56.0), Paint(Color(0xff000000))) +4 | | | clipPath(Instance of 'Path') +4 | | | paintChild RenderParagraph at Point(22.0, 20.0) +4 | | | | TestDisplayList() constructor: 800.0 x 600.0 +4 | | | restore +------------------------------------------------------------------------ +PAINTED 4 FRAMES diff --git a/engine/src/flutter/tests/widgets/buttons.dart b/engine/src/flutter/tests/widgets/buttons.dart new file mode 100644 index 0000000000..0b5de6e71b --- /dev/null +++ b/engine/src/flutter/tests/widgets/buttons.dart @@ -0,0 +1,28 @@ +// 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 'package:sky/widgets/basic.dart'; +import 'package:sky/widgets/flat_button.dart'; +import 'package:sky/widgets/floating_action_button.dart'; +import 'package:sky/widgets/raised_button.dart'; + +import '../resources/display_list.dart'; + +main() async { + WidgetTester tester = new WidgetTester(); + + await tester.test(() { + return new Center(child: new RaisedButton(child: new Text("ENGAGE"))); + }); + + await tester.test(() { + return new Center(child: new FlatButton(child: new Text("ENGAGE"))); + }); + + await tester.test(() { + return new Center(child: new FloatingActionButton(child: new Text("+"))); + }); + + await tester.endTest(); +}