// TestDrawTitle checks that the title would be properly drawn at the top-
// center of the screen.
TestDrawTitle checks that the title would be properly drawn at the top
center of the screen.
// TestDrawTitle checks that the title would be properly drawn at the top - // center of the screen .
func TestDrawTitle(t *testing.T) {
	s := NewMockScreen(10, 3)
	Title(s, "test")
	fail := false
	if actual := s.pixels[0][3].mainc; actual != 't' {
		t.Errorf(`pixel = %v, want t`, actual)
		fail = true
	}
	if actual := s.pixels[0][4].mainc; actual != 'e' {
		t.Errorf(`pixel = %v, want e`, actual)
		fail = true
	}
	if actual := s.pixels[0][5].mainc; actual != 's' {
		t.Errorf(`pixel = %v, want s`, actual)
		fail = true
	}
	if actual := s.pixels[0][6].mainc; actual != 't' {
		t.Errorf(`pixel = %v, want t`, actual)
		fail = true
	}
	if fail {
		width, _ := s.Size()
		titleRow := make([]rune, width)
		for i := range titleRow {
			titleRow[i] = s.pixels[0][i].mainc
		}
		t.Fatalf(`Title row = %q`, string(titleRow))
	}
}
func TestDrawTitle ( t * testing . T ) { s := NewMockScreen ( 10 , 3 ) Title ( s , " " ) fail := false if actual := s . pixels [ 0 ] [ 3 ] . mainc ; actual != 't' { t . Errorf ( `pixel = %v, want t` , actual ) fail = true } if actual := s . pixels [ 0 ] [ 4 ] . mainc ; actual != 'e' { t . Errorf ( `pixel = %v, want e` , actual ) fail = true } if actual := s . pixels [ 0 ] [ 5 ] . mainc ; actual != 's' { t . Errorf ( `pixel = %v, want s` , actual ) fail = true } if actual := s . pixels [ 0 ] [ 6 ] . mainc ; actual != 't' { t . Errorf ( `pixel = %v, want t` , actual ) fail = true } if fail { width , _ := s . Size ( ) titleRow := make ( [ ] rune , width ) for i := range titleRow { titleRow [ i ] = s . pixels [ 0 ] [ i ] . mainc } t . Fatalf ( `Title row = %q` , string ( titleRow ) ) } }
TestDrawTitle checks that the title would be properly drawn at the top
center of the screen.
TestDrawTitle checks that the title would be properly drawn at the top center of the screen .