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

Wine Cross Reference
wine/dlls/comctl32/tests/ipaddress.c

Version: ~ [ 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 test suite for IP Address control.
  2  *
  3  * Copyright 2009 Nikolay Sivov
  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 
 20 
 21 #include <windows.h>
 22 #include <commctrl.h>
 23 #include <assert.h>
 24 
 25 #include "wine/test.h"
 26 
 27 #define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got)
 28 
 29 static HWND create_ipaddress_control (void)
 30 {
 31     HWND handle;
 32 
 33     handle = CreateWindowEx(0, WC_IPADDRESS, NULL,
 34                             WS_BORDER|WS_VISIBLE, 0, 0, 0, 0,
 35                             NULL, NULL, NULL, NULL);
 36     return handle;
 37 }
 38 
 39 static void test_get_set_text(void)
 40 {
 41     HWND hwnd;
 42     CHAR ip[16];
 43     INT r;
 44 
 45     hwnd = create_ipaddress_control();
 46     if (!hwnd)
 47     {
 48         win_skip("IPAddress control not implemented\n");
 49         return;
 50     }
 51 
 52     /* check text just after creation */
 53     r = GetWindowText(hwnd, ip, sizeof(ip)/sizeof(CHAR));
 54     expect(7, r);
 55     ok(strcmp(ip, "0.0.0.0") == 0, "Expected null IP address, got %s\n", ip);
 56 
 57     SendMessage(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(127, 0, 0, 1));
 58     r = GetWindowText(hwnd, ip, sizeof(ip)/sizeof(CHAR));
 59     expect(9, r);
 60     ok(strcmp(ip, "127.0.0.1") == 0, "Expected 127.0.0.1, got %s\n", ip);
 61 
 62     DestroyWindow(hwnd);
 63 }
 64 
 65 static int init(void)
 66 {
 67     HMODULE hComctl32;
 68     BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
 69     INITCOMMONCONTROLSEX iccex;
 70 
 71     hComctl32 = GetModuleHandleA("comctl32.dll");
 72     pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
 73     if (!pInitCommonControlsEx)
 74     {
 75         win_skip("InitCommonControlsEx() is missing.\n");
 76         return 0;
 77     }
 78 
 79     iccex.dwSize = sizeof(iccex);
 80     /* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
 81     iccex.dwICC  = ICC_INTERNET_CLASSES;
 82     pInitCommonControlsEx(&iccex);
 83 
 84     return 1;
 85 }
 86 
 87 START_TEST(ipaddress)
 88 {
 89     if (!init())
 90         return;
 91 
 92     test_get_set_text();
 93 }
 94 

~ [ 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.