// // DetailViewController.m // LinphoneTester // // Created by guillaume on 28/05/2014. // // #import "DetailViewController.h" #import "MasterViewController.h" #import "LogsViewController.h" #include "linphone/liblinphone_tester.h" static NSString* const kAllTestsName = @"Run All tests"; @implementation TestItem -(id)initWithName:(NSString *)name fromSuite:(NSString *)suite { self = [super init]; if( self ){ self.name = name; self.suite = suite; self.state = TestStateIdle; } return self; } +(TestItem *)testWithName:(NSString *)name fromSuite:(NSString *)suite{ return [[TestItem alloc] initWithName:name fromSuite:suite]; } -(NSString*)description { return [NSString stringWithFormat:@"{suite:'%@', test:'%@', state:%d}", _suite, _name, _state]; } @end @interface DetailViewController () { NSMutableArray* _tests; BOOL in_progress; } @property (strong, nonatomic) UIPopoverController *masterPopoverController; - (void)configureView; @end @implementation DetailViewController #pragma mark - Managing the detail item - (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [self configureView]; } if (self.masterPopoverController != nil) { [self.masterPopoverController dismissPopoverAnimated:YES]; } } - (void)configureView { const char* suite = [self.detailItem UTF8String]; NSString* nssuite = [NSString stringWithUTF8String:suite]; int count = liblinphone_tester_nb_tests(suite); _tests = [[NSMutableArray alloc] initWithCapacity:count]; [_tests addObject:[TestItem testWithName:kAllTestsName fromSuite:nssuite]]; for (int i=0; i