Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
83dc6673
Commit
83dc6673
authored
Feb 22, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests: Clean up CommitDecommitTest().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
930e0cdc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
46 deletions
+47
-46
memallocator.c
dlls/quartz/tests/memallocator.c
+47
-46
No files found.
dlls/quartz/tests/memallocator.c
View file @
83dc6673
/*
*
Unit tests for Direct Show function
s
*
Memory allocator unit test
s
*
* Copyright (C) 2005 Christian Costa
*
...
...
@@ -19,72 +19,73 @@
*/
#define COBJMACROS
#include "wine/test.h"
#include "uuids.h"
#include "dshow.h"
#include "
control
.h"
#include "
wine/test
.h"
static
void
CommitDecommitTest
(
void
)
static
IMemAllocator
*
create_allocator
(
void
)
{
IMemAllocator
*
pMemAllocator
;
IMemAllocator
*
allocator
=
NULL
;
HRESULT
hr
=
CoCreateInstance
(
&
CLSID_MemoryAllocator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMemAllocator
,
(
void
**
)
&
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
return
allocator
;
}
static
void
test_commit
(
void
)
{
ALLOCATOR_PROPERTIES
req_props
=
{
2
,
65536
,
1
,
0
},
ret_props
;
IMemAllocator
*
allocator
=
create_allocator
();
IMediaSample
*
sample
,
*
sample2
;
HRESULT
hr
;
BYTE
*
data
;
hr
=
IMemAllocator_SetProperties
(
allocator
,
&
req_props
,
&
ret_props
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
CoCreateInstance
(
&
CLSID_MemoryAllocator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMemAllocator
,
(
LPVOID
*
)
&
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Unable to create memory allocator %x
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample
,
NULL
,
NULL
,
0
);
ok
(
hr
==
VFW_E_NOT_COMMITTED
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ALLOCATOR_PROPERTIES
RequestedProps
;
ALLOCATOR_PROPERTIES
ActualProps
;
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IMediaSample_Release
(
sample
);
IMediaSample
*
sample
=
NULL
,
*
sample2
=
NULL
;
hr
=
IMemAllocator_Decommit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_Decommit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
RequestedProps
.
cBuffers
=
2
;
RequestedProps
.
cbBuffer
=
65536
;
RequestedProps
.
cbAlign
=
1
;
RequestedProps
.
cbPrefix
=
0
;
/* Extant samples remain valid even after Decommit() is called. */
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_SetProperties
(
pMemAllocator
,
&
RequestedProps
,
&
ActualProps
);
ok
(
hr
==
S_OK
,
"SetProperties returned: %x
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_Commit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Commit returned: %x
\n
"
,
hr
);
hr
=
IMemAllocator_Commit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Commit returned: %x
\n
"
,
hr
);
hr
=
IMediaSample_GetPointer
(
sample
,
&
data
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
pMemAllocator
,
&
sample
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Could not get a buffer: %x
\n
"
,
hr
);
hr
=
IMemAllocator_Decommit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_Decommit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Decommit returned: %x
\n
"
,
hr
);
hr
=
IMemAllocator_Decommit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Cecommit returned: %x
\n
"
,
hr
);
memset
(
data
,
0xcc
,
65536
);
/* Decommit and recommit while holding a sample */
if
(
sample
)
{
hr
=
IMemAllocator_Commit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Commit returned: %x
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample2
,
NULL
,
NULL
,
0
);
ok
(
hr
==
VFW_E_NOT_COMMITTED
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
pMemAllocator
,
&
sample2
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Could not get a buffer: %x
\n
"
,
hr
);
IMediaSample_Release
(
sample
);
if
(
sample2
)
IMediaSample_Release
(
sample2
);
hr
=
IMemAllocator_Decommit
(
pMemAllocator
);
ok
(
hr
==
S_OK
,
"Cecommit returned: %x
\n
"
,
hr
);
}
IMemAllocator_Release
(
pMemAllocator
);
}
IMemAllocator_Release
(
allocator
);
}
START_TEST
(
memallocator
)
{
CoInitialize
(
NULL
);
CommitDecommitTes
t
();
test_commi
t
();
CoUninitialize
();
}
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