-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathcontents_test.go
62 lines (49 loc) · 1.27 KB
/
contents_test.go
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
package main
import (
. "gopkg.in/check.v1"
)
type ContentsSuite struct {
}
var _ = Suite(&ContentsSuite{})
func (cs *ContentsSuite) Test_should_build_filename(c *C) {
ci := ContentsImage{}
fname := ci.BuildFilename("base", Rect{42, 24})
c.Check(fname, Equals, "[email protected]")
ci.Idiom = "iphone"
fname = ci.BuildFilename("base", Rect{42, 24})
c.Check(fname, Equals, "[email protected]")
ci.Scale = "1x"
fname = ci.BuildFilename("base", Rect{42, 24})
c.Check(fname, Equals, "[email protected]")
ci.Scale = "3x"
fname = ci.BuildFilename("base", Rect{42, 24})
c.Check(fname, Equals, "[email protected]")
}
func (cs *ContentsSuite) Test_should_get_size(c *C) {
ci := ContentsImage{}
ci.Size = "42x24"
w, h := ci.GetSize()
c.Check(w, Equals, 42.0)
c.Check(h, Equals, 24.0)
ci.Size = "27.5x24.5"
w, h = ci.GetSize()
c.Check(w, Equals, 27.5)
c.Check(h, Equals, 24.5)
ci.Size = "27x24.5"
w, h = ci.GetSize()
c.Check(w, Equals, 27.0)
c.Check(h, Equals, 24.5)
ci.Size = "27.5x24"
w, h = ci.GetSize()
c.Check(w, Equals, 27.5)
c.Check(h, Equals, 24.0)
}
func (cs *ContentsSuite) Test_should_get_scale(c *C) {
ci := ContentsImage{}
ci.Scale = "3x"
s := ci.GetScale()
c.Check(s, Equals, 3)
ci.Scale = ""
s = ci.GetScale()
c.Check(s, Equals, 1)
}