Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
5030f4cf
Commit
5030f4cf
authored
Sep 20, 2021
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Sep 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi/tests: Add display device interface tests.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
37ceea64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
misc.c
dlls/setupapi/tests/misc.c
+85
-0
No files found.
dlls/setupapi/tests/misc.c
View file @
5030f4cf
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
#include "winnls.h"
#include "winnls.h"
#include "winuser.h"
#include "winuser.h"
#include "winreg.h"
#include "winreg.h"
#include "devguid.h"
#include "initguid.h"
#include "ntddvdeo.h"
#include "setupapi.h"
#include "setupapi.h"
#include "cfgmgr32.h"
#include "cfgmgr32.h"
...
@@ -819,6 +822,87 @@ static void test_CM_Get_Version(void)
...
@@ -819,6 +822,87 @@ static void test_CM_Get_Version(void)
ok
(
ret
==
0x0400
,
"got version %#x
\n
"
,
ret
);
ok
(
ret
==
0x0400
,
"got version %#x
\n
"
,
ret
);
}
}
#define check_device_interface(a, b) _check_device_interface(__LINE__, a, b)
static
void
_check_device_interface
(
int
line
,
const
char
*
instance_id
,
const
GUID
*
guid
)
{
SP_DEVICE_INTERFACE_DATA
iface_data
=
{
sizeof
(
iface_data
)};
SP_DEVINFO_DATA
device_data
=
{
sizeof
(
device_data
)};
HDEVINFO
devinfo
;
BOOL
ret
;
devinfo
=
SetupDiGetClassDevsA
(
guid
,
instance_id
,
NULL
,
DIGCF_DEVICEINTERFACE
|
DIGCF_PRESENT
);
ret
=
SetupDiEnumDeviceInfo
(
devinfo
,
0
,
&
device_data
);
ok_
(
__FILE__
,
line
)(
ret
||
broken
(
!
ret
)
/* <= Win7 */
,
"SetupDiEnumDeviceInfo failed, error %u.
\n
"
,
GetLastError
());
if
(
!
ret
)
{
SetupDiDestroyDeviceInfoList
(
devinfo
);
return
;
}
ret
=
SetupDiEnumDeviceInterfaces
(
devinfo
,
&
device_data
,
guid
,
0
,
&
iface_data
);
ok_
(
__FILE__
,
line
)(
ret
,
"SetupDiEnumDeviceInterfaces failed, error %u.
\n
"
,
GetLastError
());
ok_
(
__FILE__
,
line
)(
IsEqualGUID
(
&
iface_data
.
InterfaceClassGuid
,
guid
),
"Expected guid %s, got %s.
\n
"
,
wine_dbgstr_guid
(
guid
),
wine_dbgstr_guid
(
&
iface_data
.
InterfaceClassGuid
));
SetupDiDestroyDeviceInfoList
(
devinfo
);
}
static
void
test_device_interfaces
(
void
)
{
SP_DEVICE_INTERFACE_DATA
iface_data
=
{
sizeof
(
iface_data
)};
SP_DEVINFO_DATA
device_data
=
{
sizeof
(
device_data
)};
char
instance_id
[
MAX_DEVICE_ID_LEN
];
DWORD
device_idx
=
0
,
size
,
error
;
HDEVINFO
devinfo
;
BOOL
ret
;
/* GPUs */
devinfo
=
SetupDiGetClassDevsW
(
&
GUID_DEVCLASS_DISPLAY
,
NULL
,
NULL
,
DIGCF_PRESENT
);
ok
(
devinfo
!=
INVALID_HANDLE_VALUE
,
"SetupDiGetClassDevsW failed, error %u.
\n
"
,
GetLastError
());
while
((
ret
=
SetupDiEnumDeviceInfo
(
devinfo
,
device_idx
,
&
device_data
)))
{
ret
=
SetupDiGetDeviceInstanceIdA
(
devinfo
,
&
device_data
,
instance_id
,
ARRAY_SIZE
(
instance_id
),
&
size
);
ok
(
ret
,
"SetupDiGetDeviceInstanceIdA failed, error %u.
\n
"
,
GetLastError
());
winetest_push_context
(
"GPU %d"
,
device_idx
);
check_device_interface
(
instance_id
,
&
GUID_DEVINTERFACE_DISPLAY_ADAPTER
);
check_device_interface
(
instance_id
,
&
GUID_DISPLAY_DEVICE_ARRIVAL
);
winetest_pop_context
();
++
device_idx
;
}
error
=
GetLastError
();
ok
(
error
==
ERROR_NO_MORE_ITEMS
,
"Expected error %u, got %u.
\n
"
,
ERROR_NO_MORE_ITEMS
,
error
);
ok
(
device_idx
>
0
,
"Expected at least one GPU.
\n
"
);
SetupDiDestroyDeviceInfoList
(
devinfo
);
/* Monitors */
device_idx
=
0
;
devinfo
=
SetupDiGetClassDevsW
(
&
GUID_DEVCLASS_MONITOR
,
L"DISPLAY"
,
NULL
,
DIGCF_PRESENT
);
ok
(
devinfo
!=
INVALID_HANDLE_VALUE
,
"SetupDiGetClassDevsW failed, error %u.
\n
"
,
GetLastError
());
while
((
ret
=
SetupDiEnumDeviceInfo
(
devinfo
,
device_idx
,
&
device_data
)))
{
ret
=
SetupDiGetDeviceInstanceIdA
(
devinfo
,
&
device_data
,
instance_id
,
ARRAY_SIZE
(
instance_id
),
&
size
);
ok
(
ret
,
"SetupDiGetDeviceInstanceIdA failed, error %u.
\n
"
,
GetLastError
());
winetest_push_context
(
"Monitor %d"
,
device_idx
);
check_device_interface
(
instance_id
,
&
GUID_DEVINTERFACE_MONITOR
);
winetest_pop_context
();
++
device_idx
;
}
error
=
GetLastError
();
ok
(
error
==
ERROR_NO_MORE_ITEMS
,
"Expected error %u, got %u.
\n
"
,
ERROR_NO_MORE_ITEMS
,
error
);
ok
(
device_idx
>
0
||
broken
(
device_idx
==
0
)
/* w7u_2qxl TestBot */
,
"Expected at least one monitor.
\n
"
);
SetupDiDestroyDeviceInfoList
(
devinfo
);
}
START_TEST
(
misc
)
START_TEST
(
misc
)
{
{
HMODULE
hsetupapi
=
GetModuleHandleA
(
"setupapi.dll"
);
HMODULE
hsetupapi
=
GetModuleHandleA
(
"setupapi.dll"
);
...
@@ -841,4 +925,5 @@ START_TEST(misc)
...
@@ -841,4 +925,5 @@ START_TEST(misc)
test_defaultcallback
();
test_defaultcallback
();
test_SetupLogError
();
test_SetupLogError
();
test_CM_Get_Version
();
test_CM_Get_Version
();
test_device_interfaces
();
}
}
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