mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-07-08 06:53:01 +08:00
update threshold for image merge
This commit is contained in:
parent
4468de6f7a
commit
3f906f7a41
@ -42,7 +42,7 @@ class Post:
|
|||||||
return Image.open(pic_buffer)
|
return Image.open(pic_buffer)
|
||||||
|
|
||||||
def _check_image_square(self, size: tuple[int, int]) -> bool:
|
def _check_image_square(self, size: tuple[int, int]) -> bool:
|
||||||
return abs(size[0] - size[1]) / size[0] < 0.01
|
return abs(size[0] - size[1]) / size[0] < 0.05
|
||||||
|
|
||||||
async def _pic_merge(self) -> None:
|
async def _pic_merge(self) -> None:
|
||||||
if len(self.pics) < 3:
|
if len(self.pics) < 3:
|
||||||
|
@ -21,6 +21,20 @@ merge_source_9 = [
|
|||||||
"https://wx4.sinaimg.cn/large/0071VPLMgy1gq0vifc826j30rs4a64qs.jpg",
|
"https://wx4.sinaimg.cn/large/0071VPLMgy1gq0vifc826j30rs4a64qs.jpg",
|
||||||
"https://wx1.sinaimg.cn/large/0071VPLMgy1gq0vify21lj30rsbj71ld.jpg",
|
"https://wx1.sinaimg.cn/large/0071VPLMgy1gq0vify21lj30rsbj71ld.jpg",
|
||||||
]
|
]
|
||||||
|
merge_source_9_2 = [
|
||||||
|
'https://wx2.sinaimg.cn/large/0071VPLMgy1gxo0eyycd7j30dw0dd3zk.jpg',
|
||||||
|
'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0eyx6mhj30dw0ddjs8.jpg',
|
||||||
|
'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0eyxf2bj30dw0dddh4.jpg',
|
||||||
|
'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0ez1h5zj30dw0efwfs.jpg',
|
||||||
|
'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0eyyku4j30dw0ef3zm.jpg',
|
||||||
|
'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0ez0bjhj30dw0efabs.jpg',
|
||||||
|
'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0ezdcafj30dw0dwacb.jpg',
|
||||||
|
'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0ezg2g3j30dw0dwq51.jpg',
|
||||||
|
'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0ez5oloj30dw0dw0uf.jpg',
|
||||||
|
'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0fnk6stj30rs44ne81.jpg',
|
||||||
|
'https://wx2.sinaimg.cn/large/0071VPLMgy1gxo0fohgcoj30rs3wpe81.jpg',
|
||||||
|
'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0fpr6chj30rs3m1b29.jpg'
|
||||||
|
]
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_9_merge(plugin_module: 'nonebot_bison'):
|
async def test_9_merge(plugin_module: 'nonebot_bison'):
|
||||||
@ -29,6 +43,13 @@ async def test_9_merge(plugin_module: 'nonebot_bison'):
|
|||||||
assert len(post.pics) == 5
|
assert len(post.pics) == 5
|
||||||
await post.generate_messages()
|
await post.generate_messages()
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_9_merge_2(plugin_module: 'nonebot_bison'):
|
||||||
|
post = plugin_module.post.Post('', '', '', pics=merge_source_9_2)
|
||||||
|
await post._pic_merge()
|
||||||
|
assert len(post.pics) == 4
|
||||||
|
await post.generate_messages()
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_6_merge(plugin_module):
|
async def test_6_merge(plugin_module):
|
||||||
post = plugin_module.post.Post('', '', '', pics=merge_source_9[0:6]+merge_source_9[9:])
|
post = plugin_module.post.Post('', '', '', pics=merge_source_9[0:6]+merge_source_9[9:])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user