// TestDrawImage checks that a standard image fitting the screen can be drawn.
TestDrawImage checks that a standard image fitting the screen can be drawn.
// TestDrawImage checks that a standard image fitting the screen can be drawn .
func TestDrawImage(t *testing.T) {
	f, err := os.Open(getResource("black-and-transparent-2x2.png"))
	defer f.Close()
	if err != nil {
		panic(err)
	}
	i, _, err := image.Decode(f)
	if err != nil {
		panic(err)
	}
	s := NewMockScreen(4, 5)
	Image(s, conversion.RGBRunesFromImage(i), image.Point{0, 0})
	if actual, expected := s.pixels[2][1].mainc, '█'; actual != expected {
		t.Errorf(`rune @ 1, 2 = %q, want %q`, actual, expected)
	}
	if actual, expected := s.pixels[2][2].mainc, ' '; actual != expected {
		t.Errorf(`rune @ 2, 2 = %q, want %q`, actual, expected)
	}
	if actual, expected := s.pixels[3][1].mainc, ' '; actual != expected {
		t.Errorf(`rune @ 1, 3 = %q, want %q`, actual, expected)
	}
	if actual, expected := s.pixels[3][2].mainc, '█'; actual != expected {
		t.Errorf(`rune @ 2, 3 = %q, want %q`, actual, expected)
	}
	var actualForeground tcell.Color
	actualForeground, _, _ = s.pixels[2][1].style.Decompose()
	if actual := actualForeground.Hex(); actual != 0x000000 {
		t.Errorf(`foreground @ 1, 2 = %v, want %v`, actual, 0x000000)
	}
	actualForeground, _, _ = s.pixels[3][2].style.Decompose()
	if actual := actualForeground.Hex(); actual != 0x000000 {
		t.Errorf(`foreground @ 2, 3 = %v, want %v`, actual, 0x000000)
	}
}
func TestDrawImage ( t * testing . T ) { f , err := os . Open ( getResource ( " " ) ) defer f . Close ( ) if err != nil { panic ( err ) } i , _ , err := image . Decode ( f ) if err != nil { panic ( err ) } s := NewMockScreen ( 4 , 5 ) Image ( s , conversion . RGBRunesFromImage ( i ) , image . Point { 0 , 0 } ) if actual , expected := s . pixels [ 2 ] [ 1 ] . mainc , '█';  a tual !  e pected { t . Errorf ( `rune @ 1, 2 = %q, want %q` , actual , expected ) } if actual , expected := s . pixels [ 2 ] [ 2 ] . mainc , ' ' ; actual != expected { t . Errorf ( `rune @ 2, 2 = %q, want %q` , actual , expected ) } if actual , expected := s . pixels [ 3 ] [ 1 ] . mainc , ' ' ; actual != expected { t . Errorf ( `rune @ 1, 3 = %q, want %q` , actual , expected ) } if actual , expected := s . pixels [ 3 ] [ 2 ] . mainc , '█';  a tual !  e pected { t . Errorf ( `rune @ 2, 3 = %q, want %q` , actual , expected ) } var actualForeground tcell . Color actualForeground , _ , _ = s . pixels [ 2 ] [ 1 ] . style . Decompose ( ) if actual := actualForeground . Hex ( ) ; actual != 0x000000 { t . Errorf ( `foreground @ 1, 2 = %v, want %v` , actual , 0x000000 ) } actualForeground , _ , _ = s . pixels [ 3 ] [ 2 ] . style . Decompose ( ) if actual := actualForeground . Hex ( ) ; actual != 0x000000 { t . Errorf ( `foreground @ 2, 3 = %v, want %v` , actual , 0x000000 ) } }
TestDrawImage checks that a standard image fitting the screen can be drawn.
TestDrawImage checks that a standard image fitting the screen can be drawn .