Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dynamic_layouts] relax layout test to fix tree #4677

Merged
merged 6 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f4c25bbb351cc59ffdefe980c0c993196a8a6d47
685141bf3b5ff4a90589fd77784776e011dd5fcc
15 changes: 11 additions & 4 deletions packages/dynamic_layouts/example/test/wrap_example_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
void withinTolerance(Offset actual, Offset expected, double tolerance) {
expect(actual.dx, (double actual) => actual <= expected.dx + tolerance);
expect(actual.dx, (double actual) => actual >= expected.dx - tolerance);
expect(actual.dy, (double actual) => actual <= expected.dy + tolerance);
expect(actual.dy, (double actual) => actual >= expected.dy - tolerance);
}

testWidgets('Check that the children are layed out.',
(WidgetTester tester) async {
const MaterialApp app = MaterialApp(
Expand Down Expand Up @@ -39,10 +46,10 @@ void main() {
: const Offset(381.0, 224.0);

// See if they are in expected position.
expect(tester.getTopLeft(find.text('Index 0')), offset0);
expect(tester.getTopLeft(find.text('Index 1')), offset1);
expect(tester.getTopLeft(find.text('Index 3')), offset3);
expect(tester.getTopLeft(find.text('Index 4')), offset4);
withinTolerance(tester.getTopLeft(find.text('Index 0')), offset0, 0.125);
withinTolerance(tester.getTopLeft(find.text('Index 1')), offset1, 0.125);
withinTolerance(tester.getTopLeft(find.text('Index 3')), offset3, 0.125);
withinTolerance(tester.getTopLeft(find.text('Index 4')), offset4, 0.125);
});
}

Expand Down