ReactOS  0.4.14-dev-115-g4576127
RedrawWindow.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS API tests
3  * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE: Test for RedrawWindow
5  * COPYRIGHT: Copyright 2018 Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #include "precomp.h"
9 
11 static BOOL got_paint;
12 
13 static
14 LRESULT
17  _In_ HWND hWnd,
21 {
22  ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId);
23  if (message == WM_PAINT)
24  {
25  got_paint = TRUE;
26  }
28 }
29 
30 
32 {
33  HWND hWnd;
34  MSG msg;
35  HRGN hRgn;
36  BOOL ret;
37  int i;
38 
39  SetCursorPos(0,0);
40 
42  RegisterSimpleClass(WndProc, L"CreateTest");
43 
44  hWnd = CreateWindowExW(0, L"CreateTest", NULL, 0, 10, 10, 20, 20, NULL, NULL, 0, NULL);
45  ok(hWnd != NULL, "CreateWindow failed\n");
46 
48 
49  while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
50  {
52  }
53 
54  ok(got_paint == TRUE, "Did not process WM_PAINT message\n");
55  got_paint = FALSE;
56 
57  hRgn = CreateRectRgn(0, 0, 1, 1);
58  ok(hRgn != NULL, "CreateRectRgn failed\n");
60  ok(ret == TRUE, "RedrawWindow failed\n");
61 
62  i = 0;
63  while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
64  {
65  RECORD_MESSAGE(1, msg.message, POST, 0, 0);
66  if (msg.message == WM_PAINT)
67  {
68  i++;
69  if (i == 10)
70  {
71  ok(got_paint == FALSE, "Received unexpected WM_PAINT message\n");
72  }
73  }
74  if (msg.message != WM_PAINT || i >= 10)
75  {
77  }
78  }
79 
80  ok(i == 10, "Received %d WM_PAINT messages\n", i);
81  ok(got_paint == TRUE, "Did not process WM_PAINT message\n");
82 
83  TRACE_CACHE();
84 
87 }
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
Definition: tftpd.h:59
#define PeekMessage
Definition: winuser.h:5731
#define TRUE
Definition: types.h:120
static BOOL got_paint
Definition: RedrawWindow.c:11
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
static HRGN hRgn
Definition: mapping.c:33
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
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
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD dwThreadId
Definition: RedrawWindow.c:10
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
unsigned long DWORD
Definition: ntddk_ex.h:95
static LRESULT CALLBACK WndProc(_In_ HWND hWnd, _In_ UINT message, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: RedrawWindow.c:16
#define WM_PAINT
Definition: winuser.h:1602
int ret
START_TEST(RedrawWindow)
Definition: RedrawWindow.c:31
Definition: msgtrace.h:7
static const WCHAR L[]
Definition: oid.c:1250
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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 RDW_INTERNALPAINT
Definition: winuser.h:1199
#define _In_
Definition: no_sal2.h:204
#define TRACE_CACHE()
Definition: msgtrace.h:58
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
#define msg(x)
Definition: auth_time.c:54
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
#define PM_REMOVE
Definition: winuser.h:1182
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define RDW_INVALIDATE
Definition: winuser.h:1200