Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
368c12b5
Unverified
Commit
368c12b5
authored
Dec 04, 2020
by
houyushan
Committed by
GitHub
Dec 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add RichText debugFillProperties TestCase (#70819)
parent
afb6b955
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+3
-0
rich_text_test.dart
packages/flutter/test/widgets/rich_text_test.dart
+38
-0
No files found.
packages/flutter/lib/src/widgets/basic.dart
View file @
368c12b5
...
...
@@ -5577,6 +5577,9 @@ class RichText extends MultiChildRenderObjectWidget {
properties
.
add
(
IntProperty
(
'maxLines'
,
maxLines
,
ifNull:
'unlimited'
));
properties
.
add
(
EnumProperty
<
TextWidthBasis
>(
'textWidthBasis'
,
textWidthBasis
,
defaultValue:
TextWidthBasis
.
parent
));
properties
.
add
(
StringProperty
(
'text'
,
text
.
toPlainText
()));
properties
.
add
(
DiagnosticsProperty
<
Locale
>(
'locale'
,
locale
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
StrutStyle
>(
'strutStyle'
,
strutStyle
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
TextHeightBehavior
>(
'textHeightBehavior'
,
textHeightBehavior
,
defaultValue:
null
));
}
}
...
...
packages/flutter/test/widgets/rich_text_test.dart
View file @
368c12b5
...
...
@@ -80,4 +80,42 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byType
(
IntrinsicHeight
)).
height
,
3
*
16
);
});
testWidgets
(
'RichText implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
RichText
(
text:
const
TextSpan
(
text:
'rich text'
),
textAlign:
TextAlign
.
center
,
textDirection:
TextDirection
.
rtl
,
softWrap:
false
,
overflow:
TextOverflow
.
ellipsis
,
textScaleFactor:
1.3
,
maxLines:
1
,
locale:
const
Locale
(
'zh'
,
'HK'
),
strutStyle:
const
StrutStyle
(
fontSize:
16
,
),
textWidthBasis:
TextWidthBasis
.
longestLine
,
textHeightBehavior:
const
TextHeightBehavior
(
applyHeightToFirstAscent:
false
),
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
expect
(
description
,
<
String
>[
'textAlign: center'
,
'textDirection: rtl'
,
'softWrap: no wrapping except at line break characters'
,
'overflow: ellipsis'
,
'textScaleFactor: 1.3'
,
'maxLines: 1'
,
'textWidthBasis: longestLine'
,
'text: "rich text"'
,
'locale: zh_HK'
,
'strutStyle: StrutStyle(size: 16.0)'
,
'textHeightBehavior: TextHeightBehavior(applyHeightToFirstAscent: false, applyHeightToLastDescent: true)'
]);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment