This adds brackets to make the comparison work and therefore the variable `scaled` gets set.
Otherwise `scaled` and later `expect_width` and `expect_height` stays all zeros.
https://test.winehq.org/data/patterns-tb-wine.html#user32:monitor
This testbot run has this change applied: https://testbot.winehq.org/JobDetails.pl?Key=151521
-- v2: user32/tests: Fix monitor dpi awareness test.
From: Bernhard Übelacker bernhardu@mailbox.org
--- dlls/user32/tests/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 30a25e53fe3..97eddbc60bd 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -3212,7 +3212,7 @@ static void test_monitor_dpi_awareness( const struct monitor_info *infos, UINT c { if (infos[i].rect.left == 0 && infos[i].rect.top == 0) primary = infos[i].rect;
- if (info - infos + i) UnionRect( &scaled_virtual, &scaled_virtual, &infos[i].rect ); + if (info != infos + i) UnionRect( &scaled_virtual, &scaled_virtual, &infos[i].rect ); else { scaled = monitor = infos[i].rect;
On Thu Feb 27 15:51:49 2025 +0000, Bernhard Übelacker wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/7435/diffs?diff_id=160846&start_sha=7f12940badf820d2103b27a50d919ae21201486b#1a2fc38375b48458ba2fb34a2716bf76579d9527_3215_3215)
If I understand it right the intention seems to be to detect the case when `info != infos[i]`. And the result of the substraction seems to be just an integer type, therefore the addition increases just by bytes not sizeof(*infos). In case of i==0 it the version `info - infos + i` works, but not when info points to the second record in infos.
And yes, `info != infos + i` would make the intention clearer, so I pushed this version.
v2: - replace `info - (infos + i)` by `info != infos + i` to improve readability.
This is a new testbot run: https://testbot.winehq.org/JobDetails.pl?Key=151523
On Thu Feb 27 16:07:16 2025 +0000, Bernhard Übelacker wrote:
If I understand it right the intention seems to be to detect the case when `info != infos[i]`. And the result of the substraction seems to be just an integer type, therefore the addition increases just by bytes not sizeof(*infos). In case of i==0 it the version `info - infos + i` works, but not when info points to the second record in infos. And yes, `info != infos + i` would make the intention clearer, so I pushed this version.
Right of course, duh.
This merge request was approved by Rémi Bernon.