summaryrefslogtreecommitdiffstats
path: root/test/scale_test.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-02-25 21:50:08 -0600
committerDudemanguy <random342@airmail.cc>2023-03-02 15:45:27 +0000
commit9db818279aa63d071f2bca369235285314444dcd (patch)
tree9aafc5cf73e19ae8ea69751c060cab9766a6b9a4 /test/scale_test.c
parent61532421571f972f076b3700d7ae468c0a0438c0 (diff)
downloadmpv-9db818279aa63d071f2bca369235285314444dcd.tar.bz2
mpv-9db818279aa63d071f2bca369235285314444dcd.tar.xz
test: integrate unittests with meson
This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built.
Diffstat (limited to 'test/scale_test.c')
-rw-r--r--test/scale_test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/scale_test.c b/test/scale_test.c
index ccd83c7658..f919dca1e2 100644
--- a/test/scale_test.c
+++ b/test/scale_test.c
@@ -55,13 +55,13 @@ static struct mp_image *gen_repack_test_img(int w, int h, int bytes, bool rgb,
static void dump_image(struct scale_test *stest, const char *name,
struct mp_image *img)
{
- char *path = mp_tprintf(4096, "%s/%s.png", stest->ctx->out_path, name);
+ char *path = mp_tprintf(4096, "%s/%s.png", stest->outdir, name);
struct image_writer_opts opts = image_writer_opts_defaults;
opts.format = AV_CODEC_ID_PNG;
- if (!write_image(img, &opts, path, stest->ctx->global, stest->ctx->log)) {
- MP_FATAL(stest->ctx, "Failed to write '%s'.\n", path);
+ if (!write_image(img, &opts, path, NULL, NULL)) {
+ printf("Failed to write '%s'.\n", path);
abort();
}
}
@@ -102,7 +102,7 @@ static void assert_imgs_equal(struct scale_test *stest, FILE *f,
void repack_test_run(struct scale_test *stest)
{
char *logname = mp_tprintf(80, "%s.log", stest->test_name);
- FILE *f = test_open_out(stest->ctx, logname);
+ FILE *f = test_open_out(stest->outdir, logname);
if (!stest->sws) {
init_imgfmts_list();
@@ -187,6 +187,6 @@ void repack_test_run(struct scale_test *stest)
fclose(f);
- assert_text_files_equal(stest->ctx, logname, logname,
+ assert_text_files_equal(stest->refdir, stest->outdir, logname,
"This can fail if FFmpeg adds or removes pixfmts.");
}