diff mbox series

[FFmpeg-devel,v1,9/9] FATE/pixfmt_best: add more test case

Message ID 20200619015248.21873-9-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v1,1/9] lavu/pix_fmt: add P012 pixel format
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Wang, Fei W June 19, 2020, 1:52 a.m. UTC
The new test case can cover the issue mentioned in commit 97ba9c1a

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 libavutil/tests/pixfmt_best.c | 18 ++++++++++++++++++
 tests/ref/fate/pixfmt_best    |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index 01387c7c98..30a41b1fa6 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -66,6 +66,21 @@  int main(void)
             ++pass;                                             \
     } while (0)
 
+#define TEST_SPECIFIC(src, dst1, dst2, expected) do {           \
+        output = av_find_best_pix_fmt_of_2(dst1, dst2,          \
+                                           src, 0, NULL);       \
+        if (output != expected) {                               \
+            printf("Matching %s with %s and %s: got %s, expected %s\n", \
+                   av_get_pix_fmt_name(src),                    \
+                   av_get_pix_fmt_name(dst1),                   \
+                   av_get_pix_fmt_name(dst2),                   \
+                   av_get_pix_fmt_name(output),                 \
+                   av_get_pix_fmt_name(expected));              \
+            ++fail;                                             \
+        } else                                                  \
+            ++pass;                                             \
+    } while (0)
+
     // Same formats.
     for (i = 0; i < FF_ARRAY_ELEMS(pixfmt_list); i++)
         TEST(pixfmt_list[i], pixfmt_list[i]);
@@ -135,6 +150,9 @@  int main(void)
     // Opaque formats are least unlike each other.
     TEST(AV_PIX_FMT_DXVA2_VLD, AV_PIX_FMT_VAAPI);
 
+    // Specific test list
+    TEST_SPECIFIC(AV_PIX_FMT_YUV420P10LE, AV_PIX_FMT_P012LE, AV_PIX_FMT_P010LE, AV_PIX_FMT_P010LE);
+
     printf("%d tests passed, %d tests failed.\n", pass, fail);
     return !!fail;
 }
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 5f51e2d845..1da1846275 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@ 
-73 tests passed, 0 tests failed.
+74 tests passed, 0 tests failed.