ReactOS  0.4.15-dev-1054-gd029a62
progress.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "wine/test.h"
#include "v6util.h"
Include dependency graph for progress.c:

Go to the source code of this file.

Macros

#define X(f)   p##f = (void*)GetProcAddress(hComCtl32, #f);
 

Functions

static BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX *)
 
static HWND create_progress (DWORD style)
 
static void flush_events (void)
 
static LRESULT CALLBACK progress_test_wnd_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK progress_subclass_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void update_window (HWND hWnd)
 
static void init (void)
 
static void cleanup (void)
 
static void test_redraw (void)
 
static void test_setcolors (void)
 
static void test_PBM_STEPIT (void)
 
static void init_functions (void)
 
 START_TEST (progress)
 

Variables

static HWND hProgressParentWnd
 
static const char progressTestClass [] = "ProgressBarTestClass"
 
static WNDPROC progress_wndproc
 
static BOOL erased
 
static RECT last_paint_rect
 

Macro Definition Documentation

◆ X

#define X (   f)    p##f = (void*)GetProcAddress(hComCtl32, #f);

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pInitCommonControlsEx) const
static

◆ cleanup()

static void cleanup ( void  )
static

Definition at line 125 of file progress.c.

126 {
127  MSG msg;
128 
130  while (GetMessageA(&msg,0,0,0)) {
133  }
134 
136 }
static const char progressTestClass[]
Definition: progress.c:33
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
#define WM_CLOSE
Definition: winuser.h:1603
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
static HWND hProgressParentWnd
Definition: progress.c:32

Referenced by START_TEST().

◆ create_progress()

static HWND create_progress ( DWORD  style)
static

Definition at line 36 of file progress.c.

37 {
39  0, 0, 100, 20, NULL, NULL, GetModuleHandleA(NULL), 0);
40 }
smooth NULL
Definition: ftsmooth.c:416
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define PROGRESS_CLASSA
Definition: commctrl.h:2171

Referenced by test_PBM_STEPIT(), and test_setcolors().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 43 of file progress.c.

44 {
45  MSG msg;
46  int diff = 100;
47  DWORD time = GetTickCount() + diff;
48 
49  while (diff > 0)
50  {
51  if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(10,diff), QS_ALLINPUT ) == WAIT_TIMEOUT) break;
52  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
53  diff = time - GetTickCount();
54  }
55 }
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
__u16 time
Definition: mkdosfs.c:366
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define QS_ALLINPUT
Definition: winuser.h:874
#define min(a, b)
Definition: monoChain.cc:55
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_redraw().

◆ init()

static void init ( void  )
static

Definition at line 97 of file progress.c.

98 {
99  WNDCLASSA wc;
100  RECT rect;
101  BOOL ret;
102 
103  wc.style = CS_HREDRAW | CS_VREDRAW;
104  wc.cbClsExtra = 0;
105  wc.cbWndExtra = 0;
107  wc.hIcon = NULL;
110  wc.lpszMenuName = NULL;
113  RegisterClassA(&wc);
114 
115  SetRect(&rect, 0, 0, 400, 20);
117  ok(ret, "got %d\n", ret);
118 
120  CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);
121  ok(hProgressParentWnd != NULL, "failed to create parent wnd\n");
122 
123 }
static const char progressTestClass[]
Definition: progress.c:33
int cbClsExtra
Definition: winuser.h:3140
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3146
HBRUSH hbrBackground
Definition: winuser.h:3145
#define COLOR_WINDOW
Definition: winuser.h:908
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
int cbWndExtra
Definition: winuser.h:3141
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HCURSOR hCursor
Definition: winuser.h:3144
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define CS_VREDRAW
Definition: winuser.h:653
static LRESULT CALLBACK progress_test_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: progress.c:57
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3138
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HINSTANCE hInstance
Definition: winuser.h:3142
#define ok(value,...)
Definition: atltest.h:57
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define IDC_ARROW
Definition: winuser.h:682
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HBRUSH WINAPI GetSysColorBrush(_In_ int)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143
static HWND hProgressParentWnd
Definition: progress.c:32

Referenced by START_TEST().

◆ init_functions()

static void init_functions ( void  )
static

Definition at line 311 of file progress.c.

312 {
313  HMODULE hComCtl32 = LoadLibraryA("comctl32.dll");
314 
315 #define X(f) p##f = (void*)GetProcAddress(hComCtl32, #f);
317 #undef X
318 }
#define X(f)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893

Referenced by START_TEST().

◆ progress_subclass_proc()

static LRESULT CALLBACK progress_subclass_proc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 76 of file progress.c.

77 {
78  if (msg == WM_PAINT)
79  {
81  }
82  else if (msg == WM_ERASEBKGND)
83  {
84  erased = TRUE;
85  }
87 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FALSE
Definition: types.h:117
static RECT last_paint_rect
Definition: progress.c:74
#define WM_PAINT
Definition: winuser.h:1602
static WNDPROC progress_wndproc
Definition: progress.c:72
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
static BOOL erased
Definition: progress.c:73
#define msg(x)
Definition: auth_time.c:54
#define WM_ERASEBKGND
Definition: winuser.h:1607
LPARAM lParam
Definition: combotst.c:139

Referenced by test_redraw().

◆ progress_test_wnd_proc()

static LRESULT CALLBACK progress_test_wnd_proc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 57 of file progress.c.

58 {
59  switch(msg) {
60 
61  case WM_DESTROY:
62  PostQuitMessage(0);
63  break;
64 
65  default:
66  return DefWindowProcA(hWnd, msg, wParam, lParam);
67  }
68 
69  return 0L;
70 }
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
#define WM_DESTROY
Definition: winuser.h:1591
static const WCHAR L[]
Definition: oid.c:1250
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by init().

◆ START_TEST()

START_TEST ( progress  )

Definition at line 320 of file progress.c.

321 {
322  INITCOMMONCONTROLSEX iccex;
323  ULONG_PTR ctx_cookie;
324  HANDLE hCtx;
325 
326  init_functions();
327 
328  iccex.dwSize = sizeof(iccex);
329  iccex.dwICC = ICC_PROGRESS_CLASS;
330  pInitCommonControlsEx(&iccex);
331 
332  init();
333 
334  test_redraw();
335  test_setcolors();
336  test_PBM_STEPIT();
337 
338  if (!load_v6_module(&ctx_cookie, &hCtx))
339  return;
340 
341  test_setcolors();
342  test_PBM_STEPIT();
343 
344  unload_v6_module(ctx_cookie, hCtx);
345 
346  cleanup();
347 }
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:63
static void cleanup(void)
Definition: progress.c:125
uint32_t ULONG_PTR
Definition: typedefs.h:65
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:71
static void test_setcolors(void)
Definition: progress.c:217
static void init_functions(void)
Definition: progress.c:311
static void test_redraw(void)
Definition: progress.c:143
static void test_PBM_STEPIT(void)
Definition: progress.c:245
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
static void init(void)
Definition: progress.c:97

◆ test_PBM_STEPIT()

static void test_PBM_STEPIT ( void  )
static

Definition at line 245 of file progress.c.

246 {
247  struct stepit_test
248  {
249  int min;
250  int max;
251  int step;
252  } stepit_tests[] =
253  {
254  { 3, 15, 5 },
255  { 3, 15, -5 },
256  { 3, 15, 50 },
257  { -15, 15, 5 },
258  { -3, -2, -5 },
259  { 0, 0, 1 },
260  { 5, 5, 1 },
261  { 0, 0, -1 },
262  { 5, 5, -1 },
263  { 10, 5, 2 },
264  };
265  HWND progress;
266  int i, j;
267 
268  for (i = 0; i < ARRAY_SIZE(stepit_tests); i++)
269  {
270  struct stepit_test *test = &stepit_tests[i];
271  PBRANGE range;
272  LRESULT ret;
273 
275 
277  ok(ret != 0, "Unexpected return value.\n");
278 
280  ok(range.iLow == test->min && range.iHigh == test->max, "Unexpected range.\n");
281 
284 
285  for (j = 0; j < test->max; j++)
286  {
287  int pos = SendMessageA(progress, PBM_GETPOS, 0, 0);
288  int current;
289 
290  pos += test->step;
291  if (test->min != test->max)
292  {
293  if (pos > test->max)
294  pos = (pos - test->min) % (test->max - test->min) + test->min;
295  if (pos < test->min)
296  pos = (pos - test->min) % (test->max - test->min) + test->max;
297  }
298  else
299  pos = test->min;
300 
302 
304  ok(current == pos, "%u: unexpected position %d, expected %d.\n", i, current, pos);
305  }
306 
308  }
309 }
#define max(a, b)
Definition: svc.c:63
#define PBM_SETRANGE32
Definition: commctrl.h:2184
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PBM_SETPOS
Definition: commctrl.h:2180
#define test
Definition: rosglue.h:37
#define PBM_GETRANGE
Definition: commctrl.h:2189
BOOL WINAPI DestroyWindow(_In_ HWND)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define PBM_STEPIT
Definition: commctrl.h:2183
LONG_PTR LPARAM
Definition: windef.h:208
#define PBM_SETSTEP
Definition: commctrl.h:2182
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
int ret
static HWND create_progress(DWORD style)
Definition: progress.c:36
GLenum GLint * range
Definition: glext.h:7539
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define min(a, b)
Definition: monoChain.cc:55
cd_progress_ptr progress
Definition: cdjpeg.h:152
LONG_PTR LRESULT
Definition: windef.h:209
#define PBM_GETPOS
Definition: commctrl.h:2190
struct task_struct * current
Definition: linux.c:32

Referenced by START_TEST().

◆ test_redraw()

static void test_redraw ( void  )
static

Definition at line 143 of file progress.c.

144 {
145  RECT client_rect, rect;
146  HWND hProgressWnd;
147  LRESULT ret;
148 
150  hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
151  0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
152  ok(hProgressWnd != NULL, "Failed to create progress bar.\n");
154 
156  ok(GetUpdateRect(hProgressParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
157  flush_events();
159 
160  SendMessageA(hProgressWnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
161  SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
162  SendMessageA(hProgressWnd, PBM_SETSTEP, 20, 0);
163  update_window(hProgressWnd);
164 
165  /* PBM_SETPOS */
166  ok(SendMessageA(hProgressWnd, PBM_SETPOS, 50, 0) == 10, "PBM_SETPOS must return the previous position\n");
167  ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
168 
169  /* PBM_DELTAPOS */
170  ok(SendMessageA(hProgressWnd, PBM_DELTAPOS, 15, 0) == 50, "PBM_DELTAPOS must return the previous position\n");
171  ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_DELTAPOS: The progress bar should be redrawn immediately\n");
172 
173  /* PBM_SETPOS */
174  ok(SendMessageA(hProgressWnd, PBM_SETPOS, 80, 0) == 65, "PBM_SETPOS must return the previous position\n");
175  ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_SETPOS: The progress bar should be redrawn immediately\n");
176 
177  /* PBM_STEPIT */
178  ok(SendMessageA(hProgressWnd, PBM_STEPIT, 0, 0) == 80, "PBM_STEPIT must return the previous position\n");
179  ok(!GetUpdateRect(hProgressWnd, NULL, FALSE), "PBM_STEPIT: The progress bar should be redrawn immediately\n");
180  ret = SendMessageA(hProgressWnd, PBM_GETPOS, 0, 0);
181  if (ret == 0)
182  win_skip("PBM_GETPOS needs comctl32 > 4.70\n");
183  else
184  ok(ret == 100, "PBM_GETPOS returned a wrong position : %d\n", (UINT)ret);
185 
186  /* PBM_SETRANGE and PBM_SETRANGE32:
187  Usually the progress bar doesn't repaint itself immediately. If the
188  position is not in the new range, it does.
189  Don't test this, it may change in future Windows versions. */
190 
191  SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
192  update_window(hProgressWnd);
193 
194  /* increase to 10 - no background erase required */
195  erased = FALSE;
197  SendMessageA(hProgressWnd, PBM_SETPOS, 10, 0);
198  GetClientRect(hProgressWnd, &client_rect);
199  ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
201  update_window(hProgressWnd);
202  ok(!erased, "Progress bar shouldn't have erased the background\n");
203 
204  /* decrease to 0 - background erase will be required */
205  erased = FALSE;
207  SendMessageA(hProgressWnd, PBM_SETPOS, 0, 0);
208  GetClientRect(hProgressWnd, &client_rect);
209  ok(EqualRect(&last_paint_rect, &client_rect), "last_paint_rect was %s instead of %s\n",
211  update_window(hProgressWnd);
212  ok(erased, "Progress bar should have erased the background\n");
213 
214  DestroyWindow(hProgressWnd);
215 }
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
#define PBM_SETPOS
Definition: commctrl.h:2180
#define WS_CHILD
Definition: pedump.c:617
static LRESULT CALLBACK progress_subclass_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: progress.c:76
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
static void update_window(HWND hWnd)
Definition: progress.c:90
& rect
Definition: startmenu.cpp:1413
#define PBM_SETRANGE
Definition: commctrl.h:2179
#define FALSE
Definition: types.h:117
static RECT last_paint_rect
Definition: progress.c:74
smooth NULL
Definition: ftsmooth.c:416
#define PBM_STEPIT
Definition: commctrl.h:2183
LONG_PTR LPARAM
Definition: windef.h:208
#define PBM_SETSTEP
Definition: commctrl.h:2182
const char * wine_dbgstr_rect(const RECT *rect)
static WNDPROC progress_wndproc
Definition: progress.c:72
int ret
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
#define SetWindowLongPtrA
Definition: winuser.h:5320
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static BOOL erased
Definition: progress.c:73
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define GWLP_WNDPROC
Definition: treelist.c:66
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SW_SHOWNORMAL
Definition: winuser.h:764
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
#define PBM_DELTAPOS
Definition: commctrl.h:2181
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static void flush_events(void)
Definition: progress.c:43
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
LONG_PTR LRESULT
Definition: windef.h:209
#define WS_VISIBLE
Definition: pedump.c:620
#define win_skip
Definition: test.h:149
#define PBM_GETPOS
Definition: commctrl.h:2190
#define PROGRESS_CLASSA
Definition: commctrl.h:2171
static HWND hProgressParentWnd
Definition: progress.c:32

Referenced by START_TEST().

◆ test_setcolors()

static void test_setcolors ( void  )
static

Definition at line 217 of file progress.c.

218 {
219  HWND progress;
220  COLORREF clr;
221 
223 
224  clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, 0);
225  ok(clr == CLR_DEFAULT, "got %x\n", clr);
226 
227  clr = SendMessageA(progress, PBM_SETBARCOLOR, 0, RGB(0, 255, 0));
228  ok(clr == 0, "got %x\n", clr);
229 
231  ok(clr == RGB(0, 255, 0), "got %x\n", clr);
232 
233  clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, 0);
234  ok(clr == CLR_DEFAULT, "got %x\n", clr);
235 
236  clr = SendMessageA(progress, PBM_SETBKCOLOR, 0, RGB(255, 0, 0));
237  ok(clr == 0, "got %x\n", clr);
238 
240  ok(clr == RGB(255, 0, 0), "got %x\n", clr);
241 
243 }
#define PBS_SMOOTH
Definition: commctrl.h:2176
#define RGB(r, g, b)
Definition: precomp.h:62
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD COLORREF
Definition: windef.h:300
static HWND create_progress(DWORD style)
Definition: progress.c:36
#define PBM_SETBARCOLOR
Definition: commctrl.h:2191
#define ok(value,...)
Definition: atltest.h:57
cd_progress_ptr progress
Definition: cdjpeg.h:152
#define CLR_DEFAULT
Definition: commctrl.h:316
#define PBM_SETBKCOLOR
Definition: commctrl.h:2192

Referenced by START_TEST().

◆ update_window()

static void update_window ( HWND  hWnd)
static

Definition at line 90 of file progress.c.

91 {
93  ok(!GetUpdateRect(hWnd, NULL, FALSE), "GetUpdateRect must return zero after UpdateWindow\n");
94 }
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_redraw().

Variable Documentation

◆ erased

BOOL erased
static

Definition at line 73 of file progress.c.

Referenced by progress_subclass_proc(), and test_redraw().

◆ hProgressParentWnd

HWND hProgressParentWnd
static

Definition at line 32 of file progress.c.

Referenced by cleanup(), init(), and test_redraw().

◆ last_paint_rect

RECT last_paint_rect
static

Definition at line 74 of file progress.c.

Referenced by progress_subclass_proc(), and test_redraw().

◆ progress_wndproc

WNDPROC progress_wndproc
static

Definition at line 72 of file progress.c.

Referenced by progress_subclass_proc(), and test_redraw().

◆ progressTestClass

const char progressTestClass[] = "ProgressBarTestClass"
static

Definition at line 33 of file progress.c.

Referenced by cleanup(), and init().