Created
February 25, 2014 01:10
-
-
Save yashigani/9200664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// KVOSampleTests.m | |
// KVOSampleTests | |
// | |
// Created by taiki on 2014/02/25. | |
// | |
// | |
#import <XCTest/XCTest.h> | |
@interface KVOSampleTests : XCTestCase | |
@property (strong, nonatomic) UIView *observee; | |
@end | |
@implementation KVOSampleTests | |
- (void)setUp | |
{ | |
[super setUp]; | |
_observee = UIView.new; | |
} | |
- (void)tearDown | |
{ | |
[super tearDown]; | |
_observee = nil; | |
} | |
- (void)testAddObserverManyTimes | |
{ | |
[_observee addObserver:self | |
forKeyPath:@"frame" | |
options:NSKeyValueObservingOptionOld | |
context:NULL]; | |
[_observee addObserver:self | |
forKeyPath:@"frame" | |
options:NSKeyValueObservingOptionOld | |
context:NULL]; | |
[_observee removeObserver:self forKeyPath:@"frame" context:NULL]; | |
[_observee removeObserver:self forKeyPath:@"frame" context:NULL]; // 取るとobserverが残ってるって怒られる | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment