mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Merge branch 'tester'
This commit is contained in:
commit
5c1604adc9
15 changed files with 538 additions and 24 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="H1p-Uh-vWS">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="H1p-Uh-vWS">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="1536" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
|
@ -27,6 +28,7 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="703" height="768"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<simulatedOrientationMetrics key="simulatedOrientationMetrics" orientation="landscapeRight"/>
|
||||
<prototypes>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" textLabel="6lf-XI-z9S" style="IBUITableViewCellStyleDefault" id="fGk-UB-StR">
|
||||
<rect key="frame" x="0.0" y="86" width="703" height="44"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="rS3-R9-Ivy">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="rS3-R9-Ivy">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="1536" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
|
@ -56,7 +57,21 @@
|
|||
<outlet property="delegate" destination="pGg-6v-bdr" id="Y6K-Cp-Qkv"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="List of Categories" id="tQt-TN-PWz"/>
|
||||
<navigationItem key="navigationItem" title="List of Categories" id="tQt-TN-PWz">
|
||||
<barButtonItem key="rightBarButtonItem" style="plain" id="OR9-bC-Hrz">
|
||||
<button key="customView" opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="W17-XV-pa2">
|
||||
<rect key="frame" x="233" y="5" width="71" height="33"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="Logs">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<segue destination="iOM-9A-Idi" kind="push" identifier="viewLogs" id="vec-9D-8FU"/>
|
||||
</connections>
|
||||
</button>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="6Cn-md-YlS" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
|
@ -90,11 +105,70 @@
|
|||
</tableViewCell>
|
||||
</prototypes>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Tests" id="cra-N8-TIN"/>
|
||||
<navigationItem key="navigationItem" title="Tests" id="cra-N8-TIN">
|
||||
<barButtonItem key="rightBarButtonItem" style="plain" id="4Up-P9-XMd">
|
||||
<button key="customView" opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="V3v-ch-Eo9">
|
||||
<rect key="frame" x="233" y="5" width="71" height="33"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="Logs">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<segue destination="iOM-9A-Idi" kind="push" identifier="viewLogs" id="iv2-SW-SW7"/>
|
||||
</connections>
|
||||
</button>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="lrm-kH-fPn" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="902" y="64"/>
|
||||
<point key="canvasLocation" x="1002" y="78"/>
|
||||
</scene>
|
||||
<!--Logs View Controller - Logs-->
|
||||
<scene sceneID="Lco-sG-mtf">
|
||||
<objects>
|
||||
<viewController title="Logs" id="iOM-9A-Idi" customClass="LogsViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="iFS-21-xSV"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="cJF-a0-78o"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="vw6-4p-QJ4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YSt-fg-hE2">
|
||||
<rect key="frame" x="0.0" y="-10" width="320" height="588"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="UYk-Px-ln1">
|
||||
<barButtonItem key="rightBarButtonItem" style="plain" id="6Iq-1U-z3C">
|
||||
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="hhf-hV-LBt">
|
||||
<rect key="frame" x="233" y="5" width="71" height="33"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<state key="normal" title="Clear">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clearLogs:" destination="iOM-9A-Idi" eventType="touchUpInside" id="A6e-Rk-6VP"/>
|
||||
</connections>
|
||||
</button>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="tview" destination="YSt-fg-hE2" id="AQo-QT-bvB"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="laq-GV-eTB" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1520" y="-658"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
|
|
@ -102,4 +176,7 @@
|
|||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4"/>
|
||||
</simulatedMetricsContainer>
|
||||
<inferredMetricsTieBreakers>
|
||||
<segue reference="vec-9D-8FU"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,25 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NS_ENUM(int, TestState) {
|
||||
TestStateIdle,
|
||||
TestStatePassed,
|
||||
TestStateInProgress,
|
||||
TestStateFailed
|
||||
};
|
||||
|
||||
@interface TestItem : NSObject
|
||||
|
||||
|
||||
@property (strong, nonatomic) NSString* suite;
|
||||
@property (strong, nonatomic) NSString* name;
|
||||
@property (nonatomic) TestState state;
|
||||
|
||||
-(id)initWithName:(NSString*)name fromSuite:(NSString*)suite;
|
||||
+(TestItem*)testWithName:(NSString*)name fromSuite:(NSString*)suite;
|
||||
|
||||
@end
|
||||
|
||||
@interface DetailViewController : UITableViewController
|
||||
|
||||
@property (strong, nonatomic) NSString* detailItem;
|
||||
|
|
|
|||
|
|
@ -7,10 +7,37 @@
|
|||
//
|
||||
|
||||
#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;
|
||||
|
|
@ -37,11 +64,16 @@
|
|||
- (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<count; i++) {
|
||||
const char* test_name = liblinphone_tester_test_name(suite, i);
|
||||
[_tests addObject:[NSString stringWithUTF8String:test_name]];
|
||||
TestItem* item = [[TestItem alloc] initWithName:[NSString stringWithUTF8String:test_name] fromSuite:nssuite];
|
||||
[_tests addObject:item];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,8 +105,19 @@
|
|||
{
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"testCellIdentifier" forIndexPath:indexPath];
|
||||
|
||||
NSString *test = _tests[indexPath.row];
|
||||
cell.textLabel.text = test;
|
||||
TestItem *test = _tests[indexPath.row];
|
||||
cell.textLabel.text = test.name;
|
||||
NSString* image = nil;
|
||||
switch( test.state ){
|
||||
case TestStateIdle: image = nil; break;
|
||||
case TestStatePassed: image = @"test_passed"; break;
|
||||
case TestStateInProgress: image = @"test_inprogress"; break;
|
||||
case TestStateFailed: image = @"test_failed"; break;
|
||||
}
|
||||
if(image){
|
||||
image = [[NSBundle mainBundle] pathForResource:image ofType:@"png"];
|
||||
cell.imageView.image = [UIImage imageWithContentsOfFile:image];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
@ -86,16 +129,63 @@
|
|||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
NSString *object = _tests[indexPath.row];
|
||||
NSLog(@"Should launch test %@ from suite %@", object, self.detailItem);
|
||||
BOOL fail = liblinphone_tester_run_tests([self.detailItem UTF8String], [object UTF8String]);
|
||||
if(fail){
|
||||
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Test failed" message:@"" delegate:nil cancelButtonTitle:@"OK :-(" otherButtonTitles: nil];
|
||||
[alert show];
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:FALSE];
|
||||
if( !in_progress ){
|
||||
if( indexPath.row == 0 ){
|
||||
|
||||
// run all tests
|
||||
NSMutableArray* paths = [[NSMutableArray alloc] init];
|
||||
for (int i = 1; i<_tests.count; i++) {
|
||||
[paths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
|
||||
}
|
||||
[self launchTest:paths];
|
||||
|
||||
} else {
|
||||
[self launchTest:@[indexPath]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)updateItem:(NSArray*)paths withAnimation:(BOOL)animate {
|
||||
[self.tableView reloadRowsAtIndexPaths:paths
|
||||
withRowAnimation:animate?UITableViewRowAnimationFade:UITableViewRowAnimationNone];
|
||||
}
|
||||
|
||||
|
||||
-(void)launchTest:(NSArray*)paths {
|
||||
for (NSIndexPath* path in paths) {
|
||||
TestItem *test = _tests[path.row];
|
||||
test.state = TestStateInProgress;
|
||||
}
|
||||
[self updateItem:paths withAnimation:FALSE];
|
||||
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
in_progress = TRUE;
|
||||
|
||||
dispatch_async(queue, ^{
|
||||
for (NSIndexPath*path in paths) {
|
||||
|
||||
TestItem *test = _tests[path.row];
|
||||
LSLog(@"Should launch test %@", test);
|
||||
|
||||
BOOL fail = liblinphone_tester_run_tests([test.suite UTF8String], [test.name UTF8String]);
|
||||
if(fail){
|
||||
LSLog(@"Test Failed!");
|
||||
test.state = TestStateFailed;
|
||||
} else {
|
||||
LSLog(@"Test Passed!");
|
||||
test.state = TestStatePassed;
|
||||
}
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self updateItem:@[path] withAnimation:TRUE];
|
||||
in_progress = FALSE;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Split view
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "57x57"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "57x57"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "72x72"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "72x72"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "50x50"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "50x50"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"orientation" : "portrait"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"orientation" : "portrait"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"subtype" : "retina4",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"minimum-system-version" : "7.0",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "iphone",
|
||||
"minimum-system-version" : "7.0",
|
||||
"subtype" : "retina4",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "to-status-bar",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "to-status-bar",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "to-status-bar",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"extent" : "to-status-bar",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"minimum-system-version" : "7.0",
|
||||
"extent" : "full-screen",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "portrait",
|
||||
"idiom" : "ipad",
|
||||
"minimum-system-version" : "7.0",
|
||||
"extent" : "full-screen",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"minimum-system-version" : "7.0",
|
||||
"extent" : "full-screen",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "ipad",
|
||||
"minimum-system-version" : "7.0",
|
||||
"extent" : "full-screen",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,10 @@
|
|||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIcons</key>
|
||||
<dict/>
|
||||
<key>CFBundleIcons~ipad</key>
|
||||
<dict/>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.belledonne-communications.tester.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
|
|
|
|||
17
LinphoneTester/LogsViewController.h
Normal file
17
LinphoneTester/LogsViewController.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// LogsViewController.h
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume BIENKOWSKI on 01/06/2014.
|
||||
//
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@interface LogsViewController : UIViewController
|
||||
@property (weak, nonatomic) IBOutlet UITextView *tview;
|
||||
|
||||
- (IBAction)clearLogs:(id)sender;
|
||||
|
||||
@end
|
||||
52
LinphoneTester/LogsViewController.m
Normal file
52
LinphoneTester/LogsViewController.m
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// LogsViewController.m
|
||||
// linphone
|
||||
//
|
||||
// Created by Guillaume BIENKOWSKI on 01/06/2014.
|
||||
//
|
||||
//
|
||||
|
||||
#import "LogsViewController.h"
|
||||
#import "MasterViewController.h"
|
||||
|
||||
@interface LogsViewController () {
|
||||
NSString* txt;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation LogsViewController
|
||||
|
||||
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
self.tview.textContainer.lineBreakMode = NSLineBreakByClipping;
|
||||
self.tview.text = [lastLogs componentsJoinedByString:@"\n"];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(updateLogs:)
|
||||
name:kLogsUpdateNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (IBAction)clearLogs:(id)sender {
|
||||
|
||||
self.tview.text = nil;
|
||||
}
|
||||
|
||||
- (void)updateLogs:(NSNotification*)notif {
|
||||
NSArray* newLogs = [notif.userInfo objectForKey:@"newlogs"];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.tview.text = [self.tview.text stringByAppendingString:[newLogs componentsJoinedByString:@"\n"] ];
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -8,6 +8,11 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
void LSLog(NSString* fmt, ...);
|
||||
|
||||
NSMutableArray* lastLogs;
|
||||
NSString* const kLogsUpdateNotification;
|
||||
|
||||
@class DetailViewController;
|
||||
|
||||
@interface MasterViewController : UITableViewController
|
||||
|
|
@ -15,3 +20,4 @@
|
|||
@property (strong, nonatomic) DetailViewController *detailViewController;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,14 @@
|
|||
//
|
||||
|
||||
#import "MasterViewController.h"
|
||||
|
||||
#import "LogsViewController.h"
|
||||
#import "DetailViewController.h"
|
||||
|
||||
#include "linphone/liblinphone_tester.h"
|
||||
|
||||
@interface MasterViewController () {
|
||||
NSMutableArray *_objects;
|
||||
NSString* bundlePath;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
@ -28,18 +29,63 @@
|
|||
[super awakeFromNib];
|
||||
}
|
||||
|
||||
NSMutableArray* lastLogs = nil;
|
||||
NSMutableArray* logsBuffer = nil;
|
||||
static int const kLastLogsCapacity = 5000;
|
||||
static int const kLogsBufferCapacity = 10;
|
||||
NSString* const kLogsUpdateNotification = @"kLogsUpdateNotification";
|
||||
|
||||
void LSLog(NSString* fmt, ...){
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
linphone_log_function(ORTP_MESSAGE, [fmt UTF8String], args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static void linphone_log_function(OrtpLogLevel lev, const char *fmt, va_list args) {
|
||||
NSString* log = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:fmt] arguments:args];
|
||||
//NSLog(@"%@",log);
|
||||
|
||||
[logsBuffer addObject:log];
|
||||
|
||||
if (logsBuffer.count >= kLogsBufferCapacity ) {
|
||||
[lastLogs addObjectsFromArray:logsBuffer];
|
||||
|
||||
if( lastLogs.count >= kLastLogsCapacity - kLogsBufferCapacity ){
|
||||
[lastLogs removeObjectsInRange:NSMakeRange(0, kLogsBufferCapacity)];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kLogsUpdateNotification
|
||||
object:nil
|
||||
userInfo:@{@"newlogs": [logsBuffer copy]}];
|
||||
[logsBuffer removeAllObjects];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)setupLogging {
|
||||
lastLogs = [[NSMutableArray alloc] initWithCapacity:kLastLogsCapacity];
|
||||
logsBuffer = [NSMutableArray arrayWithCapacity:kLogsBufferCapacity];
|
||||
|
||||
linphone_core_set_log_handler(linphone_log_function);
|
||||
linphone_core_set_log_level(ORTP_DEBUG|ORTP_ERROR|ORTP_FATAL|ORTP_WARNING|ORTP_MESSAGE|ORTP_TRACE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
self.detailViewController = (DetailViewController *)[[self.splitViewController.viewControllers lastObject] topViewController];
|
||||
const char* prefix = strdup([[[NSBundle mainBundle] bundlePath] UTF8String]);
|
||||
|
||||
[self setupLogging];
|
||||
|
||||
bundlePath = [[NSBundle mainBundle] bundlePath];
|
||||
liblinphone_tester_init();
|
||||
liblinphone_tester_set_fileprefix(prefix);
|
||||
|
||||
NSLog(@"Bundle path: %s", liblinphone_tester_file_prefix);
|
||||
|
||||
liblinphone_tester_set_fileprefix([bundlePath UTF8String]);
|
||||
|
||||
LSLog(@"Bundle path: %@", bundlePath);
|
||||
|
||||
int count = liblinphone_tester_nb_test_suites();
|
||||
_objects = [[NSMutableArray alloc] initWithCapacity:count];
|
||||
|
|
@ -50,6 +96,11 @@
|
|||
|
||||
}
|
||||
|
||||
- (void)displayLogs {
|
||||
LSLog(@"Should display logs");
|
||||
[self.navigationController performSegueWithIdentifier:@"viewLogs" sender:self];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning
|
||||
{
|
||||
[super didReceiveMemoryWarning];
|
||||
|
|
@ -126,4 +177,5 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
BIN
Resources/test_failed.png
Normal file
BIN
Resources/test_failed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/test_inprogress.png
Normal file
BIN
Resources/test_inprogress.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Resources/test_passed.png
Normal file
BIN
Resources/test_passed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -1428,6 +1428,10 @@
|
|||
F0BB8C4C193631D200974404 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22276E8813C73DC000210156 /* CoreMedia.framework */; };
|
||||
F0BB8C4D193631DF00974404 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; };
|
||||
F476004B147AAF2800FFF19B /* liblinphone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2211DB911475562600DEE054 /* liblinphone.a */; };
|
||||
F84015BF1939FE37006ABAB5 /* test_failed.png in Resources */ = {isa = PBXBuildFile; fileRef = F84015BC1939FE37006ABAB5 /* test_failed.png */; };
|
||||
F84015C01939FE37006ABAB5 /* test_inprogress.png in Resources */ = {isa = PBXBuildFile; fileRef = F84015BD1939FE37006ABAB5 /* test_inprogress.png */; };
|
||||
F84015C11939FE37006ABAB5 /* test_passed.png in Resources */ = {isa = PBXBuildFile; fileRef = F84015BE1939FE37006ABAB5 /* test_passed.png */; };
|
||||
F84015C7193B4E34006ABAB5 /* LogsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F84015C6193B4E34006ABAB5 /* LogsViewController.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
|
@ -2372,6 +2376,11 @@
|
|||
F0BB8C42193630CA00974404 /* tester_hosts */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = tester_hosts; path = submodules/linphone/tester/tester_hosts; sourceTree = SOURCE_ROOT; };
|
||||
F0BB8C43193630CA00974404 /* userdb.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = userdb.conf; path = submodules/linphone/tester/userdb.conf; sourceTree = SOURCE_ROOT; };
|
||||
F0BB8C4A193631B300974404 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
|
||||
F84015BC1939FE37006ABAB5 /* test_failed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test_failed.png; path = Resources/test_failed.png; sourceTree = "<group>"; };
|
||||
F84015BD1939FE37006ABAB5 /* test_inprogress.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test_inprogress.png; path = Resources/test_inprogress.png; sourceTree = "<group>"; };
|
||||
F84015BE1939FE37006ABAB5 /* test_passed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = test_passed.png; path = Resources/test_passed.png; sourceTree = "<group>"; };
|
||||
F84015C5193B4E34006ABAB5 /* LogsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LogsViewController.h; sourceTree = "<group>"; };
|
||||
F84015C6193B4E34006ABAB5 /* LogsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LogsViewController.m; sourceTree = "<group>"; };
|
||||
FD61C862169FC495001AA2D6 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/HistoryDetailsViewController.xib; sourceTree = "<group>"; };
|
||||
FD61C88216A00E69001AA2D6 /* ru */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ru; path = ru.lproj/UICallCell.xib; sourceTree = "<group>"; };
|
||||
FD979F30169E84670022A8B4 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = Resources/ru.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
|
|
@ -3038,6 +3047,9 @@
|
|||
F0B89C2318DC90850050B60E /* images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F84015BC1939FE37006ABAB5 /* test_failed.png */,
|
||||
F84015BD1939FE37006ABAB5 /* test_inprogress.png */,
|
||||
F84015BE1939FE37006ABAB5 /* test_passed.png */,
|
||||
15AF3C4C16F37A3E00FC52EC /* route_bluetooth_off_default.png */,
|
||||
1599104316F746B2007BF52B /* route_bluetooth_off_default_landscape.png */,
|
||||
15AF3C4D16F37A3E00FC52EC /* route_bluetooth_off_disabled.png */,
|
||||
|
|
@ -3532,14 +3544,16 @@
|
|||
children = (
|
||||
F0BB8BE21936208100974404 /* AppDelegate.h */,
|
||||
F0BB8BE31936208100974404 /* AppDelegate.m */,
|
||||
F0BB8BE51936208100974404 /* Main_iPhone.storyboard */,
|
||||
F0BB8BE81936208200974404 /* Main_iPad.storyboard */,
|
||||
F0BB8BEB1936208200974404 /* MasterViewController.h */,
|
||||
F0BB8BEC1936208200974404 /* MasterViewController.m */,
|
||||
F0BB8BEE1936208200974404 /* DetailViewController.h */,
|
||||
F0BB8BEF1936208200974404 /* DetailViewController.m */,
|
||||
F0BB8BF11936208200974404 /* Images.xcassets */,
|
||||
F0BB8BE81936208200974404 /* Main_iPad.storyboard */,
|
||||
F0BB8BE51936208100974404 /* Main_iPhone.storyboard */,
|
||||
F0BB8BEB1936208200974404 /* MasterViewController.h */,
|
||||
F0BB8BEC1936208200974404 /* MasterViewController.m */,
|
||||
F0BB8BDA1936208100974404 /* Supporting Files */,
|
||||
F84015C5193B4E34006ABAB5 /* LogsViewController.h */,
|
||||
F84015C6193B4E34006ABAB5 /* LogsViewController.m */,
|
||||
);
|
||||
path = LinphoneTester;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -4813,14 +4827,17 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F0BB8C3819362C1500974404 /* rcfiles in Resources */,
|
||||
F84015C11939FE37006ABAB5 /* test_passed.png in Resources */,
|
||||
F0BB8C44193630CA00974404 /* flexisip.conf in Resources */,
|
||||
F0BB8C46193630CA00974404 /* marie_xml in Resources */,
|
||||
F0BB8BEA1936208200974404 /* Main_iPad.storyboard in Resources */,
|
||||
F0BB8C48193630CA00974404 /* userdb.conf in Resources */,
|
||||
F0BB8C3E19362C2200974404 /* sounds in Resources */,
|
||||
F84015BF1939FE37006ABAB5 /* test_failed.png in Resources */,
|
||||
F0BB8BF21936208200974404 /* Images.xcassets in Resources */,
|
||||
F0BB8BE71936208200974404 /* Main_iPhone.storyboard in Resources */,
|
||||
F0BB8C47193630CA00974404 /* tester_hosts in Resources */,
|
||||
F84015C01939FE37006ABAB5 /* test_inprogress.png in Resources */,
|
||||
F0BB8C3C19362C2200974404 /* certificates in Resources */,
|
||||
F0BB8C45193630CA00974404 /* local_tester_hosts in Resources */,
|
||||
F0BB8C3D19362C2200974404 /* images in Resources */,
|
||||
|
|
@ -5063,6 +5080,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F0BB8BE41936208100974404 /* AppDelegate.m in Sources */,
|
||||
F84015C7193B4E34006ABAB5 /* LogsViewController.m in Sources */,
|
||||
F0BB8BED1936208200974404 /* MasterViewController.m in Sources */,
|
||||
F0BB8BE01936208100974404 /* main.m in Sources */,
|
||||
F0BB8BF01936208200974404 /* DetailViewController.m in Sources */,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue