Legends tests

@bartvde I add two commit to have a better result on the legend tests, I think that the best is that you cherry pick them and you close this pull request :-)