Merge pull request #13 from koji-1009/refactor/tests

test: Edge cases
This commit is contained in:
Koji Wakamiya 2025-12-12 12:48:24 +09:00 committed by GitHub
commit 75aef49477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 28 additions and 0 deletions

View File

@ -94,4 +94,32 @@ void main() {
}); });
}); });
}); });
group('Edge cases', () {
test('handles 1x1 image', () {
const originalWidth = 1;
const originalHeight = 1;
const resizeMode = FitResizeMode(width: 10, height: 10);
final (width, height) = resizeMode.calculateSize(
originalWidth,
originalHeight,
);
expect(width, originalWidth);
expect(height, originalHeight);
});
test('nandles very large images', () {
const originalWidth = 10000;
const originalHeight = 5000;
const resizeMode = FitResizeMode(width: 100,);
final (width, height) = resizeMode.calculateSize(
originalWidth,
originalHeight,
);
expect(width, 100);
expect(height, 50);
});
});
} }