-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgomontage_test.go
More file actions
106 lines (92 loc) · 2.12 KB
/
gomontage_test.go
File metadata and controls
106 lines (92 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package gomontage
import (
"testing"
"time"
)
func TestNewTimeline(t *testing.T) {
tl := NewTimeline(TimelineConfig{
Width: 1920,
Height: 1080,
FPS: 30,
})
cfg := tl.Config()
if cfg.Width != 1920 || cfg.Height != 1080 || cfg.FPS != 30 {
t.Errorf("unexpected config: %+v", cfg)
}
}
func TestAt(t *testing.T) {
result := At(5 * time.Second)
if result != 5*time.Second {
t.Errorf("At(5s) = %v, want 5s", result)
}
}
func TestHD(t *testing.T) {
cfg := HD()
if cfg.Width != 1920 || cfg.Height != 1080 || cfg.FPS != 30 {
t.Errorf("HD() = %+v, want 1920x1080@30", cfg)
}
}
func TestHD60(t *testing.T) {
cfg := HD60()
if cfg.Width != 1920 || cfg.Height != 1080 || cfg.FPS != 60 {
t.Errorf("HD60() = %+v, want 1920x1080@60", cfg)
}
}
func TestUHD(t *testing.T) {
cfg := UHD()
if cfg.Width != 3840 || cfg.Height != 2160 || cfg.FPS != 30 {
t.Errorf("UHD() = %+v, want 3840x2160@30", cfg)
}
}
func TestUHD60(t *testing.T) {
cfg := UHD60()
if cfg.Width != 3840 || cfg.Height != 2160 || cfg.FPS != 60 {
t.Errorf("UHD60() = %+v, want 3840x2160@60", cfg)
}
}
func TestVertical(t *testing.T) {
cfg := Vertical()
if cfg.Width != 1080 || cfg.Height != 1920 || cfg.FPS != 30 {
t.Errorf("Vertical() = %+v, want 1080x1920@30", cfg)
}
}
func TestSquare(t *testing.T) {
cfg := Square()
if cfg.Width != 1080 || cfg.Height != 1080 || cfg.FPS != 30 {
t.Errorf("Square() = %+v, want 1080x1080@30", cfg)
}
}
func TestSeconds(t *testing.T) {
tests := []struct {
input float64
want time.Duration
}{
{1.0, 1 * time.Second},
{0.5, 500 * time.Millisecond},
{5.5, 5*time.Second + 500*time.Millisecond},
{0.0, 0},
{60.0, 1 * time.Minute},
}
for _, tt := range tests {
got := Seconds(tt.input)
if got != tt.want {
t.Errorf("Seconds(%v) = %v, want %v", tt.input, got, tt.want)
}
}
}
func TestMinutes(t *testing.T) {
tests := []struct {
input float64
want time.Duration
}{
{1.0, 1 * time.Minute},
{2.5, 2*time.Minute + 30*time.Second},
{0.0, 0},
}
for _, tt := range tests {
got := Minutes(tt.input)
if got != tt.want {
t.Errorf("Minutes(%v) = %v, want %v", tt.input, got, tt.want)
}
}
}