mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-04 02:26:11 +08:00
Add 3 pic merge
This commit is contained in:
parent
97a3502a08
commit
ad1bd7f6e0
@ -19,3 +19,4 @@
|
||||
|
||||
## [0.3.2]
|
||||
- 增加NoTargetGroup
|
||||
- 增加1x3拼图的支持
|
||||
|
@ -38,7 +38,7 @@ class Post:
|
||||
return abs(size[0] - size[1]) / size[0] < 0.01
|
||||
|
||||
async def _pic_merge(self) -> None:
|
||||
if len(self.pics) < 6:
|
||||
if len(self.pics) < 3:
|
||||
return
|
||||
first_image = await self._pic_url_to_image(self.pics[0])
|
||||
if not self._check_image_square(first_image.size):
|
||||
@ -77,9 +77,10 @@ class Post:
|
||||
images.extend(image_row)
|
||||
y_coord.append(y_coord[-1] + row_first_img.size[1])
|
||||
return True
|
||||
if not await process_row(1):
|
||||
return
|
||||
matrix = (3,2)
|
||||
if await process_row(1):
|
||||
matrix = (3,2)
|
||||
else:
|
||||
matrix = (3,1)
|
||||
if await process_row(2):
|
||||
matrix = (3,3)
|
||||
logger.info('trigger merge image')
|
||||
|
@ -33,3 +33,9 @@ async def test_6_merge(plugin_module):
|
||||
post = plugin_module.post.Post('', '', '', pics=merge_source_9[0:6]+merge_source_9[9:])
|
||||
await post._pic_merge()
|
||||
assert len(post.pics) == 5
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_3_merge(plugin_module):
|
||||
post = plugin_module.post.Post('', '', '', pics=merge_source_9[0:3]+merge_source_9[9:])
|
||||
await post._pic_merge()
|
||||
assert len(post.pics) == 5
|
||||
|
Loading…
x
Reference in New Issue
Block a user