-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjust_test.go
More file actions
76 lines (67 loc) · 1.63 KB
/
Copy pathadjust_test.go
File metadata and controls
76 lines (67 loc) · 1.63 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
package pixo
import (
"testing"
)
func TestAdjustBrightness(t *testing.T) {
src := testImage(50, 50)
result := AdjustBrightness(src, 50)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
// Brighter image should have higher pixel values
orig := src.NRGBAAt(25, 25)
mod := result.NRGBAAt(25, 25)
if mod.R <= orig.R && orig.R < 128 {
t.Errorf("expected brighter: orig R=%d, mod R=%d", orig.R, mod.R)
}
}
func TestAdjustContrast(t *testing.T) {
src := testImage(50, 50)
result := AdjustContrast(src, 50)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustGamma(t *testing.T) {
src := testImage(50, 50)
result := AdjustGamma(src, 2.0)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustGammaInvalid(t *testing.T) {
src := testImage(50, 50)
result := AdjustGamma(src, 0)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustSaturation(t *testing.T) {
src := testImage(50, 50)
result := AdjustSaturation(src, -50)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustSigmoid(t *testing.T) {
src := testImage(50, 50)
result := AdjustSigmoid(src, 0.5, 5)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustHue(t *testing.T) {
src := testImage(50, 50)
result := AdjustHue(src, 90)
if result.Bounds().Dx() != 50 {
t.Errorf("unexpected dimensions")
}
}
func TestAdjustNil(t *testing.T) {
AdjustBrightness(nil, 50)
AdjustContrast(nil, 50)
AdjustGamma(nil, 2.0)
AdjustSaturation(nil, 50)
AdjustSigmoid(nil, 0.5, 5)
AdjustHue(nil, 90)
}