Add a matcher for Matrix4 that includes epsilon (#107326)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
// flutter_ignore_for_file: golden_tag (see analyze.dart)
|
||||
|
||||
import 'dart:math' as math;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/rendering.dart';
|
||||
@@ -197,6 +198,38 @@ void main() {
|
||||
expect(-11.0, moreOrLessEquals(11.0, epsilon: 100.0));
|
||||
});
|
||||
|
||||
test('matrixMoreOrLessEquals', () {
|
||||
expect(
|
||||
Matrix4.rotationZ(math.pi),
|
||||
matrixMoreOrLessEquals(Matrix4.fromList(<double>[
|
||||
-1, 0, 0, 0,
|
||||
0, -1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1,
|
||||
]))
|
||||
);
|
||||
|
||||
expect(
|
||||
Matrix4.rotationZ(math.pi),
|
||||
matrixMoreOrLessEquals(Matrix4.fromList(<double>[
|
||||
-2, 0, 0, 0,
|
||||
0, -2, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1,
|
||||
]), epsilon: 2)
|
||||
);
|
||||
|
||||
expect(
|
||||
Matrix4.rotationZ(math.pi),
|
||||
isNot(matrixMoreOrLessEquals(Matrix4.fromList(<double>[
|
||||
-2, 0, 0, 0,
|
||||
0, -2, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1,
|
||||
])))
|
||||
);
|
||||
});
|
||||
|
||||
test('rectMoreOrLessEquals', () {
|
||||
expect(
|
||||
const Rect.fromLTRB(0.0, 0.0, 10.0, 10.0),
|
||||
|
||||
Reference in New Issue
Block a user