-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager_test.go
More file actions
75 lines (71 loc) · 1.41 KB
/
manager_test.go
File metadata and controls
75 lines (71 loc) · 1.41 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
package main
import (
"encoding/json"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestModFilter(t *testing.T) {
Convey("Test mod filter", t, func() {
So(filterInvalidMod("control-mod1-mod2"), ShouldEqual, "control-mod1")
})
}
func TestOutputConfig(t *testing.T) {
Convey("Test output config parse", t, func() {
infos, err := newOutputInfosFromFile("testdata/outputs.json")
So(err, ShouldBeNil)
So(len(infos), ShouldEqual, 3)
var target = []OutputInfo{
{
Name: "eDP-1",
X: 0,
Y: 0,
Width: 1024,
Height: 768,
},
{
Name: "VGA-1",
X: 1024,
Y: 0,
Width: 1024,
Height: 768,
},
{
Name: "HDMI-1",
X: 2048,
Y: 0,
Width: 1024,
Height: 768,
},
}
data1, _ := json.Marshal(infos)
data2, _ := json.Marshal(target)
So(string(data1), ShouldEqual, string(data2))
})
}
func TestAppConfig(t *testing.T) {
Convey("Test app config parse", t, func() {
infos, err := newOutputInfosFromFile("testdata/apps.json")
So(err, ShouldBeNil)
So(len(infos), ShouldEqual, 3)
var target = []OutputInfo{
{
Name: "app1",
X: 0,
Y: 0,
},
{
Name: "app2",
X: 1024,
Y: 0,
},
{
Name: "app3",
X: 2048,
Y: 0,
},
}
data1, _ := json.Marshal(infos)
data2, _ := json.Marshal(target)
So(string(data1), ShouldEqual, string(data2))
})
}