Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
672b925e
Commit
672b925e
authored
Dec 25, 2019
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/tests/opt: add tests for AV_OPT_TYPE_DICT
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
5edacc46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
opt.c
libavutil/tests/opt.c
+5
-0
opt
tests/ref/fate/opt
+13
-2
No files found.
libavutil/tests/opt.c
View file @
672b925e
...
@@ -55,6 +55,8 @@ typedef struct TestContext {
...
@@ -55,6 +55,8 @@ typedef struct TestContext {
int
bool1
;
int
bool1
;
int
bool2
;
int
bool2
;
int
bool3
;
int
bool3
;
AVDictionary
*
dict1
;
AVDictionary
*
dict2
;
}
TestContext
;
}
TestContext
;
#define OFFSET(x) offsetof(TestContext, x)
#define OFFSET(x) offsetof(TestContext, x)
...
@@ -89,6 +91,8 @@ static const AVOption test_options[]= {
...
@@ -89,6 +91,8 @@ static const AVOption test_options[]= {
{
"bool1"
,
"set boolean value"
,
OFFSET
(
bool1
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
-
1
},
-
1
,
1
,
1
},
{
"bool1"
,
"set boolean value"
,
OFFSET
(
bool1
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
-
1
},
-
1
,
1
,
1
},
{
"bool2"
,
"set boolean value"
,
OFFSET
(
bool2
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
1
},
-
1
,
1
,
1
},
{
"bool2"
,
"set boolean value"
,
OFFSET
(
bool2
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
1
},
-
1
,
1
,
1
},
{
"bool3"
,
"set boolean value"
,
OFFSET
(
bool3
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
1
},
{
"bool3"
,
"set boolean value"
,
OFFSET
(
bool3
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
1
},
{
"dict1"
,
"set dictionary value"
,
OFFSET
(
dict1
),
AV_OPT_TYPE_DICT
,
{
.
str
=
NULL
},
0
,
0
,
1
},
{
"dict2"
,
"set dictionary value"
,
OFFSET
(
dict2
),
AV_OPT_TYPE_DICT
,
{
.
str
=
"happy=':-)'"
},
0
,
0
,
1
},
{
NULL
},
{
NULL
},
};
};
...
@@ -256,6 +260,7 @@ int main(void)
...
@@ -256,6 +260,7 @@ int main(void)
"dbl=101"
,
"dbl=101"
,
"bool1=true"
,
"bool1=true"
,
"bool2=auto"
,
"bool2=auto"
,
"dict1='happy=
\\
:-):sad=
\\
:-('"
,
};
};
test_ctx
.
class
=
&
test_class
;
test_ctx
.
class
=
&
test_class
;
...
...
tests/ref/fate/opt
View file @
672b925e
...
@@ -43,6 +43,8 @@ TestContext AVOptions:
...
@@ -43,6 +43,8 @@ TestContext AVOptions:
-bool1 <boolean> E......... set boolean value (default auto)
-bool1 <boolean> E......... set boolean value (default auto)
-bool2 <boolean> E......... set boolean value (default true)
-bool2 <boolean> E......... set boolean value (default true)
-bool3 <boolean> E......... set boolean value (default false)
-bool3 <boolean> E......... set boolean value (default false)
-dict1 <dictionary> E......... set dictionary value
-dict2 <dictionary> E......... set dictionary value (default "happy=':-)'")
Testing av_opt_is_set_to_default()
Testing av_opt_is_set_to_default()
name: num default:1 error:
name: num default:1 error:
...
@@ -70,6 +72,8 @@ name: dbl default:0 error:
...
@@ -70,6 +72,8 @@ name: dbl default:0 error:
name: bool1 default:0 error:
name: bool1 default:0 error:
name: bool2 default:0 error:
name: bool2 default:0 error:
name: bool3 default:1 error:
name: bool3 default:1 error:
name: dict1 default:1 error:
name: dict2 default:0 error:
name: num default:1 error:
name: num default:1 error:
name: toggle default:1 error:
name: toggle default:1 error:
name: rational default:1 error:
name: rational default:1 error:
...
@@ -95,9 +99,11 @@ name: dbl default:1 error:
...
@@ -95,9 +99,11 @@ name: dbl default:1 error:
name: bool1 default:1 error:
name: bool1 default:1 error:
name: bool2 default:1 error:
name: bool2 default:1 error:
name: bool3 default:1 error:
name: bool3 default:1 error:
name: dict1 default:1 error:
name: dict2 default:1 error:
Test av_opt_serialize()
Test av_opt_serialize()
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false
,dict1=,dict2=happy\=\\:-)
Setting entry with key 'num' to value '0'
Setting entry with key 'num' to value '0'
Setting entry with key 'toggle' to value '1'
Setting entry with key 'toggle' to value '1'
Setting entry with key 'rational' to value '1/1'
Setting entry with key 'rational' to value '1/1'
...
@@ -120,7 +126,9 @@ Setting entry with key 'dbl' to value '0.333333'
...
@@ -120,7 +126,9 @@ Setting entry with key 'dbl' to value '0.333333'
Setting entry with key 'bool1' to value 'auto'
Setting entry with key 'bool1' to value 'auto'
Setting entry with key 'bool2' to value 'true'
Setting entry with key 'bool2' to value 'true'
Setting entry with key 'bool3' to value 'false'
Setting entry with key 'bool3' to value 'false'
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false
Setting entry with key 'dict1' to value ''
Setting entry with key 'dict2' to value 'happy=\:-)'
num=0,toggle=1,rational=1/1,string=default,escape=\\\=\,,flags=0x00000001,size=200x300,pix_fmt=0bgr,sample_fmt=s16,video_rate=25/1,duration=0.001,color=0xffc0cbff,cl=0x137,bin=62696E00,bin1=,bin2=,num64=1,flt=0.333333,dbl=0.333333,bool1=auto,bool2=true,bool3=false,dict1=,dict2=happy\=\\:-)
Testing av_set_options_string()
Testing av_set_options_string()
Setting options string ''
Setting options string ''
...
@@ -341,6 +349,9 @@ OK 'bool1=true'
...
@@ -341,6 +349,9 @@ OK 'bool1=true'
Setting options string 'bool2=auto'
Setting options string 'bool2=auto'
Setting entry with key 'bool2' to value 'auto'
Setting entry with key 'bool2' to value 'auto'
OK 'bool2=auto'
OK 'bool2=auto'
Setting options string 'dict1='happy=\:-):sad=\:-(''
Setting entry with key 'dict1' to value 'happy=\:-):sad=\:-('
OK 'dict1='happy=\:-):sad=\:-(''
Testing av_opt_set_from_string()
Testing av_opt_set_from_string()
Setting options string ''
Setting options string ''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment