MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / test_av_parse_color

Function test_av_parse_color

libavutil/tests/parseutils.c:76–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76static void test_av_parse_color(void)
77{
78 int i;
79 uint8_t rgba[4];
80 static const char *const color_names[] = {
81 "bikeshed",
82 "RaNdOm",
83 "foo",
84 "red",
85 "Red ",
86 "RED",
87 "Violet",
88 "Yellow",
89 "Red",
90 "0x000000",
91 "0x0000000",
92 "0xff000000",
93 "0x3e34ff",
94 "0x3e34ffaa",
95 "0xffXXee",
96 "0xfoobar",
97 "0xffffeeeeeeee",
98 "#ff0000",
99 "#ffXX00",
100 "ff0000",
101 "ffXX00",
102 "red@foo",
103 "random@10",
104 "0xff0000@1.0",
105 "red@",
106 "red@0xfff",
107 "red@0xf",
108 "red@2",
109 "red@0.1",
110 "red@-1",
111 "red@0.5",
112 "red@1.0",
113 "red@256",
114 "red@10foo",
115 "red@-1.0",
116 "red@-0.0",
117 };
118
119 av_log_set_level(AV_LOG_DEBUG);
120
121 for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) {
122 if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
123 printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
124 color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
125 else
126 printf("%s -> error\n", color_names[i]);
127 }
128}
129
130static void test_av_small_strptime(void)
131{

Callers 1

mainFunction · 0.85

Calls 2

av_log_set_levelFunction · 0.85
av_parse_colorFunction · 0.85

Tested by

no test coverage detected