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
29618f0b
Unverified
Commit
29618f0b
authored
Feb 15, 2019
by
Gary Qian
Committed by
GitHub
Feb 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Roll engine for flutter/engine#7791 - Add trailing whitespace tracking.
parent
70dfe01a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
2 deletions
+91
-2
engine.version
bin/internal/engine.version
+1
-1
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+89
-0
text_painter_test.dart
packages/flutter/test/painting/text_painter_test.dart
+1
-1
No files found.
bin/internal/engine.version
View file @
29618f0b
3757390fa4b00d2d261bfdf5182d2e87c9113ff9
033f2072c315d48b4d7680d4cbbe856012b1259b
packages/flutter/test/material/text_field_test.dart
View file @
29618f0b
...
...
@@ -4620,4 +4620,93 @@ void main() {
'selection disabled'
]);
});
testWidgets
(
'Caret center position'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
overlay
(
child:
Container
(
width:
300.0
,
child:
const
TextField
(
textAlign:
TextAlign
.
center
,
decoration:
null
,
),
),
),
);
final
RenderEditable
editable
=
findRenderEditable
(
tester
);
await
tester
.
enterText
(
find
.
byType
(
TextField
),
'abcd'
);
await
tester
.
pump
();
Offset
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
4
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
431
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
3
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
415
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
2
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
399
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
1
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
383
));
});
testWidgets
(
'Caret indexes into trailing whitespace center align'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
overlay
(
child:
Container
(
width:
300.0
,
child:
const
TextField
(
textAlign:
TextAlign
.
center
,
decoration:
null
,
),
),
),
);
final
RenderEditable
editable
=
findRenderEditable
(
tester
);
await
tester
.
enterText
(
find
.
byType
(
TextField
),
'abcd '
);
await
tester
.
pump
();
Offset
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
7
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
479
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
8
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
495
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
4
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
431
));
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
3
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
415
));
// Should be same as equivalent in 'Caret center position'
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
2
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
399
));
// Should be same as equivalent in 'Caret center position'
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
1
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
383
));
// Should be same as equivalent in 'Caret center position'
});
}
packages/flutter/test/painting/text_painter_test.dart
View file @
29618f0b
...
...
@@ -133,7 +133,7 @@ void main() {
Offset
caretOffset
=
painter
.
getOffsetForCaret
(
const
ui
.
TextPosition
(
offset:
0
),
ui
.
Rect
.
zero
);
expect
(
caretOffset
.
dx
,
21
);
caretOffset
=
painter
.
getOffsetForCaret
(
const
ui
.
TextPosition
(
offset:
text
.
length
),
ui
.
Rect
.
zero
);
expect
(
caretOffset
.
dx
,
399
);
expect
(
caretOffset
.
dx
,
441
);
caretOffset
=
painter
.
getOffsetForCaret
(
const
ui
.
TextPosition
(
offset:
1
),
ui
.
Rect
.
zero
);
expect
(
caretOffset
.
dx
,
35
);
...
...
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