From a38f8b65ac4ea80b04012d4b0a7df209caa432d9 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Thu, 18 Jun 2015 14:35:11 -0700 Subject: [PATCH] StyledText is just a convenient way to specify a tree of InlineStyle and InlineText elements. StyledText builds an Inline that renders the tree. For example this StyledText object: new StyledText(["FOO", [boldLargerStyle, [greenStyle "BAR"], "BAZ"] BORF]); Renders the same way the following HTML would, assuming that TextStyles boldLargerStyle and greenStyle were defined.

FOO
BAR
BAZ
BORF

R=abarth@chromium.org Review URL: https://codereview.chromium.org/1194693002. --- .../tests/examples/styled_text-expected.txt | 100 ++++++++++++++++++ .../flutter/tests/examples/styled_text.dart | 18 ++++ 2 files changed, 118 insertions(+) create mode 100644 engine/src/flutter/tests/examples/styled_text-expected.txt create mode 100644 engine/src/flutter/tests/examples/styled_text.dart diff --git a/engine/src/flutter/tests/examples/styled_text-expected.txt b/engine/src/flutter/tests/examples/styled_text-expected.txt new file mode 100644 index 0000000000..41e9a2a335 --- /dev/null +++ b/engine/src/flutter/tests/examples/styled_text-expected.txt @@ -0,0 +1,100 @@ +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 RenderScaffold at Point(0.0, 0.0) +2 | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | paintChild RenderDecoratedBox at Point(0.0, 81.0) +2 | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | drawRRect(Instance of 'RRect', Paint(color:Color(0xfffafafa))) +2 | | | paintChild RenderFlex at Point(8.0, 0.0) +2 | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderParagraph at Point(0.0, 117.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 149.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 169.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 185.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 205.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 221.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 241.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 257.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 277.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 293.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 313.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 329.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 349.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderPadding at Point(0.0, 365.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderConstrainedBox at Point(64.0, 10.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0x18000000))) +2 | | | | | | drawPath(Instance of 'Path', Paint(color:Color(0xff000000))) +2 | | | | paintChild RenderParagraph at Point(0.0, 385.5) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | paintChild RenderDecoratedBox at Point(0.0, 0.0) +2 | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 81.0), Paint(color:Color(0xff2196f3), drawLooper:true)) +2 | | | paintChild RenderFlex at Point(8.0, 0.0) +2 | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | paintChild RenderConstrainedBox at Point(0.0, 25.0) +2 | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderPadding at Point(0.0, 16.0) +2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | | | paintChild RenderParagraph at Point(24.0, 0.0) +2 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0 +------------------------------------------------------------------------ +PAINTED 2 FRAMES diff --git a/engine/src/flutter/tests/examples/styled_text.dart b/engine/src/flutter/tests/examples/styled_text.dart new file mode 100644 index 0000000000..137ec0cd94 --- /dev/null +++ b/engine/src/flutter/tests/examples/styled_text.dart @@ -0,0 +1,18 @@ +// 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:async'; + +import 'package:sky/widgets/widget.dart'; + +import '../../examples/widgets/styled_text.dart'; +import '../resources/display_list.dart'; + +main() async { + TestRenderView testRenderView = new TestRenderView(); + StyledTextApp app = new StyledTextApp(); + runApp(app, renderViewOverride: testRenderView); + await testRenderView.checkFrame(); + testRenderView.endTest(); +}