Skip to content

Commit

Permalink
[*] Suppress deprecation warnings. (#8481)
Browse files Browse the repository at this point in the history
Suppresses deprecation warnings either for implementations of our own
deprecated APIs or for their use in tests and elsewhere.

Part of #7537
  • Loading branch information
Robert Moore committed Sep 23, 2019
1 parent 0f7758d commit 8cebc56
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 0 deletions.
Expand Up @@ -32,8 +32,11 @@ - (void)testColorThemerChangesTheBackgroundColor {
activityIndicator.cycleColors = @[ UIColor.whiteColor ];

// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCActivityIndicatorColorThemer applySemanticColorScheme:colorScheme
toActivityIndicator:activityIndicator];
#pragma clang diagnostic pop

// Then
XCTAssertEqualObjects(activityIndicator.cycleColors, @[ colorScheme.primaryColor ]);
Expand Down
Expand Up @@ -40,7 +40,10 @@ - (void)testPrimaryColorAppliedToBarTintColor {
[[MDCBasicColorScheme alloc] initWithPrimaryColor:UIColor.cyanColor];

// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCBottomAppBarColorThemer applyColorScheme:scheme toBottomAppBarView:self.bottomAppBar];
#pragma clang diagnostic pop

// Then
XCTAssertEqualObjects(self.bottomAppBar.barTintColor, scheme.primaryColor);
Expand All @@ -56,8 +59,11 @@ - (void)testSurfaceVariantColorThemer {
colorScheme.onSurfaceColor = UIColor.purpleColor;

// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCBottomAppBarColorThemer applySurfaceVariantWithSemanticColorScheme:colorScheme
toBottomAppBarView:self.bottomAppBar];
#pragma clang diagnostic pop

// Then
UIColor *barItemTintColor = [colorScheme.onSurfaceColor colorWithAlphaComponent:(CGFloat)0.6];
Expand Down
Expand Up @@ -43,7 +43,10 @@ - (void)applyPrimaryThemeWithColorScheme:(nonnull id<MDCColorScheming>)scheme {
}

- (void)applyPrimaryThemeWithTypographyScheme:(nonnull id<MDCTypographyScheming>)scheme {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCButtonBarTypographyThemer applyTypographyScheme:scheme toButtonBar:self];
#pragma clang diagnostic pop
}

@end
Expand Up @@ -14,7 +14,10 @@

#import "MDCButtonBarTypographyThemer.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation MDCButtonBarTypographyThemer
#pragma clang diagnostic pop

+ (void)applyTypographyScheme:(nonnull id<MDCTypographyScheming>)typographyScheme
toButtonBar:(nonnull MDCButtonBar *)buttonBar {
Expand Down
Expand Up @@ -168,7 +168,10 @@ - (void)changeItemsToImages {

- (void)testDefaultSchemeWithTitles {
// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.buttonBar applyPrimaryThemeWithScheme:self.defaultScheme];
#pragma clang diagnostic pop
[self.buttonBar sizeToFit];

// Then
Expand All @@ -180,7 +183,10 @@ - (void)testDefaultSchemeWithImages {
[self changeItemsToImages];

// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.buttonBar applyPrimaryThemeWithScheme:self.defaultScheme];
#pragma clang diagnostic pop
[self.buttonBar sizeToFit];

// Then
Expand All @@ -189,7 +195,10 @@ - (void)testDefaultSchemeWithImages {

- (void)testCustomSchemeWithTitles {
// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.buttonBar applyPrimaryThemeWithScheme:self.customScheme];
#pragma clang diagnostic pop
[self.buttonBar sizeToFit];

// Then
Expand All @@ -201,7 +210,10 @@ - (void)testCustomSchemeWithImages {
[self changeItemsToImages];

// When
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.buttonBar applyPrimaryThemeWithScheme:self.customScheme];
#pragma clang diagnostic pop
[self.buttonBar sizeToFit];

// Then
Expand Down
Expand Up @@ -53,7 +53,10 @@ - (void)testApplyingColorScheme {
message:@"message"];
MDCSemanticColorScheme *colorScheme =
[[MDCSemanticColorScheme alloc] initWithDefaults:MDCColorSchemeDefaultsMaterial201804];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCAlertColorThemer applySemanticColorScheme:colorScheme toAlertController:alert];
#pragma clang diagnostic pop

MDCAlertControllerView *view = (MDCAlertControllerView *)alert.view;
XCTAssertTrue([self color1:view.titleLabel.textColor
Expand Down
Expand Up @@ -29,7 +29,10 @@ - (void)testApplyingTypographyScheme {
MDCAlertController *alert = [MDCAlertController alertControllerWithTitle:@"title"
message:@"message"];
MDCTypographyScheme *typographyScheme = [[MDCTypographyScheme alloc] init];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[MDCAlertTypographyThemer applyTypographyScheme:typographyScheme toAlertController:alert];
#pragma clang diagnostic pop

MDCAlertControllerView *view = (MDCAlertControllerView *)alert.view;
XCTAssertEqualObjects(view.titleLabel.font, typographyScheme.headline6);
Expand Down
Expand Up @@ -18,7 +18,10 @@
#import "private/MDCMaskedTransition.h"
#import "private/MDCMaskedTransitionMotionForContext.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation MDCMaskedTransitionController
#pragma clang diagnostic pop

- (instancetype)initWithSourceView:(UIView *)sourceView {
self = [self init];
Expand Down
Expand Up @@ -24,8 +24,11 @@ @implementation MaskedTransitionNoopTest

- (void)testInit {
UIView *view = [[UIView alloc] init];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
MDCMaskedTransitionController *transitionController =
[[MDCMaskedTransitionController alloc] initWithSourceView:view];
#pragma clang diagnostic pop
XCTAssertEqual(transitionController.sourceView, view);
}

Expand Down
Expand Up @@ -74,8 +74,11 @@ - (BOOL)catalogShouldHideNavigation {

@implementation NavigationBarTypicalUseExample (Rotation)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration {
#pragma clang diagnostic pop
[self.exampleView setNeedsDisplay];
}

Expand Down

0 comments on commit 8cebc56

Please sign in to comment.