forked from openlp/openlp
added image_manager get_image_bytes() test
This commit is contained in:
parent
2d26110f22
commit
48e8838289
@ -5,7 +5,7 @@
|
|||||||
import os
|
import os
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Registry, ImageManager, ScreenList
|
from openlp.core.lib import Registry, ImageManager, ScreenList
|
||||||
|
|
||||||
@ -43,6 +43,12 @@ class TestImageManager(TestCase):
|
|||||||
# THEN returned record is a type of image
|
# THEN returned record is a type of image
|
||||||
self.assertEqual(isinstance(image, QtGui.QImage), True, u'The returned object should be a QImage')
|
self.assertEqual(isinstance(image, QtGui.QImage), True, u'The returned object should be a QImage')
|
||||||
|
|
||||||
|
# WHEN: The image bytes are requested.
|
||||||
|
byte_array = self.image_manager.get_image_bytes(TEST_PATH, u'church.jpg')
|
||||||
|
|
||||||
|
# THEN: Type should be a byte array.
|
||||||
|
self.assertEqual(isinstance(byte_array, QtCore.QByteArray), True, u'The returned object should be a QByteArray')
|
||||||
|
|
||||||
# WHEN the image is retrieved has not been loaded
|
# WHEN the image is retrieved has not been loaded
|
||||||
# THEN a KeyError is thrown
|
# THEN a KeyError is thrown
|
||||||
with self.assertRaises(KeyError) as context:
|
with self.assertRaises(KeyError) as context:
|
||||||
|
Loading…
Reference in New Issue
Block a user