From d31bf5b17169f4c3b5d8461e8788a051092f310f Mon Sep 17 00:00:00 2001 From: Blake Thompson Date: Mon, 9 Feb 2015 13:46:48 -0800 Subject: [PATCH] Updated tests from cast to copy --- tests/python_tests/{cast_test.py => copy_test.py} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename tests/python_tests/{cast_test.py => copy_test.py} (88%) diff --git a/tests/python_tests/cast_test.py b/tests/python_tests/copy_test.py similarity index 88% rename from tests/python_tests/cast_test.py rename to tests/python_tests/copy_test.py index b469859ab..d3cf9b15c 100644 --- a/tests/python_tests/cast_test.py +++ b/tests/python_tests/copy_test.py @@ -16,13 +16,13 @@ def test_image_16_8_simple(): im.set_pixel(0,1, 999) im.set_pixel(1,0, 5) im.set_pixel(1,1, 2) - im2 = im.cast(mapnik.ImageType.gray8) + im2 = im.copy(mapnik.ImageType.gray8) eq_(im2.get_pixel(0,0), 255) eq_(im2.get_pixel(0,1), 255) eq_(im2.get_pixel(1,0), 5) eq_(im2.get_pixel(1,1), 2) # Cast back! - im = im2.cast(mapnik.ImageType.gray16) + im = im2.copy(mapnik.ImageType.gray16) eq_(im.get_pixel(0,0), 255) eq_(im.get_pixel(0,1), 255) eq_(im.get_pixel(1,0), 5) @@ -34,7 +34,7 @@ def test_image_32f_8_simple(): im.set_pixel(0,1, -23.4) im.set_pixel(1,0, 120.6) im.set_pixel(1,1, 360.2) - im2 = im.cast(mapnik.ImageType.gray8) + im2 = im.copy(mapnik.ImageType.gray8) eq_(im2.get_pixel(0,0), 120) eq_(im2.get_pixel(0,1), 0) eq_(im2.get_pixel(1,0), 120) # Notice this is truncated! @@ -57,13 +57,13 @@ def test_image_16_8_scale_and_offset(): im.set_pixel(1,1, 615) offset = 255 scaling = 3 - im2 = im.cast(mapnik.ImageType.gray8, offset, scaling) + im2 = im.copy(mapnik.ImageType.gray8, offset, scaling) eq_(im2.get_pixel(0,0), 0) eq_(im2.get_pixel(0,1), 1) eq_(im2.get_pixel(1,0), 255) eq_(im2.get_pixel(1,1), 120) # pixels will be a little off due to offsets in reverting! - im3 = im2.cast(mapnik.ImageType.gray16) + im3 = im2.copy(mapnik.ImageType.gray16) eq_(im3.get_pixel(0,0), 255) # Rounding error with ints eq_(im3.get_pixel(0,1), 258) # same eq_(im3.get_pixel(1,0), 1020) # The other one was way out of range for our scale/offset @@ -77,12 +77,12 @@ def test_image_16_32f_scale_and_offset(): im.set_pixel(1,1, 615) offset = 255 scaling = 3.2 - im2 = im.cast(mapnik.ImageType.gray32f, offset, scaling) + im2 = im.copy(mapnik.ImageType.gray32f, offset, scaling) eq_(im2.get_pixel(0,0), 0.3125) eq_(im2.get_pixel(0,1), 0.9375) eq_(im2.get_pixel(1,0), -79.6875) eq_(im2.get_pixel(1,1), 112.5) - im3 = im2.cast(mapnik.ImageType.gray16) + im3 = im2.copy(mapnik.ImageType.gray16) eq_(im3.get_pixel(0,0), 256) eq_(im3.get_pixel(0,1), 258) eq_(im3.get_pixel(1,0), 0)