Beispiel #1
0
func TestTimerWidgetConstructor(t *testing.T) {
	Convey("Given two channels", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		Convey("When timer is created", func() {
			w := i3status.NewTimerWidget()
			w.SetChannels(c, i)
			Convey("output channel is available", func() {
				So(w.Output, ShouldEqual, c)
			})
		})
	})
}
Beispiel #2
0
func TestTimerWidgetStartEvent(t *testing.T) {
	Convey("Given A timer widget", t, func() {
		c := make(chan i3status.Message)
		i := make(chan i3status.Entry)
		w := i3status.NewTimerWidget()
		w.SetChannels(c, i)
		w.Start()
		Convey("When a left click event is received", func() {
			msg := <-c
			i <- i3status.Entry{"Timer", "0", 1, 0, 0}
			time.Sleep(1)
			Convey("timer status is started", func() {
				So(w.Status, ShouldContainSubstring, "started")
				msg = <-c
				So(msg.FullText, ShouldContainSubstring, "started")
			})
		})
	})
}
Beispiel #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 + ",")
	}

}