Example #1
0
func TestWlanWidgetConstructor(t *testing.T) {
	Convey("Given two channels", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		Convey("When wlan is created", func() {
			w := i3status.NewWlanWidget()
			w.SetChannels(c, i)
			Convey("output channel is available", func() {
				So(w.Output, ShouldEqual, c)
			})
		})
	})
}
Example #2
0
func TestWlanWidgetHasMessage(t *testing.T) {
	Convey("Given a widget", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		w := i3status.NewWlanWidget()
		w.SetChannels(c, i)
		Convey("When wlan is started", func() {
			w.Start()
			Convey("output message is available", func() {
				msg := <-c
				So(msg.FullText, ShouldContainSubstring, "WLAN")
			})
		})
	})
}
Example #3
0
func main() {

	/*
		go func() {
			for {
				fmt.Println("{\"name\":\"testiii\",\"full_text\":\"ciao\"}")
				time.Sleep(1 * time.Second)
			}
		}()

		go func() {
			var i int
			for {
				fmt.Scanf("%d", &i)
				fmt.Println(i)
			}
		}()
	*/
	fmt.Println(`{"version":1,"click_events": true}`)
	fmt.Println("[")
	b := i3status.NewBar()

	b.Add(i3status.NewDateWidget())
	b.Add(i3status.NewTimerWidget())
	b.Add(i3status.NewPowerWidget())
	b.Add(i3status.NewOnOffWidget())
	b.Add(i3status.NewWlanWidget())
	b.Add(i3status.NewWeatherWidget())
	//b.Add(i3status.NewI3statusWidget())
	//b.Add(i3status.NewEchoWidget())

	for {
		m := <-b.Output
		fmt.Println(m + ",")
	}

}