python3: make qt image test work on python3

QByteArrays are natively bytes and ended up looking like this: u"b'xpm'"
Instead use the builtin method to get the data back, and decode it to
unicode.
This commit is contained in:
Eli Schwartz 2019-03-25 23:57:10 -04:00
parent 727e65a203
commit 6d6509df57
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -175,7 +175,7 @@ class BuildTest(unittest.TestCase):
# it should just work because the hard-coded paths of the Qt # it should just work because the hard-coded paths of the Qt
# installation should work. If they do not, then it is a distro # installation should work. If they do not, then it is a distro
# problem. # problem.
fmts = set(map(unicode_type, QImageReader.supportedImageFormats())) fmts = set(map(lambda x: x.data().decode('utf-8'), QImageReader.supportedImageFormats()))
testf = {'jpg', 'png', 'svg', 'ico', 'gif'} testf = {'jpg', 'png', 'svg', 'ico', 'gif'}
self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts) self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts)
data = P('images/blank.png', allow_user_override=False, data=True) data = P('images/blank.png', allow_user_override=False, data=True)