|
|
|
@@ -485,7 +485,9 @@ void main() {
|
|
|
|
File(p.join(albumDir.path, 'test.jpg')).writeAsBytesSync([0xFF, 0xD8]);
|
|
|
|
File(p.join(albumDir.path, 'test.jpg')).writeAsBytesSync([0xFF, 0xD8]);
|
|
|
|
File(p.join(albumDir.path, 'test2.jpeg')).writeAsBytesSync([0xFF, 0xD8]);
|
|
|
|
File(p.join(albumDir.path, 'test2.jpeg')).writeAsBytesSync([0xFF, 0xD8]);
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_jpg').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_jpg').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.length, 2);
|
|
|
|
expect(photos.length, 2);
|
|
|
|
expect(photos.every((p) => p.mimeType == 'image/jpeg'), isTrue);
|
|
|
|
expect(photos.every((p) => p.mimeType == 'image/jpeg'), isTrue);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@@ -498,7 +500,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.png'),
|
|
|
|
p.join(albumDir.path, 'test.png'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_png').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_png').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'image/png');
|
|
|
|
expect(photos.first.mimeType, 'image/png');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -510,7 +514,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.webp'),
|
|
|
|
p.join(albumDir.path, 'test.webp'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_webp').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_webp').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'image/webp');
|
|
|
|
expect(photos.first.mimeType, 'image/webp');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -522,7 +528,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.mp4'),
|
|
|
|
p.join(albumDir.path, 'test.mp4'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_mp4').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_mp4').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'video/mp4');
|
|
|
|
expect(photos.first.mimeType, 'video/mp4');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -534,7 +542,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.avi'),
|
|
|
|
p.join(albumDir.path, 'test.avi'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_avi').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_avi').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'video/avi');
|
|
|
|
expect(photos.first.mimeType, 'video/avi');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -546,7 +556,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.mov'),
|
|
|
|
p.join(albumDir.path, 'test.mov'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_mov').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_mov').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'video/quicktime');
|
|
|
|
expect(photos.first.mimeType, 'video/quicktime');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -558,7 +570,9 @@ void main() {
|
|
|
|
p.join(albumDir.path, 'test.mkv'),
|
|
|
|
p.join(albumDir.path, 'test.mkv'),
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
).writeAsBytesSync(List.filled(100, 0));
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'mime_mkv').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'mime_mkv').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.first.mimeType, 'video/x-matroska');
|
|
|
|
expect(photos.first.mimeType, 'video/x-matroska');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@@ -576,7 +590,9 @@ void main() {
|
|
|
|
).writeAsBytesSync(List.filled(10, 0));
|
|
|
|
).writeAsBytesSync(List.filled(10, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'ext_test').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'ext_test').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.length, extensions.length);
|
|
|
|
expect(photos.length, extensions.length);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -592,7 +608,9 @@ void main() {
|
|
|
|
).writeAsBytesSync(List.filled(10, 0));
|
|
|
|
).writeAsBytesSync(List.filled(10, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'ext_video').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'ext_video').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.length, extensions.length);
|
|
|
|
expect(photos.length, extensions.length);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
@@ -605,9 +623,11 @@ void main() {
|
|
|
|
File(p.join(albumDir.path, 'skip.pdf')).writeAsBytesSync([]);
|
|
|
|
File(p.join(albumDir.path, 'skip.pdf')).writeAsBytesSync([]);
|
|
|
|
File(p.join(albumDir.path, 'skip.exe')).writeAsBytesSync([]);
|
|
|
|
File(p.join(albumDir.path, 'skip.exe')).writeAsBytesSync([]);
|
|
|
|
|
|
|
|
|
|
|
|
final photos = await repository.getPhotosByAlbumId(p.join(tempDir.path, 'ext_ignore').hashCode);
|
|
|
|
final photos = await repository.getPhotosByAlbumId(
|
|
|
|
|
|
|
|
p.join(tempDir.path, 'ext_ignore').hashCode,
|
|
|
|
|
|
|
|
);
|
|
|
|
expect(photos.length, 1);
|
|
|
|
expect(photos.length, 1);
|
|
|
|
expect(photos.first.fileName, 'valid.png');
|
|
|
|
expect(photos.first.fileName, 'valid.png');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|