1
0
mirror of https://github.com/simon987/libscan.git synced 2025-04-09 22:06:43 +00:00
This commit is contained in:
simon987 2020-08-14 22:08:33 -04:00
parent 947a510338
commit 6c18fccab3
2 changed files with 36 additions and 2 deletions
libscan/media
test

@ -632,11 +632,11 @@ int store_image_thumbnail(scan_media_ctx_t *ctx, void* buf, size_t buf_len, docu
av_packet_unref(&jpeg_packet);
avcodec_free_context(&jpeg_encoder);
av_free(*scaled_frame->data);
av_frame_free(&scaled_frame);
}
frame_and_packet_free(frame_and_packet);
av_free(*scaled_frame->data);
av_frame_free(&scaled_frame);
avcodec_free_context(&decoder);
avformat_close_input(&pFormatCtx);

@ -23,6 +23,8 @@ static scan_ebook_ctx_t ebook_500_ctx;
static scan_comic_ctx_t comic_ctx;
static scan_comic_ctx_t comic_big_ctx;
static scan_media_ctx_t media_ctx;
static scan_ooxml_ctx_t ooxml_500_ctx;
@ -239,6 +241,32 @@ TEST(Comic, ComicCbr) {
cleanup(&doc, &f);
}
TEST(Comic, ComicCbrAsIs) {
vfile_t f;
document_t doc;
load_doc_file("libscan-test-files/test_files/ebook/laugh.cbr", &f, &doc);
size_t size_before = store_size;
parse_comic(&comic_big_ctx, &f, &doc);
ASSERT_EQ(store_size - size_before, 92451);
cleanup(&doc, &f);
}
TEST(Comic, ComicCbrFilters) {
vfile_t f;
document_t doc;
load_doc_file("libscan-test-files/test_files/ebook/cannot_parse_filters.cbr", &f, &doc);
parse_comic(&comic_ctx, &f, &doc);
cleanup(&doc, &f);
}
/* Media (image) */
TEST(MediaImage, Exif1) {
@ -652,6 +680,12 @@ int main(int argc, char **argv) {
comic_ctx.logf = noop_logf;
comic_ctx.store = counter_store;
comic_big_ctx.tn_qscale = 1.0;
comic_big_ctx.tn_size = 5000;
comic_big_ctx.log = noop_log;
comic_big_ctx.logf = noop_logf;
comic_big_ctx.store = counter_store;
media_ctx.log = noop_log;
media_ctx.logf = noop_logf;
media_ctx.store = counter_store;