I prepared fix https://gitlab.winehq.org/wine/wine/-/commit/b45ad56, that I didn't provide test for, but now I find a way to check it.
-- v2: comctl32/rebar: Add chevron test.
From: Ilia Docin ilya.docin@contentai.ru
--- dlls/comctl32/tests/rebar.c | 48 +++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index 7cafa4ba52b..aeb90ecf7bf 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -121,6 +121,7 @@ static HWND build_toolbar(int nr, HWND hParent) }
static int g_parent_measureitem; +static RECT g_chevron_rect;
static LRESULT CALLBACK parent_wndproc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -129,8 +130,17 @@ static LRESULT CALLBACK parent_wndproc(HWND hWnd, UINT msg, WPARAM wParam, LPARA case WM_NOTIFY: { NMHDR *lpnm = (NMHDR *)lParam; - if (lpnm->code == RBN_HEIGHTCHANGE) - GetClientRect(lpnm->hwndFrom, &height_change_notify_rect); + switch (lpnm->code) + { + case RBN_HEIGHTCHANGE: + GetClientRect(lpnm->hwndFrom, &height_change_notify_rect); + break; + case RBN_CHEVRONPUSHED: + g_chevron_rect = ((NMREBARCHEVRON*)lParam)->rc; + break; + default: + break; + } } break; case WM_MEASUREITEM: @@ -1178,6 +1188,39 @@ static void init_functions(void) #undef X }
+static void test_chevron(void) +{ + HWND hRebar; + REBARBANDINFOA rbi; + + hRebar = create_rebar_control(0); + rbi.cbSize = REBARBANDINFOA_V6_SIZE; + rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_STYLE; + rbi.cxIdeal = 128; + rbi.cx = rbi.cxIdeal >> 1; + rbi.cxMinChild = rbi.cxIdeal >> 2; + rbi.cyMinChild = rbi.cxMinChild; + rbi.hwndChild = build_toolbar(1, hRebar); + rbi.fStyle = RBBS_USECHEVRON | RBBS_NOGRIPPER; + SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rbi); + SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rbi); + + SetRectEmpty(&g_chevron_rect); + SendMessageA(hRebar, RB_PUSHCHEVRON, 0, 0); + ok(!IsRectEmpty(&g_chevron_rect), "Unexpected empty chevron rect\n"); + + // increase band width to make it more then ideal value to hide chevron + rbi.fMask = RBBIM_SIZE; + rbi.cx = rbi.cxIdeal << 1; + SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rbi); + + SetRectEmpty(&g_chevron_rect); + SendMessageA(hRebar, RB_PUSHCHEVRON, 0, 0); + ok(IsRectEmpty(&g_chevron_rect), "Unexpected non-empty chevron rect\n"); + + DestroyWindow(hRebar); +} + START_TEST(rebar) { MSG msg; @@ -1201,6 +1244,7 @@ START_TEST(rebar) test_layout(); test_resize(); test_style(); + test_chevron();
out: PostQuitMessage(0);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147086
Your paranoid android.
=== w10pro64_en_AE_u8 (32 bit report) ===
comctl32: rebar.c:958: Test failed: expected 35 for 38 from line 999 rebar.c:958: Test failed: expected 40 for 43 from line 1005 rebar.c:958: Test failed: expected 40 for 43 from line 1024
On Sun Jul 14 18:45:29 2024 +0000, Zhiyi Zhang wrote:
The fix is already in. Don't revert it and then apply it again. You can just add the tests.
Ok, removed extra commits.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/rebar.c:
- rbi.cyMinChild = rbi.cxMinChild;
- rbi.hwndChild = build_toolbar(1, hRebar);
- rbi.fStyle = RBBS_USECHEVRON | RBBS_NOGRIPPER;
- SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rbi);
- SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rbi);
- SetRectEmpty(&g_chevron_rect);
- SendMessageA(hRebar, RB_PUSHCHEVRON, 0, 0);
- ok(!IsRectEmpty(&g_chevron_rect), "Unexpected empty chevron rect\n");
- // increase band width to make it more then ideal value to hide chevron
- rbi.fMask = RBBIM_SIZE;
- rbi.cx = rbi.cxIdeal << 1;
- SendMessageA(hRebar, RB_SETBANDINFOA, 0, (LPARAM)&rbi);
- SetRectEmpty(&g_chevron_rect);
I don't think you should set g_chevron_rect empty. You should do the opposite because you're checking for an empty rectangle from the RB_PUSHCHEVRON message.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/rebar.c:
case WM_NOTIFY: { NMHDR *lpnm = (NMHDR *)lParam;
if (lpnm->code == RBN_HEIGHTCHANGE)
GetClientRect(lpnm->hwndFrom, &height_change_notify_rect);
switch (lpnm->code)
{
case RBN_HEIGHTCHANGE:
GetClientRect(lpnm->hwndFrom, &height_change_notify_rect);
break;
case RBN_CHEVRONPUSHED:
g_chevron_rect = ((NMREBARCHEVRON*)lParam)->rc;
Add a space before the asterisk.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/rebar.c:
}
Please change the patch commit subject to "comctl32/test: Add rebar chevron visibility test."
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/rebar.c:
- rbi.cbSize = REBARBANDINFOA_V6_SIZE;
- rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_STYLE;
- rbi.cxIdeal = 128;
- rbi.cx = rbi.cxIdeal >> 1;
- rbi.cxMinChild = rbi.cxIdeal >> 2;
- rbi.cyMinChild = rbi.cxMinChild;
- rbi.hwndChild = build_toolbar(1, hRebar);
- rbi.fStyle = RBBS_USECHEVRON | RBBS_NOGRIPPER;
- SendMessageA(hRebar, RB_INSERTBANDA, 0, (LPARAM)&rbi);
- SendMessageA(hRebar, RB_INSERTBANDA, 1, (LPARAM)&rbi);
- SetRectEmpty(&g_chevron_rect);
- SendMessageA(hRebar, RB_PUSHCHEVRON, 0, 0);
- ok(!IsRectEmpty(&g_chevron_rect), "Unexpected empty chevron rect\n");
- // increase band width to make it more then ideal value to hide chevron
Please use /**/ instead of //
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/rebar.c:
#undef X }
+static void test_chevron(void) +{
- HWND hRebar;
- REBARBANDINFOA rbi;
- hRebar = create_rebar_control(0);
- rbi.cbSize = REBARBANDINFOA_V6_SIZE;
- rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_STYLE;
- rbi.cxIdeal = 128;
- rbi.cx = rbi.cxIdeal >> 1;
Why do you use >> 1 and >> 2 to adjust width. You should check that the chevron appears when cx is less than cxIdeal. And the chevron disappears when cx equals to or is greater than cxIdeal. So cx should be cxIdeal - 1.