From: Esme Povirk esme@codeweavers.com
--- dlls/comctl32/progress.c | 1 + dlls/comctl32/tests/progress.c | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+)
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c index b22fe5b9c44..aae2d8f8660 100644 --- a/dlls/comctl32/progress.c +++ b/dlls/comctl32/progress.c @@ -520,6 +520,7 @@ static UINT PROGRESS_SetPos (PROGRESS_INFO *infoPtr, INT pos) TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); UpdateWindow( infoPtr->Self ); + NotifyWinEvent( EVENT_OBJECT_VALUECHANGE, infoPtr->Self, OBJID_CLIENT, 0 ); } return oldVal; } diff --git a/dlls/comctl32/tests/progress.c b/dlls/comctl32/tests/progress.c index 1ccd3295724..f228ac84d2e 100644 --- a/dlls/comctl32/tests/progress.c +++ b/dlls/comctl32/tests/progress.c @@ -443,6 +443,62 @@ void test_bar_states(void) DestroyWindow(progress_bar); }
+static const struct message step_seq[] = +{ + {PBM_SETRANGE, sent}, + {PBM_SETPOS, sent}, + {EVENT_OBJECT_VALUECHANGE, winevent_hook, OBJID_CLIENT, 0}, + {PBM_SETPOS, sent}, + {PBM_SETSTEP, sent}, + {0} +}; + +static LRESULT WINAPI test_pbm_step_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) +{ + static int defwndproc_counter = 0; + struct message msg = {0}; + LRESULT ret; + + if (message == PBM_SETSTEP + || message == PBM_SETRANGE + || message == PBM_SETPOS) + { + msg.message = message; + msg.flags = sent | wparam | lparam; + if (defwndproc_counter) + 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_step_messages(void) +{ + HWND progress_bar; + + progress_bar = create_progress(0); + + old_proc = (WNDPROC)SetWindowLongPtrA(progress_bar, GWLP_WNDPROC, (LONG_PTR)test_pbm_step_proc); + + flush_events(); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + SendMessageA(progress_bar, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); + SendMessageA(progress_bar, PBM_SETPOS, 10, 0); + SendMessageA(progress_bar, PBM_SETPOS, 10, 0); + SendMessageA(progress_bar, PBM_SETSTEP, 20, 0); + + ok_sequence(sequences, CHILD_SEQ_INDEX, step_seq, "step_seq", FALSE); + + DestroyWindow(progress_bar); +} + static void init_functions(void) { HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); @@ -479,6 +535,7 @@ START_TEST(progress) test_setcolors(); test_PBM_STEPIT(); test_bar_states(); + test_step_messages();
uninit_winevent_hook();