Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
fbd0ccb7
Commit
fbd0ccb7
authored
Oct 27, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
picture_pool: add test case
parent
5f7cb6f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
0 deletions
+116
-0
src/Makefile.am
src/Makefile.am
+2
-0
src/test/picture_pool.c
src/test/picture_pool.c
+114
-0
No files found.
src/Makefile.am
View file @
fbd0ccb7
...
...
@@ -520,6 +520,7 @@ check_PROGRAMS = \
test_dictionary
\
test_i18n_atof
\
test_md5
\
test_picture_pool
\
test_timer
\
test_url
\
test_utf8
\
...
...
@@ -535,6 +536,7 @@ test_block_DEPENDENCIES =
test_dictionary_SOURCES
=
test
/dictionary.c
test_i18n_atof_SOURCES
=
test
/i18n_atof.c
test_md5_SOURCES
=
test
/md5.c
test_picture_pool_SOURCES
=
test
/picture_pool.c
test_timer_SOURCES
=
test
/timer.c
test_url_SOURCES
=
test
/url.c
test_utf8_SOURCES
=
test
/utf8.c
...
...
src/test/picture_pool.c
0 → 100644
View file @
fbd0ccb7
/*****************************************************************************
* picture_pool.c: test cases for picture_poo_t
*****************************************************************************
* Copyright (C) 2014 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdbool.h>
#undef NDEBUG
#include <assert.h>
#include <vlc_common.h>
#include <vlc_es.h>
#include <vlc_picture_pool.h>
#define PICTURES 10
static
video_format_t
fmt
;
static
picture_pool_t
*
pool
,
*
reserve
;
static
void
test
(
bool
zombie
)
{
picture_t
*
pics
[
PICTURES
];
pool
=
picture_pool_NewFromFormat
(
&
fmt
,
PICTURES
);
assert
(
pool
!=
NULL
);
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
{
pics
[
i
]
=
picture_pool_Get
(
pool
);
assert
(
pics
[
i
]
!=
NULL
);
}
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
assert
(
picture_pool_Get
(
pool
)
==
NULL
);
// Reserve currently assumes that all pictures are free (or reserved).
//assert(picture_pool_Reserve(pool, 1) == NULL);
for
(
unsigned
i
=
0
;
i
<
PICTURES
/
2
;
i
++
)
picture_Hold
(
pics
[
i
]);
for
(
unsigned
i
=
0
;
i
<
PICTURES
/
2
;
i
++
)
picture_Release
(
pics
[
i
]);
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
{
picture_Release
(
pics
[
i
]);
assert
(
picture_pool_Get
(
pool
)
==
pics
[
i
]);
}
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
picture_Release
(
pics
[
i
]);
reserve
=
picture_pool_Reserve
(
pool
,
PICTURES
/
2
);
assert
(
reserve
!=
NULL
);
for
(
unsigned
i
=
0
;
i
<
PICTURES
/
2
;
i
++
)
{
pics
[
i
]
=
picture_pool_Get
(
pool
);
assert
(
pics
[
i
]
!=
NULL
);
}
for
(
unsigned
i
=
PICTURES
/
2
;
i
<
PICTURES
;
i
++
)
{
assert
(
picture_pool_Get
(
pool
)
==
NULL
);
pics
[
i
]
=
picture_pool_Get
(
reserve
);
assert
(
pics
[
i
]
!=
NULL
);
}
if
(
!
zombie
)
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
picture_Release
(
pics
[
i
]);
picture_pool_Delete
(
reserve
);
picture_pool_Delete
(
pool
);
if
(
zombie
)
for
(
unsigned
i
=
0
;
i
<
PICTURES
;
i
++
)
picture_Release
(
pics
[
i
]);
}
int
main
(
void
)
{
video_format_Setup
(
&
fmt
,
VLC_CODEC_I420
,
320
,
200
,
320
,
200
,
1
,
1
);
pool
=
picture_pool_NewFromFormat
(
&
fmt
,
PICTURES
);
assert
(
pool
!=
NULL
);
assert
(
picture_pool_GetSize
(
pool
)
==
PICTURES
);
reserve
=
picture_pool_Reserve
(
pool
,
PICTURES
/
2
);
assert
(
reserve
!=
NULL
);
picture_pool_Delete
(
reserve
);
picture_pool_Delete
(
pool
);
test
(
false
);
test
(
true
);
return
0
;
}
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