From fe3262f719d09a29d37b5a3ee297a1ae3de36dce Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 19 Aug 2016 09:15:34 +0100 Subject: [PATCH] test unicode filename support --- autogen.sh | 2 ++ test/images/{IMG_4618.jpg => йцук.jpg} | Bin test/test_colour.py | 3 ++- test/test_foreign.py | 3 ++- test/test_histogram.py | 11 ++++++----- test/test_resample.py | 15 ++++++++------- test/variables.sh.in | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) rename test/images/{IMG_4618.jpg => йцук.jpg} (100%) diff --git a/autogen.sh b/autogen.sh index 455bdac9..076f9e02 100755 --- a/autogen.sh +++ b/autogen.sh @@ -66,3 +66,5 @@ swig -version > /dev/null if [ $? -ne 0 ]; then echo you need swig to build from source control fi + +./configure $* diff --git a/test/images/IMG_4618.jpg b/test/images/йцук.jpg similarity index 100% rename from test/images/IMG_4618.jpg rename to test/images/йцук.jpg diff --git a/test/test_colour.py b/test/test_colour.py index e73e685b..206e066c 100755 --- a/test/test_colour.py +++ b/test/test_colour.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# vim: set fileencoding=utf-8 : import unittest import math @@ -218,7 +219,7 @@ class TestColour(unittest.TestCase): self.assertAlmostEqual(alpha, 42.0, places = 3) 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() self.assertLess(im.dE76(test).max(), 6) diff --git a/test/test_foreign.py b/test/test_foreign.py index 1dc5ab9c..3cca53d9 100755 --- a/test/test_foreign.py +++ b/test/test_foreign.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# vim: set fileencoding=utf-8 : from __future__ import division import unittest @@ -37,7 +38,7 @@ class TestForeign(unittest.TestCase): def setUp(self): 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.tiff_file = "images/sample.tif" self.profile_file = "images/sRGB.icm" diff --git a/test/test_histogram.py b/test/test_histogram.py index 84563574..dbacba5d 100755 --- a/test/test_histogram.py +++ b/test/test_histogram.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# vim: set fileencoding=utf-8 : import unittest import math @@ -48,7 +49,7 @@ class TestHistogram(unittest.TestCase): self.assertEqual(p[0], sum) 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() @@ -63,7 +64,7 @@ class TestHistogram(unittest.TestCase): self.assertTrue(im.hist_ismonotonic()) 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) @@ -104,7 +105,7 @@ class TestHistogram(unittest.TestCase): self.assertEqual((im - im2).abs().max(), 0.0) 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) @@ -115,14 +116,14 @@ class TestHistogram(unittest.TestCase): self.assertAlmostEqual(pc_set, 90, places = 0) 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() self.assertAlmostEqual(ent, 4.367, places = 3) 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) diff --git a/test/test_resample.py b/test/test_resample.py index 2819879e..97250b74 100755 --- a/test/test_resample.py +++ b/test/test_resample.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# vim: set fileencoding=utf-8 : import unittest import math @@ -105,7 +106,7 @@ class TestResample(unittest.TestCase): self.assertAlmostEqual(x, y, places = places, msg = msg) 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 for name in ["nearest", "bicubic", "bilinear", "nohalo", "lbb"]: @@ -117,7 +118,7 @@ class TestResample(unittest.TestCase): self.assertEqual((x - im).abs().max(), 0) 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 # clipping im = im.cast(Vips.BandFormat.CHAR) @@ -165,13 +166,13 @@ class TestResample(unittest.TestCase): self.assertEqual(d, 0) 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) self.assertEqual(im2.width, im.width // 4) self.assertEqual(im2.height, im.height // 4) 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) self.assertEqual(im2.width, im.width // 4) self.assertEqual(im2.height, im.height // 4) @@ -183,7 +184,7 @@ class TestResample(unittest.TestCase): self.assertLess(abs(im.avg() - im2.avg()), 1) 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) im3 = im.affine([0, -1, 1, 0]) # 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) 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) im3 = im.affine([2, 0, 0, 2]) self.assertEqual((im2 - im3).abs().max(), 0) 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) r = to_rectangular(p) diff --git a/test/variables.sh.in b/test/variables.sh.in index efb90aab..a574067e 100644 --- a/test/variables.sh.in +++ b/test/variables.sh.in @@ -3,7 +3,7 @@ PYTHON=@PYTHON@ # we need a different tmp for each script since make can run tests in parallel tmp=$top_srcdir/test/tmp-$$ test_images=$top_srcdir/test/images -image=$test_images/IMG_4618.jpg +image=$test_images/йцук.jpg mkdir -p $tmp vips=$top_srcdir/tools/vips vipsthumbnail=$top_srcdir/tools/vipsthumbnail