Zhiyi Zhang : user32/tests: Avoid unnecessary display mode changes.
Alexandre Julliard
julliard at winehq.org
Thu Apr 21 15:21:38 CDT 2022
Module: wine
Branch: master
Commit: 6c784f2c4648f12b75309aa3d2f1801bb0ac8528
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6c784f2c4648f12b75309aa3d2f1801bb0ac8528
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Mon Apr 18 14:55:14 2022 +0800
user32/tests: Avoid unnecessary display mode changes.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/monitor.c | 35 ++++-------------------------------
1 file changed, 4 insertions(+), 31 deletions(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index d0d4ff1f324..fdb13216ad9 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -484,8 +484,6 @@ static void test_ChangeDisplaySettingsEx(void)
}
if (pSetThreadDpiAwarenessContext && context)
pSetThreadDpiAwarenessContext(context);
- res = ChangeDisplaySettingsExA(NULL, NULL, NULL, CDS_RESET, NULL);
- ok(res == DISP_CHANGE_SUCCESSFUL, "Failed to reset default resolution: %ld\n", res);
/* Save the original mode for all devices so that they can be restored at the end of tests */
device_count = 0;
@@ -568,10 +566,6 @@ static void test_ChangeDisplaySettingsEx(void)
broken(res == DISP_CHANGE_BADPARAM) || /* win10 */
broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
"ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
- res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
- ok(res == DISP_CHANGE_SUCCESSFUL ||
- broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
- "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
}
/* Test that only specifying DM_POSITION in dmFields is not enough to detach an adapter */
@@ -2260,34 +2254,13 @@ static void test_display_dc(void)
SelectObject(mem_dc, old_hbitmap);
DeleteDC(mem_dc);
- /* Tests after mode changes to a different resolution */
- memset(&dm2, 0, sizeof(dm2));
- dm2.dmSize = sizeof(dm2);
- for (mode_idx = 0; EnumDisplaySettingsA(NULL, mode_idx, &dm2); ++mode_idx)
- {
- if (dm2.dmPelsWidth != dm.dmPelsWidth && dm2.dmPelsHeight != dm.dmPelsHeight)
- break;
- }
- ok(dm2.dmPelsWidth && dm2.dmPelsWidth != dm.dmPelsWidth && dm2.dmPelsHeight != dm.dmPelsHeight,
- "Failed to find a different resolution.\n");
-
- res = ChangeDisplaySettingsExA(NULL, &dm2, NULL, CDS_RESET, NULL);
- ok(res == DISP_CHANGE_SUCCESSFUL || broken(res == DISP_CHANGE_FAILED), /* Win8 TestBots */
- "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
- if (res == DISP_CHANGE_SUCCESSFUL)
- {
- check_display_dc(hdc, &dm2, FALSE);
-
- res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
- ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
- }
-
- /* Tests after mode changes to a different color depth */
+ /* Tests after mode changes to a mode with different resolution and color depth */
memset(&dm2, 0, sizeof(dm2));
dm2.dmSize = sizeof(dm2);
for (mode_idx = 0; EnumDisplaySettingsA(NULL, mode_idx, &dm2); ++mode_idx)
{
- if (dm2.dmBitsPerPel != dm.dmBitsPerPel && dm2.dmBitsPerPel != 1)
+ if (dm2.dmPelsWidth != dm.dmPelsWidth && dm2.dmPelsHeight != dm.dmPelsHeight &&
+ dm2.dmBitsPerPel != dm.dmBitsPerPel && dm2.dmBitsPerPel != 1)
break;
}
if (dm2.dmBitsPerPel && dm2.dmBitsPerPel != dm.dmBitsPerPel)
@@ -2357,7 +2330,7 @@ static void test_display_dc(void)
}
else
{
- win_skip("Failed to find a different color depth other than %lu.\n", dm.dmBitsPerPel);
+ win_skip("Failed to find a required display mode.\n");
}
if (hbitmap)
More information about the wine-cvs
mailing list