Skip to content

Improve assertion message in AlignmentDirectional.resolve #172096

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

Merged
Prev Previous commit
Next Next commit
test: Verify assertion for null TextDirection in `_MixedAlignment.res…
…olve`

Adds a test case that uses `add()` method to ensure that calling `_MixedAlignment.resolve` with a null `TextDirection` throws a `FlutterError`
with the expected improved message.
  • Loading branch information
SalehTZ committed Jul 14, 2025
commit 505c1e5bcd1fa38aecf4fff8ee3d2396c105e7ed
16 changes: 16 additions & 0 deletions packages/flutter/test/painting/alignment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,22 @@ void main() {
),
);
});

test('AlignmentDirectional.resolve with null TextDirection asserts', () {
const Alignment a = Alignment(5.0, 6.0);
const AlignmentDirectional b = AlignmentDirectional(15.0, 16.0);

expect(
() => a.add(b).resolve(null),
throwsA(
isFlutterError.having(
(FlutterError e) => e.message,
'message',
allOf(contains('No TextDirection found.'), contains('without a Directionality ancestor')),
),
),
);
});
}

double nonconst(double value) => value;
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy