| 665 | } |
| 666 | |
| 667 | func TestTimezoneEXIFCorrection(t *testing.T) { |
| 668 | // Test that we get UTC times for photos taken in two |
| 669 | // different timezones. |
| 670 | // Both only have local time + GPS in the exif. |
| 671 | tests := []struct { |
| 672 | file, want, wantUTC string |
| 673 | }{ |
| 674 | {"coffee-sf.jpg", "2014-07-11 08:44:34 -0700 PDT", "2014-07-11 15:44:34 +0000 UTC"}, |
| 675 | {"gocon-tokyo.jpg", "2014-05-31 13:34:04 +0900 JST", "2014-05-31 04:34:04 +0000 UTC"}, |
| 676 | } |
| 677 | for _, tt := range tests { |
| 678 | f, err := os.Open("testdata/" + tt.file) |
| 679 | if err != nil { |
| 680 | t.Fatal(err) |
| 681 | } |
| 682 | // Hide *os.File type from FileTime, so it can't use modtime: |
| 683 | tm, err := FileTime(struct{ io.ReaderAt }{f}) |
| 684 | f.Close() |
| 685 | if err != nil { |
| 686 | t.Errorf("%s: %v", tt.file, err) |
| 687 | continue |
| 688 | } |
| 689 | if got := tm.String(); got != tt.want { |
| 690 | t.Errorf("%s: time = %q; want %q", tt.file, got, tt.want) |
| 691 | } |
| 692 | if got := tm.UTC().String(); got != tt.wantUTC { |
| 693 | t.Errorf("%s: utc time = %q; want %q", tt.file, got, tt.wantUTC) |
| 694 | } |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | func TestLargeDirs(t *testing.T) { |
| 699 | oldMaxStaticSetMembers := maxStaticSetMembers |