forked from mirrors/linphone-iphone
ChatTester: add test for room creation from contact's phone number
This commit is contained in:
parent
b1e3e3f5e2
commit
5991aef599
4 changed files with 48 additions and 25 deletions
|
|
@ -185,6 +185,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
[self.view addSubview:tableView];
|
||||
[self update];
|
||||
} else {
|
||||
// if table is already created, simply refresh buttons (selection mode changed, etc.)
|
||||
[self refreshButtons];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +258,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
- (void)refreshButtons {
|
||||
switch ([ContactSelection getSelectionMode]) {
|
||||
case ContactSelectionModePhone:
|
||||
case ContactSelectionModeMessage:
|
||||
|
|
@ -274,6 +277,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
allButton.selected = TRUE;
|
||||
linphoneButton.selected = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
[self refreshButtons];
|
||||
[tableController loadData];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIChatCell">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Contact name"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="25"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="This is a message" lineBreakMode="tailTruncation" numberOfLines="2" minimumFontSize="10" adjustsFontSizeToFit="NO" id="21" userLabel="chatContentLabel">
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Message"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" id="39" userLabel="unreadMessageView">
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<rect key="frame" x="10" y="12" width="24" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</imageView>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" id="41" userLabel="unreadMessageLabel">
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" id="41" userLabel="unreadMessageLabel">
|
||||
<rect key="frame" x="12" y="10" width="20" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Unread message number"/>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,12 @@
|
|||
#pragma mark -
|
||||
|
||||
- (NSString *)accessibilityValue {
|
||||
return [NSString stringWithFormat:@"%@ - %@ (%ld)", addressLabel.text, chatContentLabel.text, (long)[unreadMessageLabel.text integerValue]];
|
||||
if (chatContentLabel.text) {
|
||||
return [NSString stringWithFormat:@"%@ - %@ (%li)", addressLabel.text, chatContentLabel.text,
|
||||
[unreadMessageLabel.text integerValue]];
|
||||
} else {
|
||||
return [NSString stringWithFormat:@"%@ (%li)", addressLabel.text, [unreadMessageLabel.text integerValue]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -113,26 +118,25 @@
|
|||
if(url||last_content) {
|
||||
[chatContentLabel setText:@"🗻"];
|
||||
} else if (text) {
|
||||
NSString *message = [NSString stringWithUTF8String:text];
|
||||
// shorten long messages
|
||||
if([message length] > 50)
|
||||
message = [[message substringToIndex:50] stringByAppendingString:@"[...]"];
|
||||
NSString *message = [NSString stringWithUTF8String:text];
|
||||
// shorten long messages
|
||||
if ([message length] > 50)
|
||||
message = [[message substringToIndex:50] stringByAppendingString:@"[...]"];
|
||||
|
||||
[chatContentLabel setText:message];
|
||||
}
|
||||
|
||||
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
|
||||
if(count > 0) {
|
||||
[unreadMessageView setHidden:FALSE];
|
||||
[unreadMessageLabel setText:[NSString stringWithFormat:@"%i", count]];
|
||||
} else {
|
||||
[unreadMessageView setHidden:TRUE];
|
||||
}
|
||||
} else {
|
||||
chatContentLabel.text = nil;
|
||||
[unreadMessageView setHidden:TRUE];
|
||||
}
|
||||
chatContentLabel.text = message;
|
||||
}
|
||||
|
||||
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
|
||||
if (count > 0) {
|
||||
[unreadMessageView setHidden:FALSE];
|
||||
unreadMessageLabel.text = [NSString stringWithFormat:@"%i", count];
|
||||
} else {
|
||||
[unreadMessageView setHidden:TRUE];
|
||||
}
|
||||
} else {
|
||||
chatContentLabel.text = nil;
|
||||
[unreadMessageView setHidden:TRUE];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
|
|||
|
|
@ -254,4 +254,16 @@
|
|||
ASSERT_EQ([[[LinphoneManager instance] fileTransferDelegates] count], 0);
|
||||
}
|
||||
|
||||
- (void)testChatFromContactPhoneNumber {
|
||||
[tester tapViewWithAccessibilityLabel:@"New Discussion"];
|
||||
[tester tapViewWithAccessibilityLabel:@"Anna Haro"];
|
||||
[tester tapViewWithAccessibilityLabel:@"home, 555-522-8243"];
|
||||
[self goBackFromChat];
|
||||
UITableView *tv = [self findTableView:@"ChatRoom list"];
|
||||
ASSERT_EQ([tv numberOfRowsInSection:0], 1);
|
||||
[tester waitForViewWithAccessibilityLabel:@"Contact name, Message"
|
||||
value:@"Anna Haro (3)"
|
||||
traits:UIAccessibilityTraitStaticText];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue