~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/shell32/tests/systray.c

Version: ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /* Unit tests for systray
  2  *
  3  * Copyright 2007 Mikolaj Zalewski
  4  *
  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.
  9  *
 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.
 14  *
 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
 18  */
 19 #define _WIN32_IE 0x600
 20 #include <assert.h>
 21 #include <stdarg.h>
 22 
 23 #include <windows.h>
 24 
 25 #include "wine/test.h"
 26 
 27 
 28 static HWND hMainWnd;
 29 static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);
 30 
 31 static void test_cbsize(void)
 32 {
 33     NOTIFYICONDATAA nidA;
 34     BOOL ret;
 35 
 36     if (pShell_NotifyIconW)
 37     {
 38         NOTIFYICONDATAW nidW;
 39 
 40         ZeroMemory(&nidW, sizeof(nidW));
 41         nidW.cbSize = NOTIFYICONDATAW_V1_SIZE;
 42         nidW.hWnd = hMainWnd;
 43         nidW.uID = 1;
 44         nidW.uFlags = NIF_ICON|NIF_MESSAGE;
 45         nidW.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 46         nidW.uCallbackMessage = WM_USER+17;
 47         ret = pShell_NotifyIconW(NIM_ADD, &nidW);
 48         if (ret)
 49         {
 50             /* using an invalid cbSize does work */
 51             nidW.cbSize = 3;
 52             nidW.hWnd = hMainWnd;
 53             nidW.uID = 1;
 54             ret = pShell_NotifyIconW(NIM_DELETE, &nidW);
 55             ok( ret || broken(!ret), /* nt4 */ "NIM_DELETE failed!\n");
 56             /* as icon doesn't exist anymore - now there will be an error */
 57             nidW.cbSize = sizeof(nidW);
 58             ok(!pShell_NotifyIconW(NIM_DELETE, &nidW) != !ret, "The icon was not deleted\n");
 59         }
 60         else win_skip( "Shell_NotifyIconW not working\n" );  /* win9x */
 61     }
 62 
 63     /* same for Shell_NotifyIconA */
 64     ZeroMemory(&nidA, sizeof(nidA));
 65     nidA.cbSize = NOTIFYICONDATAA_V1_SIZE;
 66     nidA.hWnd = hMainWnd;
 67     nidA.uID = 1;
 68     nidA.uFlags = NIF_ICON|NIF_MESSAGE;
 69     nidA.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 70     nidA.uCallbackMessage = WM_USER+17;
 71     ok(Shell_NotifyIconA(NIM_ADD, &nidA), "NIM_ADD failed!\n");
 72 
 73     /* using an invalid cbSize does work */
 74     nidA.cbSize = 3;
 75     nidA.hWnd = hMainWnd;
 76     nidA.uID = 1;
 77     ret = Shell_NotifyIconA(NIM_DELETE, &nidA);
 78     ok( ret || broken(!ret),  /* win9x */ "NIM_DELETE failed!\n");
 79     /* as icon doesn't exist anymore - now there will be an error */
 80     nidA.cbSize = sizeof(nidA);
 81     ok(!Shell_NotifyIconA(NIM_DELETE, &nidA) != !ret, "The icon was not deleted\n");
 82 }
 83 
 84 START_TEST(systray)
 85 {
 86     WNDCLASSA wc;
 87     MSG msg;
 88     RECT rc;
 89     HMODULE hshell32;
 90 
 91     hshell32 = GetModuleHandleA("shell32.dll");
 92     pShell_NotifyIconW = (void*)GetProcAddress(hshell32, "Shell_NotifyIconW");
 93 
 94     wc.style = CS_HREDRAW | CS_VREDRAW;
 95     wc.cbClsExtra = 0;
 96     wc.cbWndExtra = 0;
 97     wc.hInstance = GetModuleHandleA(NULL);
 98     wc.hIcon = NULL;
 99     wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
100     wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
101     wc.lpszMenuName = NULL;
102     wc.lpszClassName = "MyTestWnd";
103     wc.lpfnWndProc = DefWindowProc;
104     RegisterClassA(&wc);
105 
106     hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
107       CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
108     GetClientRect(hMainWnd, &rc);
109     ShowWindow(hMainWnd, SW_SHOW);
110 
111     test_cbsize();
112 
113     PostQuitMessage(0);
114     while(GetMessageA(&msg,0,0,0)) {
115         TranslateMessage(&msg);
116         DispatchMessageA(&msg);
117     }
118     DestroyWindow(hMainWnd);
119 }
120 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.