mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-07 02:08:34 +08:00
Merge all copies of RUN_RUNLOOP_WHILE in UIExplorerUnitTests
Reviewed By: mhorowitz Differential Revision: D4921344 fbshipit-source-id: 8b00acba108e46c55374df54a027015d4327d683
This commit is contained in:
committed by
Facebook Github Bot
parent
59378f71db
commit
6b19419cdb
@@ -14,22 +14,11 @@
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <RCTTest/RCTTestRunner.h>
|
||||
#import <React/RCTUIManager.h>
|
||||
#import <React/RCTView.h>
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
#define RUN_RUNLOOP_WHILE(CONDITION) \
|
||||
{ \
|
||||
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:5]; \
|
||||
while ((CONDITION)) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
|
||||
if ([timeout timeIntervalSinceNow] <= 0) { \
|
||||
XCTFail(@"Runloop timed out before condition was met"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
@interface RCTUIManager ()
|
||||
|
||||
- (void)createView:(NSNumber *)reactTag
|
||||
@@ -99,7 +88,7 @@ RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView)
|
||||
_bridge = [[RCTBridge alloc] initWithBundleURL:[bundle URLForResource:@"UIExplorerUnitTestsBundle" withExtension:@"js"]
|
||||
moduleProvider:nil
|
||||
launchOptions:nil];
|
||||
RUN_RUNLOOP_WHILE(_bridge.isLoading);
|
||||
RCT_RUN_RUNLOOP_WHILE(_bridge.isLoading);
|
||||
}
|
||||
|
||||
- (void)testSetProps
|
||||
@@ -123,7 +112,7 @@ RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView)
|
||||
[uiManager setNeedsLayout];
|
||||
});
|
||||
|
||||
RUN_RUNLOOP_WHILE(view == nil);
|
||||
RCT_RUN_RUNLOOP_WHILE(view == nil);
|
||||
}
|
||||
|
||||
- (void)testResetProps
|
||||
@@ -153,7 +142,7 @@ RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView)
|
||||
[uiManager setNeedsLayout];
|
||||
});
|
||||
|
||||
RUN_RUNLOOP_WHILE(view == nil);
|
||||
RCT_RUN_RUNLOOP_WHILE(view == nil);
|
||||
}
|
||||
|
||||
- (void)testResetBackgroundColor
|
||||
@@ -177,7 +166,7 @@ RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView)
|
||||
[uiManager setNeedsLayout];
|
||||
});
|
||||
|
||||
RUN_RUNLOOP_WHILE(view == nil);
|
||||
RCT_RUN_RUNLOOP_WHILE(view == nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user