Files
wagic/projects/mtg/iOS/asi-http-request/Tests/ASIWebPageRequestTests.m
techdragon.nguyen@gmail.com 128c60bc2b added download feature for iOS port
required libs: 
    * ZipArchive - Obj-C impl of zip
    * asi-http-request : http request help to assist with asynchoronous downloading of files
    * minizip : support for ZipArchive
    * 
Added default splash screen for iOS app.  (using the Wagic background to keep it neutral to module)

TODO: refine handling for iPad splash screen
    * add selection screen and input screen for location of downloadable content. (ie core files, image files, etc )
    * add support to opt out of backing up to iCloud for core files. Right now iOS will automatically backup all files under Documents folder to iCloud.  Consider only allowing player data to be backed up to iCloud.  All graphics and other assets are considered volatile.
2011-12-11 07:40:22 +00:00

42 lines
1.5 KiB
Objective-C

//
// ASIWebPageRequestTests.m
// Mac
//
// Created by Ben Copsey on 06/01/2011.
// Copyright 2011 All-Seeing Interactive. All rights reserved.
//
#import "ASIWebPageRequestTests.h"
#import "ASIWebPageRequest.h"
@implementation ASIWebPageRequestTests
- (void)testEncoding
{
NSArray *encodings = [NSArray arrayWithObjects:@"us-ascii",@"iso-8859-1",@"utf-16",@"utf-8",nil];
NSArray *expectedResponses = [NSArray arrayWithObjects:@"Hi there",@"Olá",@"你好",@"今日は",nil];
NSUInteger i;
for (i=0; i<[encodings count]; i++) {
ASIWebPageRequest *request = [ASIWebPageRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://allseeing-i.com/ASIHTTPRequest/tests/asiwebpagerequest/character-encoding/%@",[encodings objectAtIndex:i]]]];
[request setUserInfo:[NSDictionary dictionaryWithObject:[expectedResponses objectAtIndex:i] forKey:@"expected-response"]];
[request setDelegate:self];
[request setUrlReplacementMode:ASIReplaceExternalResourcesWithLocalURLs];
[request startAsynchronous];
}
}
- (void)requestFinished:(ASIHTTPRequest *)request
{
if ([[request userInfo] objectForKey:@"expected-response"]) {
BOOL success = ([[request responseString] rangeOfString:[[request userInfo] objectForKey:@"expected-response"]].location != NSNotFound);
GHAssertTrue(success,@"Response HTML used wrong encoding");
}
}
- (void)requestFailed:(ASIHTTPRequest *)request
{
GHAssertNil([request error],@"Request failed, cannot proceed with test");
}
@end