Skip to content

Commit

Permalink
[Banner] Use Arabic for RTL snapshot test (#8010)
Browse files Browse the repository at this point in the history
Related to #7993. We need to use real RTL script to avoid Bi-Di issue in TextView.
  • Loading branch information
wenyuzhang666 committed Jul 23, 2019
1 parent 696ee3c commit 9f09ea0
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions components/Banner/tests/snapshot/MDCBannerSnapshotTests.m
Expand Up @@ -24,6 +24,13 @@
static NSString *const kBannerLongText =
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt.";

// Arabic text constants for testing Banner in RTL mode.
static NSString *const kBannerShortTextArabic = @"ما تنفّس.";
static NSString *const kBannerMiddleLengthTextArabic =
@"دول السيطرة استطاعوا ٣٠. مليون وفرنسا أوراقهم انه تم.";
static NSString *const kBannerLongTextArabic =
@"دول السيطرة استطاعوا ٣٠. مليون وفرنسا أوراقهم انه تم, نفس قد والديون العالمية. دون ما تنفّس.";

// Content Padding is used for testing banner with specific layout margins.
static const CGFloat kBannerContentPadding = 10.0f;
static const CGFloat kBannerLargeContentPadding = 30.0f;
Expand Down Expand Up @@ -166,9 +173,9 @@ - (void)testShortTextWithSingleActionLTR {
[self generateSnapshotAndVerifyForView:self.bannerView];
}

- (void)testShortTextWithSingleActionRTL {
- (void)testShortTextWithSingleActionRTLInArabic {
// When
self.bannerView.textLabel.text = kBannerShortText;
self.bannerView.textLabel.text = kBannerShortTextArabic;
MDCButton *button = self.bannerView.leadingButton;
[button setTitle:@"Action" forState:UIControlStateNormal];
[button setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
Expand All @@ -195,9 +202,9 @@ - (void)testLongTextWithSingleActionLTR {
[self generateSnapshotAndVerifyForView:self.bannerView];
}

- (void)testLongTextWithSingleActionRTL {
- (void)testLongTextWithSingleActionRTLInArabic {
// When
self.bannerView.textLabel.text = kBannerLongText;
self.bannerView.textLabel.text = kBannerLongTextArabic;
MDCButton *button = self.bannerView.leadingButton;
[button setTitle:@"Action" forState:UIControlStateNormal];
[button setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
Expand Down Expand Up @@ -227,9 +234,9 @@ - (void)testLongTextWithTwoActionsLTR {
[self generateSnapshotAndVerifyForView:self.bannerView];
}

- (void)testLongTextWithTwoActionsRTL {
- (void)testLongTextWithTwoActionsRTLInArabic {
// When
self.bannerView.textLabel.text = kBannerLongText;
self.bannerView.textLabel.text = kBannerLongTextArabic;
MDCButton *button1 = self.bannerView.leadingButton;
[button1 setTitle:@"Action1" forState:UIControlStateNormal];
[button1 setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
Expand Down Expand Up @@ -317,9 +324,9 @@ - (void)testSingleRowStyleLongTextWithSingleActionLTR {
[self generateSnapshotAndVerifyForView:self.bannerView];
}

- (void)testSingleRowStyleLongTextWithSingleActionRTL {
- (void)testSingleRowStyleLongTextWithSingleActionRTLInArabic {
// When
self.bannerView.textLabel.text = kBannerLongText;
self.bannerView.textLabel.text = kBannerLongTextArabic;
MDCButton *button1 = self.bannerView.leadingButton;
[button1 setTitle:@"Action1" forState:UIControlStateNormal];
[button1 setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
Expand Down Expand Up @@ -350,9 +357,9 @@ - (void)testLongTextWithTwoActionsAndIconLTR {
[self generateSnapshotAndVerifyForView:self.bannerView];
}

- (void)testLongTextWithTwoActionsAndIconRTL {
- (void)testLongTextWithTwoActionsAndIconRTLInArabic {
// When
self.bannerView.textLabel.text = kBannerLongText;
self.bannerView.textLabel.text = kBannerLongTextArabic;
MDCButton *button1 = self.bannerView.leadingButton;
[button1 setTitle:@"Action1" forState:UIControlStateNormal];
[button1 setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 9f09ea0

Please sign in to comment.