SubTimelineFixerHelperEx_test.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package sub_timeline_fixer
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/pkg/settings"
  4. "github.com/allanpk716/ChineseSubFinder/internal/pkg/unit_test_helper"
  5. "path/filepath"
  6. "testing"
  7. )
  8. // TODO 暂不方便在其他环境进行单元测试
  9. func TestSubTimelineFixerHelperEx_Check(t *testing.T) {
  10. //if NewSubTimelineFixerHelperEx(config.GetConfig().SubTimelineFixerConfig).Check() == false {
  11. // t.Fatal("Need Install FFMPEG")
  12. //}
  13. }
  14. // TODO 暂不方便在其他环境进行单元测试
  15. func TestSubTimelineFixerHelperEx_Process(t *testing.T) {
  16. rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"sub_timeline_fixer"}, 4, true)
  17. type args struct {
  18. videoFileFullPath string
  19. srcSubFPath string
  20. }
  21. tests := []struct {
  22. name string
  23. args args
  24. wantErr bool
  25. }{
  26. {
  27. name: "Foundation (2021) - S01E09", args: args{
  28. videoFileFullPath: "X:\\连续剧\\Foundation (2021)\\Season 1\\Foundation (2021) - S01E09 - The First Crisis WEBDL-1080p.mkv",
  29. srcSubFPath: filepath.Join(rootDir, "series", "Foundation (2021)", "Season 1", "Foundation (2021) - S01E09 - The First Crisis WEBDL-1080p.chinese(简英,zimuku).ass")},
  30. wantErr: false,
  31. },
  32. }
  33. s := NewSubTimelineFixerHelperEx(*settings.NewTimelineFixerSettings())
  34. s.Check()
  35. for _, tt := range tests {
  36. t.Run(tt.name, func(t *testing.T) {
  37. if err := s.Process(tt.args.videoFileFullPath, tt.args.srcSubFPath); (err != nil) != tt.wantErr {
  38. t.Errorf("Process() error = %v, wantErr %v", err, tt.wantErr)
  39. }
  40. })
  41. }
  42. }