From be5a2f8bc5bdcf14dac82ec6ae43a13e1f8fa2c1 Mon Sep 17 00:00:00 2001 From: Hixie Date: Fri, 12 Jun 2015 13:25:35 -0700 Subject: [PATCH] Fixes tests, logic, and analyzer warnings due to recent checkins. - Fix the expectations file for stocks, since floating action button changed how it was being drawn. - Fix edges theme data to not use a rounded rect path for canvas material. - Add debugging hooks for TextStyle, and fix a warning. TBR=eseidel Review URL: https://codereview.chromium.org/1187483003. --- sdk/lib/framework/rendering/paragraph.dart | 17 ++++++++++++++++- sdk/lib/framework/theme2/edges.dart | 2 +- tests/framework/stocks-expected.txt | 6 +++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/sdk/lib/framework/rendering/paragraph.dart b/sdk/lib/framework/rendering/paragraph.dart index c4b9a88727e..16caee3a9d9 100644 --- a/sdk/lib/framework/rendering/paragraph.dart +++ b/sdk/lib/framework/rendering/paragraph.dart @@ -67,6 +67,21 @@ class TextStyle { value = 37 * value + textAlign.hashCode; return value; } + + String toString([String prefix = '']) { + List result = []; + if (color != null) + result.add('${prefix}color: $color'); + if (fontSize != null) + result.add('${prefix}fontSize: $fontSize'); + if (fontWeight != null) + result.add('${prefix}fontWeight: fontWeight'); + if (textAlign != null) + result.add('${prefix}textAlign: textAlign'); + if (result.isEmpty) + return '${prefix}'; + return result.join('\n'); + } } // Unfortunately, using full precision floating point here causes bad layouts @@ -196,5 +211,5 @@ class RenderParagraph extends RenderBox { // we should probably expose a way to do precise (inter-glpyh) hit testing - String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}color: ${color}\n${prefix}text: ${text}\n'; + String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}style:\n${style.toString("$prefix ")}\n${prefix}text: ${text}\n'; } diff --git a/sdk/lib/framework/theme2/edges.dart b/sdk/lib/framework/theme2/edges.dart index d60f5e7e11a..4da5d9b44e6 100644 --- a/sdk/lib/framework/theme2/edges.dart +++ b/sdk/lib/framework/theme2/edges.dart @@ -5,7 +5,7 @@ enum MaterialEdge { canvas, card, circle } const Map edges = const { - MaterialEdge.canvas: 0.0, + MaterialEdge.canvas: null, MaterialEdge.card: 2.0, MaterialEdge.circle: null, }; diff --git a/tests/framework/stocks-expected.txt b/tests/framework/stocks-expected.txt index 82b6fb8f273..f2682dc69ba 100644 --- a/tests/framework/stocks-expected.txt +++ b/tests/framework/stocks-expected.txt @@ -11,11 +11,11 @@ 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 RenderSizeObserver at Point(0.0, 81.0) +2 | | | paintChild RenderDecoratedBox at Point(0.0, 81.0) 2 | | | | TestDisplayList() constructor: 800.0 x 600.0 +2 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 519.0), Paint(Color(0xfffafafa))) 2 | | | | save 2 | | | | clipRect(Rect.fromLTRB(0.0, 0.0, 800.0, 519.0)) -2 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 519.0), Paint(Color(0xffffffff))) 2 | | | | save 2 | | | | concat([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]) 2 | | | | restore @@ -43,7 +43,7 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0 2 | | | | | | | paintChild RenderImage at Point(8.0, 8.0) 2 | | | | | | | | TestDisplayList() constructor: 800.0 x 600.0 -2 | | | paintChild RenderCustomPaint at Point(728.0, 528.0) +2 | | | paintChild RenderDecoratedBox at Point(728.0, 528.0) 2 | | | | TestDisplayList() constructor: 800.0 x 600.0 2 | | | | drawCircle(28.0, 28.0, 28.0, Paint(Color(0xfff44336))) 2 | | | | saveLayer(Rect.fromLTRB(0.0, 0.0, 56.0, 56.0), Paint(Color(0xff000000)))