wined3d: Handle the sampler type shift in the frontend.
[wine] / dlls / comctl32 / tests / ipaddress.c
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     assert(handle);
37
38     return handle;
39 }
40
41 static void test_get_set_text(void)
42 {
43     HWND hwnd;
44     CHAR ip[16];
45     INT r;
46
47     hwnd = create_ipaddress_control();
48
49     /* check text just after creation */
50     r = GetWindowText(hwnd, ip, sizeof(ip)/sizeof(CHAR));
51     expect(7, r);
52     ok(strcmp(ip, "0.0.0.0") == 0, "Expected null IP address, got %s\n", ip);
53
54     SendMessage(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(127, 0, 0, 1));
55     r = GetWindowText(hwnd, ip, sizeof(ip)/sizeof(CHAR));
56     expect(9, r);
57     ok(strcmp(ip, "127.0.0.1") == 0, "Expected 127.0.0.1, got %s\n", ip);
58
59     DestroyWindow(hwnd);
60 }
61
62 static int init(void)
63 {
64     HMODULE hComctl32;
65     BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
66     INITCOMMONCONTROLSEX iccex;
67
68     hComctl32 = GetModuleHandleA("comctl32.dll");
69     pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
70     if (!pInitCommonControlsEx)
71     {
72         win_skip("InitCommonControlsEx() is missing.\n");
73         return 0;
74     }
75
76     iccex.dwSize = sizeof(iccex);
77     /* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
78     iccex.dwICC  = ICC_INTERNET_CLASSES;
79     pInitCommonControlsEx(&iccex);
80
81     return 1;
82 }
83
84 START_TEST(ipaddress)
85 {
86     if (!init())
87         return;
88
89     test_get_set_text();
90 }