Exemple #1
0
func TestPowerWidgetConstructor(t *testing.T) {
	Convey("Given two channels", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		Convey("When power is created", func() {
			w := i3status.NewPowerWidget()
			w.SetChannels(c, i)
			Convey("output channel is available", func() {
				So(w.Output, ShouldEqual, c)
			})
		})
	})
}
Exemple #2
0
func TestPowerWidgetHasMessage(t *testing.T) {
	Convey("Given a widget", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		w := i3status.NewPowerWidget()
		w.SetChannels(c, i)
		Convey("When power is started", func() {
			w.Start()
			Convey("output message is available", func() {
				msg := <-c
				So(msg.FullText, ShouldContainSubstring, "BAT")
			})
		})
	})
}
Exemple #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 + ",")
	}

}