Add 3 pic merge

This commit is contained in:
felinae98 2021-08-30 15:26:20 +08:00
parent 97a3502a08
commit ad1bd7f6e0
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610
3 changed files with 12 additions and 4 deletions

View File

@ -19,3 +19,4 @@
## [0.3.2]
- 增加NoTargetGroup
- 增加1x3拼图的支持

View File

@ -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')

View File

@ -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