-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
86 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@testable import KSPlayer | ||
import XCTest | ||
class SubtitleTest: XCTestCase { | ||
func testSrt() { | ||
let string = """ | ||
1 | ||
00:00:00,050 --> 00:00:11,000 | ||
<font color="#4096d1">本字幕仅供学习交流,严禁用于商业用途</font> | ||
2 | ||
00:00:13,000 --> 00:00:18,000 | ||
<font color=#4096d1>-=破烂熊字幕组=- | ||
翻译:风铃 | ||
校对&时间轴:小白</font> | ||
3 | ||
00:01:00,840 --> 00:01:02,435 | ||
你现在必须走了吗? | ||
4 | ||
00:01:02,680 --> 00:01:04,318 | ||
我说过我会去找他的 | ||
5 | ||
00:01:07,194 --> 00:01:08,239 | ||
- 很多事情我们都说过 | ||
- 我承诺过他 | ||
6 | ||
00:01:08,280 --> 00:01:10,661 | ||
我希望你明白 | ||
7 | ||
00:01:12,814 --> 00:01:14,702 | ||
等等! 你是不可能活着回来的! | ||
""" | ||
let scanner = Scanner(string: string) | ||
let parse = SrtParse() | ||
XCTAssertEqual(parse.canParse(scanner: scanner), true) | ||
let parts = parse.parse(scanner: scanner) | ||
XCTAssertEqual(parts.count, 7) | ||
} | ||
} |