SubTimelineFixerHelperEx_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: "Foundation (2021) - S01E09", args: args{
  23. videoFileFullPath: "XLen:\\连续剧\\Foundation (2021)\\Season 1\\Foundation (2021) - S01E09 - The First Crisis WEBDL-1080p.mkv",
  24. 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"},
  25. wantErr: false,
  26. },
  27. {
  28. name: "Foundation (2021) - S01E09", args: args{
  29. videoFileFullPath: "XLen:\\连续剧\\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. s := NewSubTimelineFixerHelperEx(config.GetConfig().SubTimelineFixerConfig)
  35. s.Check()
  36. for _, tt := range tests {
  37. t.Run(tt.name, func(t *testing.T) {
  38. if err := s.Process(tt.args.videoFileFullPath, tt.args.srcSubFPath); (err != nil) != tt.wantErr {
  39. t.Errorf("Process() error = %v, wantErr %v", err, tt.wantErr)
  40. }
  41. })
  42. }
  43. }