mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
fixing deferring the rgba tests, whitespace
This commit is contained in:
parent
21e3fd2eb7
commit
94239540db
|
@ -9,11 +9,11 @@ except:
|
||||||
|
|
||||||
|
|
||||||
def test_version():
|
def test_version():
|
||||||
assert_no_exception(lambda: _webp.WebPDecoderVersion())
|
assert_no_exception(lambda: _webp.WebPDecoderVersion())
|
||||||
|
|
||||||
def test_good_alpha():
|
def test_good_alpha():
|
||||||
assert_equal(_webp.WebPDecoderBuggyAlpha(), 0)
|
assert_equal(_webp.WebPDecoderBuggyAlpha(), 0)
|
||||||
|
|
||||||
|
|
||||||
def test_read_rgb():
|
def test_read_rgb():
|
||||||
|
|
||||||
|
@ -77,7 +77,10 @@ def test_write_rgba():
|
||||||
|
|
||||||
pil_image = Image.new("RGBA", (10, 10), (255, 0, 0, 20))
|
pil_image = Image.new("RGBA", (10, 10), (255, 0, 0, 20))
|
||||||
pil_image.save(temp_file)
|
pil_image.save(temp_file)
|
||||||
|
|
||||||
|
if _webp.WebPDecoderBuggyAlpha():
|
||||||
|
return
|
||||||
|
|
||||||
image = Image.open(temp_file)
|
image = Image.open(temp_file)
|
||||||
image.load()
|
image.load()
|
||||||
|
|
||||||
|
@ -90,21 +93,21 @@ def test_write_rgba():
|
||||||
assert_image_similar(image, pil_image, 1.0)
|
assert_image_similar(image, pil_image, 1.0)
|
||||||
|
|
||||||
if _webp.WebPDecoderBuggyAlpha():
|
if _webp.WebPDecoderBuggyAlpha():
|
||||||
skip("Buggy early version of webp installed, not testing transparency")
|
skip("Buggy early version of webp installed, not testing transparency")
|
||||||
|
|
||||||
def test_read_rgba():
|
def test_read_rgba():
|
||||||
# Generated with `cwebp transparent.png -o transparent.webp`
|
# Generated with `cwebp transparent.png -o transparent.webp`
|
||||||
file_path = "Images/transparent.webp"
|
file_path = "Images/transparent.webp"
|
||||||
image = Image.open(file_path)
|
image = Image.open(file_path)
|
||||||
|
|
||||||
assert_equal(image.mode, "RGBA")
|
assert_equal(image.mode, "RGBA")
|
||||||
assert_equal(image.size, (200, 150))
|
assert_equal(image.size, (200, 150))
|
||||||
assert_equal(image.format, "WEBP")
|
assert_equal(image.format, "WEBP")
|
||||||
assert_no_exception(lambda: image.load())
|
assert_no_exception(lambda: image.load())
|
||||||
assert_no_exception(lambda: image.getdata())
|
assert_no_exception(lambda: image.getdata())
|
||||||
|
|
||||||
orig_bytes = image.tobytes()
|
orig_bytes = image.tobytes()
|
||||||
|
|
||||||
target = Image.open('Images/transparent.png')
|
target = Image.open('Images/transparent.png')
|
||||||
assert_image_similar(image, target, 20.0)
|
assert_image_similar(image, target, 20.0)
|
||||||
|
|
||||||
|
|
4
_webp.c
4
_webp.c
|
@ -162,11 +162,11 @@ PyObject* WebPDecoderVersion_wrapper(PyObject* self, PyObject* args){
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The version of webp that ships with (0.1.2) Ubuntu 12.04 doesn't handle alpha well.
|
* The version of webp that ships with (0.1.3) Ubuntu 12.04 doesn't handle alpha well.
|
||||||
* Files that are valid with 0.3 are reported as being invalid.
|
* Files that are valid with 0.3 are reported as being invalid.
|
||||||
*/
|
*/
|
||||||
PyObject* WebPDecoderBuggyAlpha_wrapper(PyObject* self, PyObject* args){
|
PyObject* WebPDecoderBuggyAlpha_wrapper(PyObject* self, PyObject* args){
|
||||||
return Py_BuildValue("i", WebPGetDecoderVersion()==0x0102);
|
return Py_BuildValue("i", WebPGetDecoderVersion()==0x0103);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef webpMethods[] =
|
static PyMethodDef webpMethods[] =
|
||||||
|
|
Loading…
Reference in New Issue
Block a user