1
0

SubTimelineFixerHelperEx_test.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package sub_timeline_fixer
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/pkg/config"
  4. "testing"
  5. )
  6. func TestSubTimelineFixerHelperEx_Check(t *testing.T) {
  7. if NewSubTimelineFixerHelperEx(config.GetConfig().SubTimelineFixerConfig).Check() == false {
  8. t.Fatal("Need Install FFMPEG")
  9. }
  10. }
  11. func TestSubTimelineFixerHelperEx_Process(t *testing.T) {
  12. type args struct {
  13. videoFileFullPath string
  14. srcSubFPath string
  15. }
  16. tests := []struct {
  17. name string
  18. args args
  19. wantErr bool
  20. }{
  21. {
  22. name: "R&M S05E01", args: args{
  23. videoFileFullPath: "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 5\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p.mkv",
  24. srcSubFPath: "C:\\WorkSpace\\Go2Hell\\src\\github.com\\allanpk716\\ChineseSubFinder\\internal\\logic\\sub_timeline_fixer\\CSF-SubFixCache\\Rick and Morty - S05E01 - Mort Dinner Rick Andre WEBDL-1080p\\R&M S05E01 - 简.ass"},
  25. wantErr: false,
  26. },
  27. {
  28. name: "Foundation (2021) - S01E09", args: args{
  29. videoFileFullPath: "X:\\连续剧\\Foundation (2021)\\Season 1\\Foundation (2021) - S01E09 - The First Crisis WEBDL-1080p.mkv",
  30. srcSubFPath: "C:\\WorkSpace\\Go2Hell\\src\\github.com\\allanpk716\\ChineseSubFinder\\internal\\logic\\sub_timeline_fixer\\CSF-SubFixCache\\Foundation (2021) - S01E09 - The First Crisis WEBDL-1080p\\chinese(简英,zimuku).default.ass"},
  31. wantErr: false,
  32. },
  33. {
  34. name: "The Night House (2021)", args: args{
  35. videoFileFullPath: "X:\\TestMovie\\The Night House (2021)\\The Night House (2021) Bluray-1080p.mkv",
  36. srcSubFPath: "X:\\TestMovie\\The Night House (2021)\\The Night House (2021) Bluray-1080p.chinese(简英,zimuku).ass"},
  37. wantErr: false,
  38. },
  39. {
  40. name: "龙猫 (1988)", args: args{
  41. videoFileFullPath: "X:\\电影\\龙猫 (1988)\\龙猫 (1988) 1080p DTS.mkv",
  42. srcSubFPath: "X:\\电影\\龙猫 (1988)\\龙猫 (1988) 1080p DTS.chinese(简,zimuku).ass"},
  43. wantErr: false,
  44. },
  45. {
  46. name: "千与千寻 (2001)", args: args{
  47. videoFileFullPath: "X:\\电影\\千与千寻 (2001)\\千与千寻 (2001) 1080p Opus.mkv",
  48. srcSubFPath: "X:\\电影\\千与千寻 (2001)\\千与千寻 (2001) 1080p Opus.chinese(简英,zimuku).ass"},
  49. wantErr: false,
  50. },
  51. }
  52. s := NewSubTimelineFixerHelperEx(config.GetConfig().SubTimelineFixerConfig)
  53. s.Check()
  54. for _, tt := range tests {
  55. t.Run(tt.name, func(t *testing.T) {
  56. if err := s.Process(tt.args.videoFileFullPath, tt.args.srcSubFPath); (err != nil) != tt.wantErr {
  57. t.Errorf("Process() error = %v, wantErr %v", err, tt.wantErr)
  58. }
  59. })
  60. }
  61. }