代码拉取完成,页面将自动刷新
同步操作将从 openKylin/pillow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
from PIL import Image, WmfImagePlugin
from .helper import PillowTestCase, hopper
class TestFileWmf(PillowTestCase):
def test_load_raw(self):
# Test basic EMF open and rendering
with Image.open("Tests/images/drawing.emf") as im:
if hasattr(Image.core, "drawwmf"):
# Currently, support for WMF/EMF is Windows-only
im.load()
# Compare to reference rendering
with Image.open("Tests/images/drawing_emf_ref.png") as imref:
imref.load()
self.assert_image_similar(im, imref, 0)
# Test basic WMF open and rendering
with Image.open("Tests/images/drawing.wmf") as im:
if hasattr(Image.core, "drawwmf"):
# Currently, support for WMF/EMF is Windows-only
im.load()
# Compare to reference rendering
with Image.open("Tests/images/drawing_wmf_ref.png") as imref:
imref.load()
self.assert_image_similar(im, imref, 2.0)
def test_register_handler(self):
class TestHandler:
methodCalled = False
def save(self, im, fp, filename):
self.methodCalled = True
handler = TestHandler()
WmfImagePlugin.register_handler(handler)
im = hopper()
tmpfile = self.tempfile("temp.wmf")
im.save(tmpfile)
self.assertTrue(handler.methodCalled)
# Restore the state before this test
WmfImagePlugin.register_handler(None)
def test_load_dpi_rounding(self):
# Round up
with Image.open("Tests/images/drawing.emf") as im:
self.assertEqual(im.info["dpi"], 1424)
# Round down
with Image.open("Tests/images/drawing_roundDown.emf") as im:
self.assertEqual(im.info["dpi"], 1426)
def test_load_set_dpi(self):
with Image.open("Tests/images/drawing.wmf") as im:
self.assertEqual(im.size, (82, 82))
if hasattr(Image.core, "drawwmf"):
im.load(144)
self.assertEqual(im.size, (164, 164))
with Image.open("Tests/images/drawing_wmf_ref_144.png") as expected:
self.assert_image_similar(im, expected, 2.0)
def test_save(self):
im = hopper()
for ext in [".wmf", ".emf"]:
tmpfile = self.tempfile("temp" + ext)
self.assertRaises(IOError, im.save, tmpfile)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。