]> granicus.if.org Git - handbrake/commitdiff
MacGui: add some subtitles tracks to the fake title used in tests.
authorDamiano Galassi <damiog@gmail.com>
Wed, 28 Oct 2015 07:14:08 +0000 (08:14 +0100)
committerDamiano Galassi <damiog@gmail.com>
Wed, 28 Oct 2015 07:14:08 +0000 (08:14 +0100)
macosx/HandBrake Tests/HBJobTests.m
macosx/HandBrake Tests/HBMockTitle.h
macosx/HandBrake Tests/HBMockTitle.m

index c5044b7a60f4ee179fc5954fcb97eb250e721b5a..ddcb28a8688f644e32fd4e6e000d75382f51624a 100644 (file)
@@ -66,7 +66,7 @@
 
 - (void)testAudio
 {
-    XCTAssertEqual(self.job.audio.tracks.count, 2);
+    XCTAssertGreaterThan(self.job.audio.tracks.count, 1);
 }
 
 - (void)testPictureSize
index ee1f87a6232b7ae6dfe0efec9fdc11d2013fe9dd..e83a13ad225f6005cef657762cb6cc33d9e6c331 100644 (file)
@@ -1,10 +1,8 @@
-//
-//  HBMockTitle.h
-//  HandBrake
-//
-//  Created by Damiano Galassi on 30/05/15.
-//
-//
+/*  HBMockTitle
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
 
 #import <Foundation/Foundation.h>
 #import "HBTitle.h"
index 9cfd374a3f2a0ece29f66f1ef585dbf1aaff9019..217f56bfc9984c508aa3eb029b1186e6eac387fa 100644 (file)
@@ -1,10 +1,8 @@
-//
-//  HBMockTitle.m
-//  HandBrake
-//
-//  Created by Damiano Galassi on 30/05/15.
-//
-//
+/*  HBMockTitle
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
 
 #import "HBMockTitle.h"
 #import "HBChapter.h"
@@ -119,48 +117,36 @@ extern NSString *keySubTrackType;
 {
     NSMutableArray *tracks = [NSMutableArray array];
     [tracks addObject: @{keyAudioTrackIndex: @1,
-                         keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", 1, "English"],
+                         keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", 0, "English"],
                          keyAudioInputBitrate: @104,
                          keyAudioInputSampleRate: @48000,
                          keyAudioInputCodec: @65536,
                          keyAudioInputCodecParam: @86018,
                          keyAudioInputChannelLayout: @3,
                          keyAudioTrackLanguageIsoCode: @"eng"}];
+
+    [tracks addObject: @{keyAudioTrackIndex: @2,
+                         keyAudioTrackName: [NSString stringWithFormat: @"%d: %s", 1, "Italian"],
+                         keyAudioInputBitrate: @104,
+                         keyAudioInputSampleRate: @48000,
+                         keyAudioInputCodec: @65536,
+                         keyAudioInputCodecParam: @86018,
+                         keyAudioInputChannelLayout: @3,
+                         keyAudioTrackLanguageIsoCode: @"ita"}];
     return [tracks copy];
 }
 
 - (NSArray *)subtitlesTracks
 {
-    /*if (!_subtitlesTracks)
-    {
-        NSMutableArray *tracks = [NSMutableArray array];
-        hb_subtitle_t *subtitle;
-        hb_list_t *list = self.hb_title->list_subtitle;
-        int count = hb_list_count(list);
-
-        for (int i = 0; i < count; i++)
-        {
-            subtitle = (hb_subtitle_t *) hb_list_item(self.hb_title->list_subtitle, i);
-
-            // Human-readable representation of subtitle->source
-            NSString *bitmapOrText  = subtitle->format == PICTURESUB ? @"Bitmap" : @"Text";
-            NSString *subSourceName = @(hb_subsource_name(subtitle->source));
-
-            // Use the native language name if available
-            iso639_lang_t *language = lang_for_code2(subtitle->iso639_2);
-            NSString *nativeLanguage = strlen(language->native_name) ? @(language->native_name) : @(language->eng_name);
-
-            // create a dictionary of source subtitle information to store in our array
-            [tracks addObject:@{keySubTrackName: [NSString stringWithFormat:@"%d: %@ (%@) (%@)", i, nativeLanguage, bitmapOrText, subSourceName],
-                                keySubTrackType: @(subtitle->source),
-                                keySubTrackLanguage: nativeLanguage,
-                                keySubTrackLanguageIsoCode: @(subtitle->iso639_2)}];
-        }
-
-        _subtitlesTracks = [tracks copy];
-    }*/
-
-    return nil;
+    NSMutableArray *tracks = [NSMutableArray array];
+    NSString *nativeLanguage = @"English";
+
+    // create a dictionary of source subtitle information to store in our array
+    [tracks addObject:@{keySubTrackName: [NSString stringWithFormat:@"%d: %@ (%@) (%@)", 0, nativeLanguage, @"Bitmap", @"VobSub"],
+                        keySubTrackType: @0,
+                        keySubTrackLanguageIsoCode: @"eng"}];
+
+    return [tracks copy];
 }
 
 - (NSArray<HBChapter *> *)chapters