-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] Add style's text localization tests. #14430
base: fabian-localize-14393
Are you sure you want to change the base?
[ios, macos] Add style's text localization tests. #14430
Conversation
358a9a8 to
d0776df
Compare
d0776df to
a68aa78
Compare
|
|
||
| [MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; | ||
| NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; | ||
| NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"basic-style" withExtension:@"json"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike one-liner.json, basic-style.json seems to have network dependencies. We’d need to mock those dependencies to ensure stable tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possibility - we could (for the time being) convert this to an integration test, which do hit the network...
| MGLAttributedExpression *attributedExpression = [MGLAttributedExpression attributedExpression:coalesceExpression attributes:@{}]; | ||
| NSExpression *localizedExpression = [NSExpression mgl_expressionForAttributedExpressions:@[ [NSExpression expressionForConstantValue:attributedExpression] ]]; | ||
| XCTAssertEqualObjects(countryLabel.text, localizedExpression); | ||
| countryLabel.text = [NSExpression expressionWithFormat:@"mgl_coalesce({%K, %K})", @"name_en", @"name"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s more important to test that -[NSExpression mgl_expressionLocalizedIntoLocale:] returns the right value than to test the full integration with -[MGLStyle localizeLabelsIntoLocale:], especially considering the difficulty of removing network dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for walking me through it!
|
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
|
@fabian-guerra is this closed? |
|
Is not @julianrex |
|
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Adds localization tests to the style.