Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/tests/progress.c:
+ msg.flags |= defwinproc; + msg.wParam = wp; + msg.lParam = lp; + add_message(sequences, CHILD_SEQ_INDEX, &msg); + } + + ++defwndproc_counter; + ret = CallWindowProcA(old_proc, hwnd, message, wp, lp); + --defwndproc_counter; + return ret; +} + +void test_bar_states(void) +{ + HWND progress_bar; + int test_states[6] = {PBST_NORMAL, PBST_PAUSED, PBST_ERROR, PBST_ERROR, 0, PBFS_PARTIAL}; I think it would be cleaner if you organize the test data like the following
static const struct
{
DWORD state;
DWORD previous_state;
const struct message *expected_seq;
BOOL todo;
}
tests[] =
{
{0, 0, pbm_setstate_seq},
{PBST_NORMAL, PBST_NORMAL, pbm_setstate_seq},
{PBST_PAUSED, PBST_NORMAL, paint_pbm_setstate_seq},
{PBST_PAUSED, PBST_PAUSED, pbm_setstate_seq},
{PBST_ERROR, PBST_PAUSED, paint_pbm_setstate_seq},
{PBST_ERROR, PBST_ERROR, pbm_setstate_seq},
{PBFS_PARTIAL, 0, pbm_setstate_seq},
}
Then in a loop. You first set to tests[i].state, expected tests[i].previous_state returned from PBM_SETSTATE, expect the current state being tests[i].state from PBM_GETSTATE and expect the result message sequence to be tests[i].expected_seq. Then add todo_wine_if(tests[i].todo) as needed. This way, you can avoid the if conditions in the code. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6186#note_77800