You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-07 23:23:49 +02:00
Merge thumbnail and photo preview (generated photo) handling #806
This commit is contained in:
@@ -7,51 +7,26 @@ import {PhotoProcessing} from '../../../../../src/backend/model/fileaccess/filep
|
||||
|
||||
describe('PhotoProcessing', () => {
|
||||
|
||||
/* eslint-disable no-unused-expressions,@typescript-eslint/no-unused-expressions */
|
||||
it('should generate converted file path', async () => {
|
||||
|
||||
await Config.load();
|
||||
Config.Media.Thumbnail.thumbnailSizes = [];
|
||||
Config.Media.Thumbnail.animateGif = true;
|
||||
ProjectPath.ImageFolder = path.join(__dirname, './../../../assets');
|
||||
const photoPath = path.join(ProjectPath.ImageFolder, 'test_png.png');
|
||||
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(photoPath,
|
||||
Config.Media.Photo.Converting.resolution)))
|
||||
.to.be.true;
|
||||
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(photoPath + 'noPath',
|
||||
Config.Media.Photo.Converting.resolution)))
|
||||
.to.be.false;
|
||||
|
||||
{
|
||||
const convertedPath = PhotoProcessing.generateConvertedPath(photoPath,
|
||||
Config.Media.Photo.Converting.resolution);
|
||||
Config.Media.Photo.Converting.resolution = (1 as any);
|
||||
expect(await PhotoProcessing.isValidConvertedPath(convertedPath)).to.be.false;
|
||||
}
|
||||
});
|
||||
|
||||
it('should generate converted gif file path', async () => {
|
||||
|
||||
await Config.load();
|
||||
Config.Media.Thumbnail.thumbnailSizes = [];
|
||||
Config.Media.Photo.thumbnailSizes = [];
|
||||
ProjectPath.ImageFolder = path.join(__dirname, './../../../assets');
|
||||
const gifPath = path.join(ProjectPath.ImageFolder, 'earth.gif');
|
||||
|
||||
Config.Media.Thumbnail.animateGif = true;
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(gifPath,
|
||||
Config.Media.Photo.Converting.resolution)))
|
||||
.to.be.true;
|
||||
|
||||
Config.Media.Thumbnail.animateGif = false;
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(gifPath,
|
||||
Config.Media.Photo.Converting.resolution)))
|
||||
.to.be.true;
|
||||
for (const thSize of Config.Media.Photo.thumbnailSizes) {
|
||||
Config.Media.Photo.animateGif = true;
|
||||
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(gifPath, thSize)))
|
||||
.to.be.true;
|
||||
|
||||
Config.Media.Photo.animateGif = false;
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(gifPath, thSize)))
|
||||
.to.be.true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -60,12 +35,11 @@ describe('PhotoProcessing', () => {
|
||||
it('should generate converted thumbnail path', async () => {
|
||||
|
||||
await Config.load();
|
||||
Config.Media.Photo.Converting.resolution = (null as any);
|
||||
Config.Media.Thumbnail.thumbnailSizes = [10, 20];
|
||||
Config.Media.Photo.thumbnailSizes = [10, 20];
|
||||
ProjectPath.ImageFolder = path.join(__dirname, './../../../assets');
|
||||
const photoPath = path.join(ProjectPath.ImageFolder, 'test_png.png');
|
||||
|
||||
for (const thSize of Config.Media.Thumbnail.thumbnailSizes) {
|
||||
for (const thSize of Config.Media.Photo.thumbnailSizes) {
|
||||
expect(await PhotoProcessing
|
||||
.isValidConvertedPath(PhotoProcessing.generateConvertedPath(photoPath, thSize)))
|
||||
.to.be.true;
|
||||
|
||||
Reference in New Issue
Block a user