Newer
Older
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
package particles
import (
"project-particles/config"
"testing"
)
// Test fonction decrease de 1 par 1
func Test_Decrease_by_1(t *testing.T) {
config.General.Opacity_Increment = 1
p1 := Particle{
PositionX: 0,
PositionY: 0,
SpeedX: 1,
SpeedY: 1,
ScaleX: 1, ScaleY: 1,
ColorRed: 1, ColorGreen: 1, ColorBlue: 1,
Opacity: 1,
}
previous_opacity := p1.Opacity
Decrease_Opacity(&p1)
if p1.Opacity != previous_opacity-1 {
t.Error("L'opacité n'est pas correctement mise à jour, différence :", previous_opacity-p1.Opacity)
}
}
// Test fonction decrease de 5 par 5
func Test_Decrease_by_5(t *testing.T) {
config.General.Opacity_Increment = 5
p1 := Particle{
PositionX: 0,
PositionY: 0,
SpeedX: 1,
SpeedY: 1,
ScaleX: 1, ScaleY: 1,
ColorRed: 1, ColorGreen: 1, ColorBlue: 1,
Opacity: 1,
}
previous_opacity := p1.Opacity
Decrease_Opacity(&p1)
if p1.Opacity != previous_opacity-5 {
t.Error("L'opacité n'est pas correctement mise à jour, différence :", previous_opacity-p1.Opacity)
}
}
// Test fonction decrease de -1 par -1
func Test_Decrease_by_Negative_1(t *testing.T) {
config.General.Opacity_Increment = -1
p1 := Particle{
PositionX: 0,
PositionY: 0,
SpeedX: 1,
SpeedY: 1,
ScaleX: 1, ScaleY: 1,
ColorRed: 1, ColorGreen: 1, ColorBlue: 1,
Opacity: 1,
}
previous_opacity := p1.Opacity
Decrease_Opacity(&p1)
if p1.Opacity != previous_opacity+1 {
t.Error("L'opacité n'est pas correctement mise à jour, différence :", previous_opacity-p1.Opacity)
}
}