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
a8ee0575
Commit
a8ee0575
authored
May 28, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfmediaengine/tests: Add some tests for shutdown state.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9de7895e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
197 additions
and
1 deletion
+197
-1
Makefile.in
dlls/mfmediaengine/tests/Makefile.in
+1
-1
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
+196
-0
No files found.
dlls/mfmediaengine/tests/Makefile.in
View file @
a8ee0575
TESTDLL
=
mfmediaengine.dll
TESTDLL
=
mfmediaengine.dll
IMPORTS
=
ole32 mfplat mfmediaengine mfuuid uuid
IMPORTS
=
ole32 mfplat mfmediaengine
oleaut32
mfuuid uuid
C_SRCS
=
\
C_SRCS
=
\
mfmediaengine.c
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
View file @
a8ee0575
...
@@ -105,6 +105,34 @@ static IMFMediaEngineNotifyVtbl media_engine_notify_vtbl =
...
@@ -105,6 +105,34 @@ static IMFMediaEngineNotifyVtbl media_engine_notify_vtbl =
media_engine_notify_EventNotify
,
media_engine_notify_EventNotify
,
};
};
static
IMFMediaEngine
*
create_media_engine
(
IMFMediaEngineNotify
*
callback
)
{
IMFDXGIDeviceManager
*
manager
;
IMFMediaEngine
*
media_engine
;
IMFAttributes
*
attributes
;
UINT
token
;
HRESULT
hr
;
hr
=
pMFCreateDXGIDeviceManager
(
&
token
,
&
manager
);
ok
(
hr
==
S_OK
,
"Failed to create dxgi device manager, hr %#x.
\n
"
,
hr
);
hr
=
MFCreateAttributes
(
&
attributes
,
3
);
ok
(
hr
==
S_OK
,
"Failed to create attributes, hr %#x.
\n
"
,
hr
);
hr
=
IMFAttributes_SetUnknown
(
attributes
,
&
MF_MEDIA_ENGINE_CALLBACK
,
(
IUnknown
*
)
callback
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFAttributes_SetUINT32
(
attributes
,
&
MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT
,
DXGI_FORMAT_UNKNOWN
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngineClassFactory_CreateInstance
(
factory
,
0
,
attributes
,
&
media_engine
);
ok
(
hr
==
S_OK
,
"Failed to create media engine, hr %#x.
\n
"
,
hr
);
IMFAttributes_Release
(
attributes
);
IMFDXGIDeviceManager_Release
(
manager
);
return
media_engine
;
}
static
void
test_factory
(
void
)
static
void
test_factory
(
void
)
{
{
struct
media_engine_notify
notify_impl
=
{{
&
media_engine_notify_vtbl
},
1
};
struct
media_engine_notify
notify_impl
=
{{
&
media_engine_notify_vtbl
},
1
};
...
@@ -204,6 +232,173 @@ static void test_CreateInstance(void)
...
@@ -204,6 +232,173 @@ static void test_CreateInstance(void)
IMFDXGIDeviceManager_Release
(
manager
);
IMFDXGIDeviceManager_Release
(
manager
);
}
}
static
void
test_Shutdown
(
void
)
{
struct
media_engine_notify
notify_impl
=
{{
&
media_engine_notify_vtbl
},
1
};
IMFMediaEngineNotify
*
callback
=
&
notify_impl
.
IMFMediaEngineNotify_iface
;
IMFMediaTimeRange
*
time_range
;
IMFMediaEngine
*
media_engine
;
unsigned
int
state
;
DWORD
cx
,
cy
;
double
val
;
HRESULT
hr
;
BSTR
str
;
media_engine
=
create_media_engine
(
callback
);
hr
=
IMFMediaEngine_Shutdown
(
media_engine
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to shut down, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_Shutdown
(
media_engine
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
||
broken
(
hr
==
S_OK
)
/* before win10 */
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_SetSource
(
media_engine
,
NULL
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_GetCurrentSource
(
media_engine
,
&
str
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_GetNetworkState
(
media_engine
);
ok
(
!
state
,
"Unexpected state %d.
\n
"
,
state
);
/* Preload mode is still accessible. */
state
=
IMFMediaEngine_GetPreload
(
media_engine
);
todo_wine
ok
(
!
state
,
"Unexpected state %d.
\n
"
,
state
);
hr
=
IMFMediaEngine_SetPreload
(
media_engine
,
MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_GetPreload
(
media_engine
);
todo_wine
ok
(
state
==
MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC
,
"Unexpected state %d.
\n
"
,
state
);
hr
=
IMFMediaEngine_GetBuffered
(
media_engine
,
&
time_range
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_Load
(
media_engine
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
str
=
SysAllocString
(
L"video/mp4"
);
hr
=
IMFMediaEngine_CanPlayType
(
media_engine
,
str
,
&
state
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
SysFreeString
(
str
);
state
=
IMFMediaEngine_GetReadyState
(
media_engine
);
ok
(
!
state
,
"Unexpected state %d.
\n
"
,
state
);
state
=
IMFMediaEngine_IsSeeking
(
media_engine
);
ok
(
!
state
,
"Unexpected state %d.
\n
"
,
state
);
val
=
IMFMediaEngine_GetCurrentTime
(
media_engine
);
ok
(
val
==
0
.
0
,
"Unexpected time %f.
\n
"
,
val
);
hr
=
IMFMediaEngine_SetCurrentTime
(
media_engine
,
1
.
0
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
val
=
IMFMediaEngine_GetStartTime
(
media_engine
);
ok
(
val
==
0
.
0
,
"Unexpected time %f.
\n
"
,
val
);
state
=
IMFMediaEngine_IsPaused
(
media_engine
);
todo_wine
ok
(
!!
state
,
"Unexpected state %d.
\n
"
,
state
);
val
=
IMFMediaEngine_GetDefaultPlaybackRate
(
media_engine
);
todo_wine
ok
(
val
==
1
.
0
,
"Unexpected rate %f.
\n
"
,
val
);
hr
=
IMFMediaEngine_SetDefaultPlaybackRate
(
media_engine
,
2
.
0
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
val
=
IMFMediaEngine_GetPlaybackRate
(
media_engine
);
todo_wine
ok
(
val
==
1
.
0
,
"Unexpected rate %f.
\n
"
,
val
);
hr
=
IMFMediaEngine_GetPlayed
(
media_engine
,
&
time_range
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_GetSeekable
(
media_engine
,
&
time_range
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_IsEnded
(
media_engine
);
ok
(
!
state
,
"Unexpected state %d.
\n
"
,
state
);
/* Autoplay mode is still accessible. */
state
=
IMFMediaEngine_GetAutoPlay
(
media_engine
);
ok
(
!
state
,
"Unexpected state.
\n
"
);
hr
=
IMFMediaEngine_SetAutoPlay
(
media_engine
,
TRUE
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_GetAutoPlay
(
media_engine
);
todo_wine
ok
(
!!
state
,
"Unexpected state.
\n
"
);
/* Loop mode is still accessible. */
state
=
IMFMediaEngine_GetLoop
(
media_engine
);
ok
(
!
state
,
"Unexpected state.
\n
"
);
hr
=
IMFMediaEngine_SetLoop
(
media_engine
,
TRUE
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_GetLoop
(
media_engine
);
todo_wine
ok
(
!!
state
,
"Unexpected state.
\n
"
);
hr
=
IMFMediaEngine_Play
(
media_engine
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_Pause
(
media_engine
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_GetMuted
(
media_engine
);
ok
(
!
state
,
"Unexpected state.
\n
"
);
hr
=
IMFMediaEngine_SetMuted
(
media_engine
,
TRUE
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
val
=
IMFMediaEngine_GetVolume
(
media_engine
);
todo_wine
ok
(
val
==
1
.
0
,
"Unexpected value %f.
\n
"
,
val
);
val
=
IMFMediaEngine_SetVolume
(
media_engine
,
2
.
0
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
state
=
IMFMediaEngine_HasVideo
(
media_engine
);
ok
(
!
state
,
"Unexpected state.
\n
"
);
state
=
IMFMediaEngine_HasAudio
(
media_engine
);
ok
(
!
state
,
"Unexpected state.
\n
"
);
hr
=
IMFMediaEngine_GetNativeVideoSize
(
media_engine
,
&
cx
,
&
cy
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngine_GetVideoAspectRatio
(
media_engine
,
&
cx
,
&
cy
);
todo_wine
ok
(
hr
==
MF_E_SHUTDOWN
,
"Unexpected hr %#x.
\n
"
,
hr
);
IMFMediaEngine_Release
(
media_engine
);
}
START_TEST
(
mfmediaengine
)
START_TEST
(
mfmediaengine
)
{
{
HRESULT
hr
;
HRESULT
hr
;
...
@@ -226,6 +421,7 @@ START_TEST(mfmediaengine)
...
@@ -226,6 +421,7 @@ START_TEST(mfmediaengine)
test_factory
();
test_factory
();
test_CreateInstance
();
test_CreateInstance
();
test_Shutdown
();
IMFMediaEngineClassFactory_Release
(
factory
);
IMFMediaEngineClassFactory_Release
(
factory
);
...
...
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