[test-runner] Share common code between test runners
Also remove some unnecessary files.
This commit is contained in:
@@ -108,8 +108,6 @@ if(MBGL_IOS_RENDER_TEST)
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ios_test_runner.hpp
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.h
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.m
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ViewController.h
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ViewController.m
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/main.m
|
||||
${PROJECT_SOURCE_DIR}/render-test/ios/ios_test_runner.cpp
|
||||
${PROJECT_SOURCE_DIR}/render-test/ios/iosTestRunner.h
|
||||
@@ -202,12 +200,10 @@ if(MBGL_IOS_UNIT_TEST)
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ios_test_runner.hpp
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.h
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/AppDelegate.m
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ViewController.h
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/ViewController.m
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/iosTestRunner.mm
|
||||
${PROJECT_SOURCE_DIR}/platform/ios/test/common/main.m
|
||||
${PROJECT_SOURCE_DIR}/test/ios/ios_test_runner.cpp
|
||||
${PROJECT_SOURCE_DIR}/test/ios/iosTestRunner.h
|
||||
${PROJECT_SOURCE_DIR}/test/ios/iosTestRunner.mm
|
||||
${RESOURCES}
|
||||
)
|
||||
initialize_ios_target(UnitTestsApp)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#import "ViewController.h"
|
||||
#import "iosTestRunner.h"
|
||||
|
||||
@interface ViewController ()
|
||||
{
|
||||
IosTestRunner* i;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// In order to run test runner with app itself instead of with unit test, comment out the following line.
|
||||
// i = [[IosTestRunner alloc]init];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
@interface IosTestRunner ()
|
||||
|
||||
@property (nullable) TestRunner* runner;
|
||||
@property (nullable) TestRunner *runner;
|
||||
|
||||
@property (copy, nullable) NSString *resultPath;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
for (uint32_t i = 0; i < bundleContents.count; i++) {
|
||||
NSString *dirName = [bundleContents objectAtIndex: i];
|
||||
if ([dirName isEqualToString:@"test-data"]) {
|
||||
if ([dirName isEqualToString: dataDir]) {
|
||||
NSString *destinationPath = [documentsDir stringByAppendingPathComponent: dirName];
|
||||
BOOL success = [fileManager fileExistsAtPath: destinationPath];
|
||||
if (success) {
|
||||
@@ -56,9 +56,10 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::string basePath = std::string([documentsDir UTF8String]) + std::string("/test-data");
|
||||
NSString *baseDir = [documentsDir stringByAppendingPathComponent: dataDir];
|
||||
std::string basePath = std::string([baseDir UTF8String]);
|
||||
self.testStatus = self.runner->startTest(basePath) ? YES : NO;
|
||||
self.resultPath = [documentsDir stringByAppendingPathComponent:@"/test-data/test/results.xml"];
|
||||
self.resultPath = [baseDir stringByAppendingPathComponent: resultFilePath];
|
||||
|
||||
BOOL fileFound = [fileManager fileExistsAtPath: self.resultPath];
|
||||
if (fileFound == NO) {
|
||||
@@ -1,9 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString *dataDir = @"test-data";
|
||||
NSString *resultFilePath = @"test/results.xml";
|
||||
|
||||
__attribute__((visibility ("default")))
|
||||
@interface IosTestRunner : NSObject
|
||||
|
||||
|
||||
Reference in New Issue
Block a user