The framework supports loading images and, on iOS/tvOS, styling the flags in a few different shapes. It has unit tests for all platforms, verifying the framework can load images from the bundle and compares the generated styled flags with test fixtures.
37 lines
724 B
Objective-C
37 lines
724 B
Objective-C
//
|
|
// Copyright © 2017 Bowtie. All rights reserved.
|
|
//
|
|
|
|
@import XCTest;
|
|
@import FlagKit;
|
|
|
|
@interface ObjectiveCTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation ObjectiveCTests
|
|
|
|
- (void)testValidCountryCode {
|
|
FKFlag *flag = [[FKFlag alloc] initWithCountryCode:@"SE"];
|
|
XCTAssertNotNil(flag);
|
|
XCTAssertEqual(flag.countryCode, @"SE");
|
|
XCTAssertNotNil(flag.originalImage);
|
|
}
|
|
|
|
- (void)testInvalidCountryCode {
|
|
FKFlag *flag = [[FKFlag alloc] initWithCountryCode:@"FLAGKIT"];
|
|
XCTAssertNil(flag);
|
|
}
|
|
|
|
#if TARGET_OS_IPHONE
|
|
|
|
- (void)testStyleImage {
|
|
FKFlag *flag = [[FKFlag alloc] initWithCountryCode:@"SE"];
|
|
UIImage *image = [flag imageWithStyle:FKFlagStyleNone];
|
|
XCTAssertNotNil(image);
|
|
}
|
|
|
|
#endif
|
|
|
|
@end
|