test unicode filename support

This commit is contained in:
John Cupitt 2016-08-19 09:15:34 +01:00
parent 9f3572188c
commit fe3262f719
7 changed files with 21 additions and 15 deletions

View File

@ -66,3 +66,5 @@ swig -version > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo you need swig to build from source control echo you need swig to build from source control
fi fi
./configure $*

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# vim: set fileencoding=utf-8 :
import unittest import unittest
import math import math
@ -218,7 +219,7 @@ class TestColour(unittest.TestCase):
self.assertAlmostEqual(alpha, 42.0, places = 3) self.assertAlmostEqual(alpha, 42.0, places = 3)
def test_icc(self): def test_icc(self):
test = Vips.Image.new_from_file("images/IMG_4618.jpg") test = Vips.Image.new_from_file("images/йцук.jpg")
im = test.icc_import().icc_export() im = test.icc_import().icc_export()
self.assertLess(im.dE76(test).max(), 6) self.assertLess(im.dE76(test).max(), 6)

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# vim: set fileencoding=utf-8 :
from __future__ import division from __future__ import division
import unittest import unittest
@ -37,7 +38,7 @@ class TestForeign(unittest.TestCase):
def setUp(self): def setUp(self):
self.matlab_file = "images/sample.mat" self.matlab_file = "images/sample.mat"
self.jpeg_file = "images/IMG_4618.jpg" self.jpeg_file = "images/йцук.jpg"
self.png_file = "images/sample.png" self.png_file = "images/sample.png"
self.tiff_file = "images/sample.tif" self.tiff_file = "images/sample.tif"
self.profile_file = "images/sRGB.icm" self.profile_file = "images/sRGB.icm"

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# vim: set fileencoding=utf-8 :
import unittest import unittest
import math import math
@ -48,7 +49,7 @@ class TestHistogram(unittest.TestCase):
self.assertEqual(p[0], sum) self.assertEqual(p[0], sum)
def test_hist_equal(self): def test_hist_equal(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.hist_equal() im2 = im.hist_equal()
@ -63,7 +64,7 @@ class TestHistogram(unittest.TestCase):
self.assertTrue(im.hist_ismonotonic()) self.assertTrue(im.hist_ismonotonic())
def test_hist_local(self): def test_hist_local(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.hist_local(10, 10) im2 = im.hist_local(10, 10)
@ -104,7 +105,7 @@ class TestHistogram(unittest.TestCase):
self.assertEqual((im - im2).abs().max(), 0.0) self.assertEqual((im - im2).abs().max(), 0.0)
def test_percent(self): def test_percent(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg").extract_band(1) im = Vips.Image.new_from_file("images/йцук.jpg").extract_band(1)
pc = im.percent(90) pc = im.percent(90)
@ -115,14 +116,14 @@ class TestHistogram(unittest.TestCase):
self.assertAlmostEqual(pc_set, 90, places = 0) self.assertAlmostEqual(pc_set, 90, places = 0)
def test_hist_entropy(self): def test_hist_entropy(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg").extract_band(1) im = Vips.Image.new_from_file("images/йцук.jpg").extract_band(1)
ent = im.hist_find().hist_entropy() ent = im.hist_find().hist_entropy()
self.assertAlmostEqual(ent, 4.367, places = 3) self.assertAlmostEqual(ent, 4.367, places = 3)
def test_stdif(self): def test_stdif(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.stdif(10, 10) im2 = im.stdif(10, 10)

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# vim: set fileencoding=utf-8 :
import unittest import unittest
import math import math
@ -105,7 +106,7 @@ class TestResample(unittest.TestCase):
self.assertAlmostEqual(x, y, places = places, msg = msg) self.assertAlmostEqual(x, y, places = places, msg = msg)
def test_affine(self): def test_affine(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
# vsqbs is non-interpolatory, don't test this way # vsqbs is non-interpolatory, don't test this way
for name in ["nearest", "bicubic", "bilinear", "nohalo", "lbb"]: for name in ["nearest", "bicubic", "bilinear", "nohalo", "lbb"]:
@ -117,7 +118,7 @@ class TestResample(unittest.TestCase):
self.assertEqual((x - im).abs().max(), 0) self.assertEqual((x - im).abs().max(), 0)
def test_reduce(self): def test_reduce(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
# cast down to 0-127, the smallest range, so we aren't messed up by # cast down to 0-127, the smallest range, so we aren't messed up by
# clipping # clipping
im = im.cast(Vips.BandFormat.CHAR) im = im.cast(Vips.BandFormat.CHAR)
@ -165,13 +166,13 @@ class TestResample(unittest.TestCase):
self.assertEqual(d, 0) self.assertEqual(d, 0)
def test_resize(self): def test_resize(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.resize(0.25) im2 = im.resize(0.25)
self.assertEqual(im2.width, im.width // 4) self.assertEqual(im2.width, im.width // 4)
self.assertEqual(im2.height, im.height // 4) self.assertEqual(im2.height, im.height // 4)
def test_shrink(self): def test_shrink(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.shrink(4, 4) im2 = im.shrink(4, 4)
self.assertEqual(im2.width, im.width // 4) self.assertEqual(im2.width, im.width // 4)
self.assertEqual(im2.height, im.height // 4) self.assertEqual(im2.height, im.height // 4)
@ -183,7 +184,7 @@ class TestResample(unittest.TestCase):
self.assertLess(abs(im.avg() - im2.avg()), 1) self.assertLess(abs(im.avg() - im2.avg()), 1)
def test_similarity(self): def test_similarity(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.similarity(angle = 90) im2 = im.similarity(angle = 90)
im3 = im.affine([0, -1, 1, 0]) im3 = im.affine([0, -1, 1, 0])
# rounding in calculating the affine transform from the angle stops this # rounding in calculating the affine transform from the angle stops this
@ -191,13 +192,13 @@ class TestResample(unittest.TestCase):
self.assertLess((im2 - im3).abs().max(), 50) self.assertLess((im2 - im3).abs().max(), 50)
def test_similarity_scale(self): def test_similarity_scale(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
im2 = im.similarity(scale = 2) im2 = im.similarity(scale = 2)
im3 = im.affine([2, 0, 0, 2]) im3 = im.affine([2, 0, 0, 2])
self.assertEqual((im2 - im3).abs().max(), 0) self.assertEqual((im2 - im3).abs().max(), 0)
def test_mapim(self): def test_mapim(self):
im = Vips.Image.new_from_file("images/IMG_4618.jpg") im = Vips.Image.new_from_file("images/йцук.jpg")
p = to_polar(im) p = to_polar(im)
r = to_rectangular(p) r = to_rectangular(p)

View File

@ -3,7 +3,7 @@ PYTHON=@PYTHON@
# we need a different tmp for each script since make can run tests in parallel # we need a different tmp for each script since make can run tests in parallel
tmp=$top_srcdir/test/tmp-$$ tmp=$top_srcdir/test/tmp-$$
test_images=$top_srcdir/test/images test_images=$top_srcdir/test/images
image=$test_images/IMG_4618.jpg image=$test_images/йцук.jpg
mkdir -p $tmp mkdir -p $tmp
vips=$top_srcdir/tools/vips vips=$top_srcdir/tools/vips
vipsthumbnail=$top_srcdir/tools/vipsthumbnail vipsthumbnail=$top_srcdir/tools/vipsthumbnail