diff options
author | ritsuka <[email protected]> | 2015-06-01 17:20:43 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-06-01 17:20:43 +0000 |
commit | 876f1f8cafd3510cb04f022f004610e39d50dbc8 (patch) | |
tree | 8fb00efa2f170d03eb96b7859a9a6605f4d8b6f9 /macosx/HandBrake Tests/HBJobTests.m | |
parent | c0cb605ff2e3fff65db994506df8f6f7253b5ad8 (diff) |
MacGui: split HBTitle header to make it easier to test. Added some simple tests.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7256 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HandBrake Tests/HBJobTests.m')
-rw-r--r-- | macosx/HandBrake Tests/HBJobTests.m | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/macosx/HandBrake Tests/HBJobTests.m b/macosx/HandBrake Tests/HBJobTests.m index e12f3ef10..c63fce273 100644 --- a/macosx/HandBrake Tests/HBJobTests.m +++ b/macosx/HandBrake Tests/HBJobTests.m @@ -7,7 +7,10 @@ #import <Cocoa/Cocoa.h> #import <XCTest/XCTest.h> +#import "HBMockTitle.h" #import "HBJob.h" +#import "HBPicture.h" +#import "HBJob+UIAdditions.h" #import "HBPresetsManager.h" #import "HBPreset.h" @@ -15,28 +18,74 @@ @property (nonatomic, readonly) HBPresetsManager *manager; +@property (nonatomic, readwrite) HBPreset *preset; +@property (nonatomic, readwrite) HBTitle *title; +@property (nonatomic, readwrite) HBJob *job; + @end @implementation HBJobTests -- (void)setUp { +- (void)setUp +{ [super setUp]; _manager = [[HBPresetsManager alloc] init]; [_manager generateBuiltInPresets]; - // Put setup code here. This method is called before the invocation of each test method in the class. + self.preset = self.manager.defaultPreset; + + self.title = [[HBMockTitle alloc] init]; + + self.job = [[HBJob alloc] initWithTitle:self.title andPreset:self.preset]; + self.job.destURL = [NSURL fileURLWithPath:@"/Dest.mp4"]; } -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. +- (void)tearDown +{ [super tearDown]; } -- (void)testJobCreation { +- (void)testJobCreation +{ HBJob *job = [[HBJob alloc] init]; XCTAssert(job, @"Pass"); } +- (void)testApplyPreset +{ + HBMockTitle *title = [[HBMockTitle alloc] init]; + HBPreset *preset = self.manager.defaultPreset; + + HBJob *job = [[HBJob alloc] initWithTitle:title andPreset:preset]; + job.destURL = [NSURL fileURLWithPath:@"/Dest.mp4"]; + + [job applyPreset:preset]; +} + +- (void)testAudio +{ + XCTAssertEqual(self.job.audio.tracks.count, 2); +} + +- (void)testPictureSize +{ + XCTAssertEqual(self.job.picture.width, 1254); + XCTAssertEqual(self.job.picture.height, 678); +} + +- (void)testAutoCrop +{ + XCTAssertEqual([self.preset.content[@"PictureAutoCrop"] boolValue], self.job.picture.autocrop); +} + +- (void)testAutoCropValues +{ + XCTAssertEqual(self.title.autoCropTop, self.job.picture.cropTop); + XCTAssertEqual(self.title.autoCropBottom, self.job.picture.cropBottom); + XCTAssertEqual(self.title.autoCropLeft, self.job.picture.cropLeft); + XCTAssertEqual(self.title.autoCropRight, self.job.picture.cropRight); +} + @end |