2018-05-08 00:44:32 +08:00
|
|
|
package align
|
|
|
|
|
2019-02-25 04:44:13 +08:00
|
|
|
import "testing"
|
2018-05-08 00:44:32 +08:00
|
|
|
|
2019-02-25 04:44:13 +08:00
|
|
|
func TestHorizontal(t *testing.T) {
|
2018-05-08 00:44:32 +08:00
|
|
|
tests := []struct {
|
2019-02-25 04:44:13 +08:00
|
|
|
desc string
|
|
|
|
align Horizontal
|
|
|
|
want string
|
2018-05-08 00:44:32 +08:00
|
|
|
}{
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "unknown",
|
|
|
|
align: Horizontal(-1),
|
|
|
|
want: "HorizontalUnknown",
|
2018-05-08 00:44:32 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "left",
|
|
|
|
align: HorizontalLeft,
|
|
|
|
want: "HorizontalLeft",
|
2018-05-08 00:44:32 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "center",
|
|
|
|
align: HorizontalCenter,
|
|
|
|
want: "HorizontalCenter",
|
2018-05-08 00:44:32 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "right",
|
|
|
|
align: HorizontalRight,
|
|
|
|
want: "HorizontalRight",
|
2018-05-08 00:44:32 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range tests {
|
|
|
|
t.Run(tc.desc, func(t *testing.T) {
|
2019-02-25 04:44:13 +08:00
|
|
|
if got := tc.align.String(); got != tc.want {
|
|
|
|
t.Errorf("String => %q, want %q", got, tc.want)
|
2018-05-08 00:44:32 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2018-05-08 03:32:14 +08:00
|
|
|
|
2019-02-25 04:44:13 +08:00
|
|
|
func TestVertical(t *testing.T) {
|
2018-05-08 03:32:14 +08:00
|
|
|
tests := []struct {
|
2019-02-25 04:44:13 +08:00
|
|
|
desc string
|
|
|
|
align Vertical
|
|
|
|
want string
|
2018-05-08 03:32:14 +08:00
|
|
|
}{
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "unknown",
|
|
|
|
align: Vertical(-1),
|
|
|
|
want: "VerticalUnknown",
|
2018-05-08 03:32:14 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "top",
|
|
|
|
align: VerticalTop,
|
|
|
|
want: "VerticalTop",
|
2018-05-08 03:32:14 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "middle",
|
|
|
|
align: VerticalMiddle,
|
|
|
|
want: "VerticalMiddle",
|
2018-05-08 03:32:14 +08:00
|
|
|
},
|
|
|
|
{
|
2019-02-25 04:44:13 +08:00
|
|
|
desc: "bottom",
|
|
|
|
align: VerticalBottom,
|
|
|
|
want: "VerticalBottom",
|
2018-05-08 03:32:14 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range tests {
|
|
|
|
t.Run(tc.desc, func(t *testing.T) {
|
2019-02-25 04:44:13 +08:00
|
|
|
if got := tc.align.String(); got != tc.want {
|
|
|
|
t.Errorf("String => %q, want %q", got, tc.want)
|
2018-05-08 03:32:14 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|