add a test for byteswap()

This commit is contained in:
John Cupitt 2015-06-07 16:24:52 +01:00
parent e9720afb18
commit e83a3bbfd1
2 changed files with 8 additions and 2 deletions

2
TODO
View File

@ -1,5 +1,3 @@
- add tests for bandfold/unfold, byteswap
- how about something like vips_grid() which turns a tall thin one-band - how about something like vips_grid() which turns a tall thin one-band
image into a much smaller many-band image? image into a much smaller many-band image?

View File

@ -237,6 +237,14 @@ class TestConversion(unittest.TestCase):
self.assertEqual(y.bands, 1) self.assertEqual(y.bands, 1)
self.assertEqual(x.avg(), y.avg()) self.assertEqual(x.avg(), y.avg())
def test_byteswap(self):
x = self.mono.cast("ushort")
y = x.byteswap().byteswap()
self.assertEqual(x.width, y.width)
self.assertEqual(x.height, y.height)
self.assertEqual(x.bands, y.bands)
self.assertEqual(x.avg(), y.avg())
def test_embed(self): def test_embed(self):
for fmt in all_formats: for fmt in all_formats:
test = self.colour.cast(fmt) test = self.colour.cast(fmt)