ReactOS 0.4.15-dev-7906-g1b85a5f
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:
59 break;
60
61 default:
63 }
64 return 0L;
65}
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define L(x)
Definition: ntvdm.h:50
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by create_animate().

◆ cleanup()

static void cleanup ( void  )
static

Definition at line 124 of file animate.c.

125{
127}
#define NULL
Definition: types.h:112
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static const char animateTestClass[]
Definition: animate.c:34
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}
#define ok(value,...)
Definition: atltest.h:57
static void update_window(void)
Definition: wordpad.c:651
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static HWND hAnimateParentWnd
Definition: animate.c:33
static HANDLE shell32
Definition: animate.c:36
static WNDPROC animate_wndproc
Definition: animate.c:35
static void flush_events(void)
Definition: animate.c:39
static LRESULT CALLBACK animate_test_wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: animate.c:53
static HWND hAnimateWnd
Definition: animate.c:33
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
#define ANIMATE_CLASSA
Definition: commctrl.h:4142
& rect
Definition: startmenu.cpp:1413
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
#define GWLP_WNDPROC
Definition: treelist.c:66
int ret
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define CS_VREDRAW
Definition: winuser.h:658
#define SetWindowLongPtrA
Definition: winuser.h:5345
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 COLOR_WINDOW
Definition: winuser.h:918
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
#define CW_USEDEFAULT
Definition: winuser.h:225
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
BOOL WINAPI GetUpdateRect(_In_ HWND, _Out_opt_ LPRECT, _In_ BOOL)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2090
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
const char * LPCSTR
Definition: xmlstorage.h:183

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}
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define WM_CLOSE
Definition: winuser.h:1621
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

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}
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
unsigned long DWORD
Definition: ntddk_ex.h:95
__u16 time
Definition: mkdosfs.c:8
#define min(a, b)
Definition: monoChain.cc:55
#define QS_ALLINPUT
Definition: winuser.h:903
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

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}
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static void cleanup(void)
Definition: animate.c:124
static void test_play(void)
Definition: animate.c:129

◆ 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);
147
148 create_animate(0, 0);
150 ok(res != 0, "Load AVI resource failed\n");
152 ok(res != 0, "Play should have worked\n");
154}
#define SetLastError(x)
Definition: compat.h:752
GLuint res
Definition: glext.h:9613
#define SEARCHING_AVI_INDEX
Definition: animate.c:30
static void destroy_animate(void)
Definition: animate.c:111
#define INVALID_AVI_INDEX
Definition: animate.c:31
static void create_animate(DWORD parent_style, DWORD animate_style)
Definition: animate.c:73
long LONG
Definition: pedump.c:60
#define ACM_OPENA
Definition: commctrl.h:4151
#define ACM_PLAY
Definition: commctrl.h:4156
#define err(...)
#define MAKELONG(a, b)
Definition: typedefs.h:249
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1121
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKEINTRESOURCE
Definition: winuser.h:591

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)

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