Esempio n. 1
0
func TestOnOffWidgetConstructor(t *testing.T) {
	Convey("Given an input and an output channel", t, func() {
		bar := i3status.NewBar()
		Convey("When OnOff is created", func() {
			w := i3status.NewOnOffWidget()
			bar.Add(w)
			Convey("output channel is available", func() {
				So(w.Output, ShouldEqual, bar.Input)
			})
		})
	})
}
Esempio n. 2
0
func TestOnOffWidget(t *testing.T) {
	Convey("Given an OnOff Widget", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		w := i3status.NewOnOffWidget()
		w.SetChannels(c, i)
		w.Start()
		Convey("When an entry is sent", func() {
			w.Input <- i3status.Entry{Name: "OnOff"}
			Convey("widget status goes off", func() {
				So(w.On, ShouldEqual, false)
			})
		})
	})
}
Esempio n. 3
0
func TestOnOffWidgetMessage(t *testing.T) {
	Convey("Given an OnOff Widget", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		w := i3status.NewOnOffWidget()
		w.SetChannels(c, i)
		w.Start()
		Convey("When and entry is sent", func() {
			msg := <-c
			So(msg.FullText, ShouldEqual, "Pants On")
			w.Input <- i3status.Entry{Name: "OnOff"}
			Convey("widget message is Off", func() {
				msg = <-c
				So(msg.FullText, ShouldEqual, "Pants Off")
			})
		})
	})
}
Esempio n. 4
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 + ",")
	}

}