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
382704ca
Unverified
Commit
382704ca
authored
May 10, 2019
by
Dan Field
Committed by
GitHub
May 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use precisionErrorTolerance (#32499)
parent
38f408f0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
13 deletions
+14
-13
motion_event_diff.dart
...ntegration_tests/android_views/lib/motion_event_diff.dart
+2
-1
vitool_test.dart
dev/tools/vitool/test/vitool_test.dart
+2
-1
lsq_solver.dart
packages/flutter/lib/src/gestures/lsq_solver.dart
+4
-2
table.dart
packages/flutter/lib/src/rendering/table.dart
+1
-1
dialog_test.dart
packages/flutter/test/cupertino/dialog_test.dart
+2
-5
nav_bar_transition_test.dart
packages/flutter/test/cupertino/nav_bar_transition_test.dart
+1
-1
scroll_simulation_test.dart
packages/flutter/test/widgets/scroll_simulation_test.dart
+2
-2
No files found.
dev/integration_tests/android_views/lib/motion_event_diff.dart
View file @
382704ca
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import
'package:collection/collection.dart'
;
import
'package:flutter/foundation.dart'
;
// Android MotionEvent actions for which a pointer index is encoded in the
// unmasked action code.
...
...
@@ -13,7 +14,7 @@ const List<int> kPointerActions = <int>[
6
,
// POINTER_UP
];
const
double
kDoubleErrorMargin
=
0.0001
;
const
double
kDoubleErrorMargin
=
precisionErrorTolerance
;
String
diffMotionEvents
(
Map
<
String
,
dynamic
>
originalEvent
,
...
...
dev/tools/vitool/test/vitool_test.dart
View file @
382704ca
...
...
@@ -5,6 +5,7 @@
import
'dart:math'
;
import
'package:collection/collection.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:vitool/vitool.dart'
;
import
'package:path/path.dart'
as
path
;
...
...
@@ -146,7 +147,7 @@ void main() {
SvgPathCommand
(
'M'
,
<
Point
<
double
>>[
Point
<
double
>(
19.0
,
0.0
)]),
SvgPathCommand
(
'Z'
,
<
Point
<
double
>>[]),
]),
margin:
0.000000001
margin:
precisionErrorTolerance
,
)
]);
});
...
...
packages/flutter/lib/src/gestures/lsq_solver.dart
View file @
382704ca
...
...
@@ -5,6 +5,8 @@
import
'dart:math'
as
math
;
import
'dart:typed_data'
;
import
'package:flutter/foundation.dart'
;
// TODO(abarth): Consider using vector_math.
class
_Vector
{
_Vector
(
int
size
)
...
...
@@ -128,7 +130,7 @@ class LeastSquaresSolver {
}
final
double
norm
=
q
.
getRow
(
j
).
norm
();
if
(
norm
<
0.000001
)
{
if
(
norm
<
precisionErrorTolerance
)
{
// Vectors are linearly dependent or zero so no solution.
return
null
;
}
...
...
@@ -176,7 +178,7 @@ class LeastSquaresSolver {
sumSquaredTotal
+=
w
[
h
]
*
w
[
h
]
*
v
*
v
;
}
result
.
confidence
=
sumSquaredTotal
<=
0.000001
?
1.0
:
result
.
confidence
=
sumSquaredTotal
<=
precisionErrorTolerance
?
1.0
:
1.0
-
(
sumSquaredError
/
sumSquaredTotal
);
return
result
;
...
...
packages/flutter/lib/src/rendering/table.dart
View file @
382704ca
...
...
@@ -918,7 +918,7 @@ class RenderTable extends RenderBox {
int
availableColumns
=
columns
;
// Handle double precision errors which causes this loop to become
// stuck in certain configurations.
const
double
minimumDeficit
=
0.00000001
;
const
double
minimumDeficit
=
precisionErrorTolerance
;
while
(
deficit
>
minimumDeficit
&&
totalFlex
>
minimumDeficit
)
{
double
newTotalFlex
=
0.0
;
for
(
int
x
=
0
;
x
<
columns
;
x
+=
1
)
{
...
...
packages/flutter/test/cupertino/dialog_test.dart
View file @
382704ca
...
...
@@ -654,13 +654,10 @@ void main() {
expect
(
option1ButtonBox
.
size
.
width
,
actionsSectionBox
.
size
.
width
);
// Expected Height = button 1 + divider + 1/2 button 2 = 67.83333333333334
// Technically the following number is off by 0.00000000000003 but I think it's a
// Dart precision issue. I ran the subtraction directly in dartpad and still
// got 67.83333333333337.
const
double
expectedHeight
=
67.83333333333337
;
const
double
expectedHeight
=
67.83333333333334
;
expect
(
actionsSectionBox
.
size
.
height
,
expectedHeight
,
moreOrLessEquals
(
expectedHeight
)
,
);
});
...
...
packages/flutter/test/cupertino/nav_bar_transition_test.dart
View file @
382704ca
...
...
@@ -119,7 +119,7 @@ void checkOpacity(WidgetTester tester, Finder finder, double opacity) {
matching:
find
.
byType
(
FadeTransition
),
),
).
opacity
.
value
,
moreOrLessEquals
(
opacity
,
epsilon:
0.000000001
),
moreOrLessEquals
(
opacity
),
);
}
...
...
packages/flutter/test/widgets/scroll_simulation_test.dart
View file @
382704ca
...
...
@@ -9,8 +9,8 @@ void main() {
test
(
'ClampingScrollSimulation has a stable initial conditions'
,
()
{
void
checkInitialConditions
(
double
position
,
double
velocity
)
{
final
ClampingScrollSimulation
simulation
=
ClampingScrollSimulation
(
position:
position
,
velocity:
velocity
);
expect
(
simulation
.
x
(
0.0
),
closeTo
(
position
,
0.00001
));
expect
(
simulation
.
dx
(
0.0
),
closeTo
(
velocity
,
0.00001
));
expect
(
simulation
.
x
(
0.0
),
moreOrLessEquals
(
position
));
expect
(
simulation
.
dx
(
0.0
),
moreOrLessEquals
(
velocity
));
}
checkInitialConditions
(
51.0
,
2866.91537
);
...
...
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