d3drm: Implement IDirect3DRMFrameX_AddTransform.
[wine/multimedia.git] / dlls / shell32 / tests / systray.c
blob6699350cf688a72a5bb494fde7e2311161bc6be2
1 /* Unit tests for systray
3 * Copyright 2007 Mikolaj Zalewski
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define _WIN32_IE 0x600
20 #include <stdarg.h>
22 #include <windows.h>
24 #include "wine/test.h"
27 static HWND hMainWnd;
28 static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);
30 static void test_cbsize(void)
32 NOTIFYICONDATAA nidA;
33 BOOL ret;
35 if (pShell_NotifyIconW)
37 NOTIFYICONDATAW nidW;
39 ZeroMemory(&nidW, sizeof(nidW));
40 nidW.cbSize = NOTIFYICONDATAW_V1_SIZE;
41 nidW.hWnd = hMainWnd;
42 nidW.uID = 1;
43 nidW.uFlags = NIF_ICON|NIF_MESSAGE;
44 nidW.hIcon = LoadIcon(NULL, IDI_APPLICATION);
45 nidW.uCallbackMessage = WM_USER+17;
46 ret = pShell_NotifyIconW(NIM_ADD, &nidW);
47 /* using an invalid cbSize does work */
48 nidW.cbSize = 3;
49 nidW.hWnd = hMainWnd;
50 nidW.uID = 1;
51 ret = pShell_NotifyIconW(NIM_DELETE, &nidW);
52 ok( ret || broken(!ret), /* nt4 */ "NIM_DELETE failed!\n");
53 /* as icon doesn't exist anymore - now there will be an error */
54 nidW.cbSize = sizeof(nidW);
55 ok(!pShell_NotifyIconW(NIM_DELETE, &nidW) != !ret, "The icon was not deleted\n");
58 /* same for Shell_NotifyIconA */
59 ZeroMemory(&nidA, sizeof(nidA));
60 nidA.cbSize = NOTIFYICONDATAA_V1_SIZE;
61 nidA.hWnd = hMainWnd;
62 nidA.uID = 1;
63 nidA.uFlags = NIF_ICON|NIF_MESSAGE;
64 nidA.hIcon = LoadIcon(NULL, IDI_APPLICATION);
65 nidA.uCallbackMessage = WM_USER+17;
66 ok(Shell_NotifyIconA(NIM_ADD, &nidA), "NIM_ADD failed!\n");
68 /* using an invalid cbSize does work */
69 nidA.cbSize = 3;
70 nidA.hWnd = hMainWnd;
71 nidA.uID = 1;
72 ret = Shell_NotifyIconA(NIM_DELETE, &nidA);
73 ok(ret, "NIM_DELETE failed!\n");
74 /* as icon doesn't exist anymore - now there will be an error */
75 nidA.cbSize = sizeof(nidA);
76 ok(!Shell_NotifyIconA(NIM_DELETE, &nidA) != !ret, "The icon was not deleted\n");
79 START_TEST(systray)
81 WNDCLASSA wc;
82 MSG msg;
83 RECT rc;
84 HMODULE hshell32;
86 hshell32 = GetModuleHandleA("shell32.dll");
87 pShell_NotifyIconW = (void*)GetProcAddress(hshell32, "Shell_NotifyIconW");
89 wc.style = CS_HREDRAW | CS_VREDRAW;
90 wc.cbClsExtra = 0;
91 wc.cbWndExtra = 0;
92 wc.hInstance = GetModuleHandleA(NULL);
93 wc.hIcon = NULL;
94 wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
95 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
96 wc.lpszMenuName = NULL;
97 wc.lpszClassName = "MyTestWnd";
98 wc.lpfnWndProc = DefWindowProc;
99 RegisterClassA(&wc);
101 hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
102 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
103 GetClientRect(hMainWnd, &rc);
104 ShowWindow(hMainWnd, SW_SHOW);
106 test_cbsize();
108 PostQuitMessage(0);
109 while(GetMessageA(&msg,0,0,0)) {
110 TranslateMessage(&msg);
111 DispatchMessageA(&msg);
113 DestroyWindow(hMainWnd);