-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlocation_test.go
39 lines (31 loc) · 988 Bytes
/
location_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
package main
import (
"strings"
"testing"
"time"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/test"
"github.com/stretchr/testify/assert"
)
func TestNewLocation(t *testing.T) {
n := &nomad{}
c := newCity("Test", "Country", photo{}, time.UTC)
l := newLocation(c, n, container.NewWithoutLayout())
_ = test.WidgetRenderer(l)
utc := time.Now().In(time.UTC)
assert.Equal(t, utc.Format("15:04"), l.timeButton.Text)
assert.True(t, strings.Contains(l.locationTZLabel.Text, " UTC"))
}
func TestLocation_PickTime(t *testing.T) {
n := &nomad{}
c := newCity("Test", "Country", photo{}, time.UTC)
l := newLocation(c, n, container.NewWithoutLayout())
_ = test.WidgetRenderer(l)
zone, _ := time.LoadLocation("EST")
inEST := newCity("City", "America", photo{}, zone)
l2 := newLocation(inEST, n, l.homeContainer)
_ = test.WidgetRenderer(l2)
l.homeContainer.Objects = append(l.homeContainer.Objects, l2)
l.onTimeSelect("12:00")
assert.Equal(t, "07:00", l2.timeButton.Text)
}