TestsUI: fix failing tests

This commit is contained in:
Gautier Pelloux-Prayer 2016-03-16 15:09:15 +01:00
parent e6b8057c50
commit 9878131526
2 changed files with 6 additions and 5 deletions

View file

@ -254,16 +254,17 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
if (editingStyle == UITableViewCellEditingStyleDelete) {
ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, (__bridge void *)(self));
[tableView beginUpdates];
OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]];
NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]];
OrderedDictionary *subDic = [addressBookMap objectForKey:firstChar];
NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]];
ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]);
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString;
[[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]];
if ([tableView numberOfRowsInSection:indexPath.section] == 1) {
[addressBookMap removeObjectForKey:firstChar];
[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section]
withRowAnimation:UITableViewRowAnimationFade];
}
[[LinphoneManager.instance fastAddressBook] removeContact:contact];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
@ -275,10 +276,10 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
- (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover {
[super removeSelectionUsing:^(NSIndexPath *indexPath) {
ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, (__bridge void *)(self));
OrderedDictionary *subDic = [addressBookMap objectForKey:[addressBookMap keyAtIndex:[indexPath section]]];
NSString *firstChar = [addressBookMap keyAtIndex:[indexPath section]];
OrderedDictionary *subDic = [addressBookMap objectForKey:firstChar];
NSString *key = [[subDic allKeys] objectAtIndex:[indexPath row]];
ABRecordRef contact = (__bridge ABRecordRef)([subDic objectForKey:key]);
NSString *firstChar = [[self displayNameForContact:contact] substringToIndex:1].uppercaseString;
[[addressBookMap objectForKey:firstChar] removeObjectForKey:[self displayNameForContact:contact]];
if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) {
[addressBookMap removeObjectForKey:firstChar];

View file

@ -120,7 +120,7 @@
- (void)testChatFromContactPhoneNumber {
[tester tapViewWithAccessibilityLabel:@"Contacts"];
[tester tapViewWithAccessibilityLabel:@"Anna Haro"];
[tester tapViewWithAccessibilityLabel:@"Chat with 555-522-8243"];
[tester tapViewWithAccessibilityLabel:@"Chat with 5555228243"];
[self goBackFromChat];
UITableView *tv = [self findTableView:@"Chat list"];
ASSERT_EQ([tv numberOfRowsInSection:0], 1);