tests: Check that pixbufs are valid before comparing them
tests: Check that pixbufs are valid before comparing them

Assert that the pixbufs have non-negative dimensions before comparing
them and potentially using one of the dimensions as a loop bound.

Coverity IDs: 1399711, 1399712

https://bugzilla.gnome.org/show_bug.cgi?id=776990

GNOME/gdk-pixbuf,GNOME/gdk-pixbuf,GNOME/gdk-pixbuf,GNOME/gdk-pixbuf