ReactOS  0.4.14-dev-599-g2d4d3f5
animate.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 dependency graph for animate.c:

Go to the source code of this file.

Macros

#define SEARCHING_AVI_INDEX   151 /* From shell32 resource library */
 
#define INVALID_AVI_INDEX   0xffff
 

Functions

static void flush_events (void)
 
static LRESULT CALLBACK animate_test_wnd_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void update_window (HWND hWnd)
 
static void create_animate (DWORD parent_style, DWORD animate_style)
 
static void destroy_animate (void)
 
static void cleanup (void)
 
static void test_play (void)
 
 START_TEST (animate)
 

Variables

static HWND hAnimateParentWnd
 
static HWND hAnimateWnd
 
static const char animateTestClass [] = "AnimateTestClass"
 
static WNDPROC animate_wndproc
 
static HANDLE shell32
 

Macro Definition Documentation

◆ INVALID_AVI_INDEX

#define INVALID_AVI_INDEX   0xffff

Definition at line 31 of file animate.c.

◆ SEARCHING_AVI_INDEX

#define SEARCHING_AVI_INDEX   151 /* From shell32 resource library */

Definition at line 30 of file animate.c.

Function Documentation

◆ animate_test_wnd_proc()

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

Definition at line 53 of file animate.c.

54 {
55  switch(msg)
56  {
57  case WM_DESTROY:
58  PostQuitMessage(0);
59  break;
60 
61  default:
62  return DefWindowProcA(hWnd, msg, wParam, lParam);
63  }
64  return 0L;
65 }
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 create_animate().

◆ cleanup()

static void cleanup ( void  )
static

Definition at line 124 of file animate.c.

125 {
127 }
smooth NULL
Definition: ftsmooth.c:416
static const char animateTestClass[]
Definition: animate.c:34
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)

Referenced by START_TEST().

◆ create_animate()

static void create_animate ( DWORD  parent_style,
DWORD  animate_style 
)
static

Definition at line 73 of file animate.c.

74 {
75  WNDCLASSA wc;
76  RECT rect;
77  BOOL ret;
78 
80  wc.cbClsExtra = 0;
81  wc.cbWndExtra = 0;
83  wc.hIcon = NULL;
86  wc.lpszMenuName = NULL;
89  RegisterClassA(&wc);
90 
91  SetRect(&rect, 0, 0, 200, 200);
93  ok(ret, "got %d\n", ret);
94 
95  hAnimateParentWnd = CreateWindowExA(0, animateTestClass, "Animate Test", WS_OVERLAPPEDWINDOW | parent_style,
96  CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);
97  ok(hAnimateParentWnd != NULL, "failed to create parent wnd\n");
98 
101  0, 0, rect.right, rect.bottom, hAnimateParentWnd, NULL, shell32, 0);
102  ok(hAnimateWnd != NULL, "failed to create parent wnd\n");
104 
106  ok(GetUpdateRect(hAnimateParentWnd, NULL, FALSE), "GetUpdateRect: There should be a region that needs to be updated\n");
107  flush_events();
109 }
static void update_window(HWND hWnd)
Definition: animate.c:67
static WNDPROC animate_wndproc
Definition: animate.c:35
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 WS_CHILD
Definition: pedump.c:617
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define COLOR_WINDOW
Definition: winuser.h:908
& rect
Definition: startmenu.cpp:1413
static LRESULT CALLBACK animate_test_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: animate.c:53
static HANDLE shell32
Definition: animate.c:36
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
int cbWndExtra
Definition: winuser.h:3141
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 const char animateTestClass[]
Definition: animate.c:34
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:821
LPCSTR lpszClassName
Definition: winuser.h:3147
#define ANIMATE_CLASSA
Definition: commctrl.h:4138
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define GWLP_WNDPROC
Definition: treelist.c:66
static void flush_events(void)
Definition: animate.c:39
UINT style
Definition: winuser.h:3138
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2881
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define SW_SHOWNORMAL
Definition: winuser.h:764
static HWND hAnimateWnd
Definition: animate.c:33
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
#define WS_VISIBLE
Definition: pedump.c:620
HBRUSH WINAPI GetSysColorBrush(_In_ int)
static HWND hAnimateParentWnd
Definition: animate.c:33
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

Referenced by test_play().

◆ destroy_animate()

static void destroy_animate ( void  )
static

Definition at line 111 of file animate.c.

112 {
113  MSG msg;
114 
116  while (GetMessageA(&msg,0,0,0))
117  {
120  }
122 }
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
#define msg(x)
Definition: auth_time.c:54
static HWND hAnimateParentWnd
Definition: animate.c:33

Referenced by test_play().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 39 of file animate.c.

40 {
41  MSG msg;
42  int diff = 100;
43  DWORD time = GetTickCount() + diff;
44 
45  while (diff > 0)
46  {
47  if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min(10,diff), QS_ALLINPUT ) == WAIT_TIMEOUT) break;
48  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
49  diff = time - GetTickCount();
50  }
51 }
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)
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 create_animate().

◆ START_TEST()

START_TEST ( animate  )

Definition at line 156 of file animate.c.

157 {
158  shell32 = LoadLibraryA("Shell32.dll");
159 
160  test_play();
161 
162  cleanup();
163 }
static void test_play(void)
Definition: animate.c:129
static HANDLE shell32
Definition: animate.c:36
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void cleanup(void)
Definition: animate.c:124

◆ test_play()

static void test_play ( void  )
static

Definition at line 129 of file animate.c.

130 {
131  LONG res;
132  DWORD err;
133 
134  create_animate(0, 0);
135  SetLastError(0xdeadbeef);
137  err = GetLastError();
138  ok(res == 0, "Invalid video should have failed\n");
139  ok(err == ERROR_RESOURCE_NAME_NOT_FOUND, "Expected 1814, got %u\n", err);
140 
141  SetLastError(0xdeadbeef);
143  err = GetLastError();
144  ok(res == 0, "Play should have failed\n");
145  ok(err == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", err);
146  destroy_animate();
147 
148  create_animate(0, 0);
150  ok(res != 0, "Load AVI resource failed\n");
152  ok(res != 0, "Play should have worked\n");
153  destroy_animate();
154 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define INVALID_AVI_INDEX
Definition: animate.c:31
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1121
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
static HANDLE shell32
Definition: animate.c:36
long LONG
Definition: pedump.c:60
static void create_animate(DWORD parent_style, DWORD animate_style)
Definition: animate.c:73
#define MAKELONG(a, b)
Definition: typedefs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
#define ACM_PLAY
Definition: commctrl.h:4152
static void destroy_animate(void)
Definition: animate.c:111
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
#define err(...)
#define ACM_OPENA
Definition: commctrl.h:4147
static HWND hAnimateWnd
Definition: animate.c:33
#define SEARCHING_AVI_INDEX
Definition: animate.c:30
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613

Referenced by START_TEST().

◆ update_window()

static void update_window ( HWND  hWnd)
static

Definition at line 67 of file animate.c.

68 {
70  ok(!GetUpdateRect(hWnd, NULL, FALSE), "GetUpdateRect must return zero after UpdateWindow\n");
71 }
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
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 create_animate().

Variable Documentation

◆ animate_wndproc

WNDPROC animate_wndproc
static

Definition at line 35 of file animate.c.

Referenced by create_animate().

◆ animateTestClass

const char animateTestClass[] = "AnimateTestClass"
static

Definition at line 34 of file animate.c.

Referenced by cleanup(), and create_animate().

◆ hAnimateParentWnd

HWND hAnimateParentWnd
static

Definition at line 33 of file animate.c.

Referenced by create_animate(), and destroy_animate().

◆ hAnimateWnd

HWND hAnimateWnd
static

Definition at line 33 of file animate.c.

Referenced by create_animate(), and test_play().

◆ shell32

HANDLE shell32
static