Commit d38a1966 authored by jz's avatar jz

update

parent 88570107
...@@ -18,30 +18,6 @@ ...@@ -18,30 +18,6 @@
@implementation Target_GMRouterCase @implementation Target_GMRouterCase
- (UIViewController *)common_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count != 0, @"common_params 参数解析失败");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)common_no_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count == 0, @"common_no_params 应该不会有参数");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)common_params_action:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
if (vc.routerCompleteBlock) {
XCTAssertTrue(NO, @"common_params_action 测试失败block 不应该有值");
}
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (void)setUp { - (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class. // Put setup code here. This method is called before the invocation of each test method in the class.
...@@ -58,11 +34,61 @@ ...@@ -58,11 +34,61 @@
- (void)testExample { - (void)testExample {
// This is an example of a functional test case. // This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results. // Use XCTAssert and related functions to verify your tests produce the correct results.
//测试不传参数的case
[self testNoParamsCase]; [self testNoParamsCase];
//测试传参数的case
[self testParamsCase]; [self testParamsCase];
//测试回调
[self testParams_action]; [self testParams_action];
//以下主要测试 pushUrlScheme parmas 这个方法的几种情况
[self testJustScheme];
[self testSchemeAndDict];
[self testQuerySchemeAndDict];
} }
#pragma mark - test 裸协议 just_scheme
- (void)testJustScheme {
[[GMRouter sharedInstance] pushScheme:@"just_scheme" params:NULL];
}
- (UIViewController *)just_scheme:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count == 0, @"just_scheme 应该不会有参数");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
#pragma mark - test scheme_params 以及字典参数
- (void)testSchemeAndDict {
[[GMRouter sharedInstance] pushScheme:@"scheme_params" params:@{@"service_id":@"3333"}];
}
- (UIViewController *)scheme_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count != 0, @"scheme_params 应该有参数");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
#pragma mark - test query_scheme_params 以及字典参数
- (void)testQuerySchemeAndDict {
[[GMRouter sharedInstance] pushScheme:@"query_scheme_params?title=无极" params:@{@"service_id": @"3333"}];
}
- (UIViewController *)query_scheme_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count == 2, @"query_scheme_params 应该有两个参数");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (void)testNoParamsCase { - (void)testNoParamsCase {
[[GMRouter sharedInstance] pushScheme:@"common_no_params"]; [[GMRouter sharedInstance] pushScheme:@"common_no_params"];
[[GMRouter sharedInstance] pushScheme:@"gengmei://common_no_params"]; [[GMRouter sharedInstance] pushScheme:@"gengmei://common_no_params"];
...@@ -109,4 +135,58 @@ ...@@ -109,4 +135,58 @@
}]; }];
} }
#pragma mark - 自定义外界传入urlscheme case 需要不断维护
- (UIViewController *)common_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count != 0, @"common_params 参数解析失败");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)common_no_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
XCTAssertTrue(params.allKeys.count == 0, @"common_no_params 应该不会有参数");
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)common_params_action:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
if (vc.routerCompleteBlock) {
XCTAssertTrue(NO, @"common_params_action 测试失败block 不应该有值");
}
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)query_scheme:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
if (vc.routerCompleteBlock) {
XCTAssertTrue(NO, @"common_params_action 测试失败block 不应该有值");
}
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)scheme_custom_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
if (vc.routerCompleteBlock) {
XCTAssertTrue(NO, @"common_params_action 测试失败block 不应该有值");
}
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
- (UIViewController *)query_scheme_custom_params:(NSDictionary *)params {
GMViewController *vc = [[GMViewController alloc] init];
if (vc.routerCompleteBlock) {
XCTAssertTrue(NO, @"common_params_action 测试失败block 不应该有值");
}
[[GMRouterTool getCurrentViewController].navigationController pushViewController:vc animated:YES];
return vc;
}
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment