Improve tests for image output
jackwilsdon opened this issue · 0 comments
jackwilsdon commented
Currently we write tests as a massive array of expected pixels;
{
path: "/jackwilsdon",
size: 512,
image: [8][8]color.Color{
{jwPal.Foreground, jwPal.Background, jwPal.Foreground, jwPal.Background, jwPal.Background, jwPal.Foreground, jwPal.Background, jwPal.Foreground},
{jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground},
{jwPal.Foreground, jwPal.Background, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Background, jwPal.Foreground},
{jwPal.Background, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Background},
{jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background},
{jwPal.Foreground, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Background, jwPal.Foreground},
{jwPal.Foreground, jwPal.Background, jwPal.Foreground, jwPal.Background, jwPal.Background, jwPal.Foreground, jwPal.Background, jwPal.Foreground},
{jwPal.Background, jwPal.Background, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Foreground, jwPal.Background, jwPal.Background},
},
},
The issue with this is that it's a bit unwieldy! It would be nicer to be able to specify test cases like so;
{
path: "/jackwilsdon",
size: 512,
palette: ppic.DefaultPalette,
image: []string{
"# # # #",
"########",
"# #### #",
" ###### ",
" ",
"# #",
"# # # #",
" #### ",
},
},
Where a #
represents the foreground color of the palette and space the background.