This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -3026,11 +3026,14 @@ abstract class ParagraphBuilder {
3026
3026
///
3027
3027
/// Do not rely on this getter as it exists for migration purposes only and
3028
3028
/// will soon be removed.
3029
+ @Deprecated ('''
3030
+ The shouldDisableRoundingHack flag is for internal migration purposes only and should not be used.
3031
+ ''' )
3029
3032
static bool get shouldDisableRoundingHack {
3030
- return const bool .hasEnvironment ('SKPARAGRAPH_REMOVE_ROUNDING_HACK' )
3033
+ return const bool .fromEnvironment ('SKPARAGRAPH_REMOVE_ROUNDING_HACK' , defaultValue : true )
3031
3034
|| _roundingHackDisabledInDebugMode;
3032
3035
}
3033
- static bool _roundingHackDisabledInDebugMode = false ;
3036
+ static bool _roundingHackDisabledInDebugMode = true ;
3034
3037
3035
3038
/// Only works in debug mode. Do not call this method as it is for migration
3036
3039
/// purposes only and will soon be removed.
Original file line number Diff line number Diff line change @@ -156,16 +156,16 @@ void testMain() {
156
156
ui.ParagraphBuilder .setDisableRoundingHack (roundingHackWasDisabled);
157
157
});
158
158
159
- test ('rounding hack applied by default' , () {
159
+ test ('rounding hack disabled by default' , () {
160
160
const double fontSize = 1.25 ;
161
161
const String text = '12345' ;
162
162
assert ((fontSize * text.length).truncate () != fontSize * text.length);
163
- expect (ui.ParagraphBuilder .shouldDisableRoundingHack, isFalse );
163
+ expect (ui.ParagraphBuilder .shouldDisableRoundingHack, isTrue );
164
164
final ui.ParagraphBuilder builder = ui.ParagraphBuilder (ui.ParagraphStyle (fontSize: fontSize, fontFamily: 'FlutterTest' ));
165
165
builder.addText (text);
166
166
final ui.Paragraph paragraph = builder.build ()
167
167
..layout (const ui.ParagraphConstraints (width: text.length * fontSize));
168
- expect (paragraph.computeLineMetrics ().length, greaterThan ( 1 ) );
168
+ expect (paragraph.computeLineMetrics ().length, 1 );
169
169
});
170
170
171
171
// TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520
Original file line number Diff line number Diff line change @@ -263,15 +263,15 @@ void main() {
263
263
ParagraphBuilder .setDisableRoundingHack (roundingHackWasDisabled);
264
264
});
265
265
266
- test ('rounding hack applied by default' , () {
266
+ test ('rounding hack disabled by default' , () {
267
267
const double fontSize = 1.25 ;
268
268
const String text = '12345' ;
269
269
assert ((fontSize * text.length).truncate () != fontSize * text.length);
270
- expect (ParagraphBuilder .shouldDisableRoundingHack, isFalse );
270
+ expect (ParagraphBuilder .shouldDisableRoundingHack, isTrue );
271
271
final ParagraphBuilder builder = ParagraphBuilder (ParagraphStyle (fontSize: fontSize));
272
272
builder.addText (text);
273
273
final Paragraph paragraph = builder.build ()
274
274
..layout (const ParagraphConstraints (width: text.length * fontSize));
275
- expect (paragraph.computeLineMetrics ().length, greaterThan ( 1 ) );
275
+ expect (paragraph.computeLineMetrics ().length, 1 );
276
276
});
277
277
}
You can’t perform that action at this time.
0 commit comments