include: Use the hard-float calling convention for Windows APIs on ARM
[wine.git] / dlls / comctl32 / tests / ipaddress.c
blob093f649c9ec10cf7d000d3e87dbea9431993f070
1 /* Unit test suite for IP Address control.
3 * Copyright 2009 Nikolay Sivov
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
21 #include <windows.h>
22 #include <commctrl.h>
24 #include "wine/test.h"
26 #define expect(expected, got) ok(expected == got, "expected %d, got %d\n", expected,got)
28 static HWND create_ipaddress_control (void)
30 HWND handle;
32 handle = CreateWindowExA(0, WC_IPADDRESSA, NULL,
33 WS_BORDER|WS_VISIBLE, 0, 0, 0, 0,
34 NULL, NULL, NULL, NULL);
35 return handle;
38 static void test_get_set_text(void)
40 HWND hwnd;
41 CHAR ip[16];
42 INT r;
44 hwnd = create_ipaddress_control();
45 if (!hwnd)
47 win_skip("IPAddress control not implemented\n");
48 return;
51 /* check text just after creation */
52 r = GetWindowTextA(hwnd, ip, sizeof(ip)/sizeof(CHAR));
53 expect(7, r);
54 ok(strcmp(ip, "0.0.0.0") == 0, "Expected null IP address, got %s\n", ip);
56 SendMessageA(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(127, 0, 0, 1));
57 r = GetWindowTextA(hwnd, ip, sizeof(ip)/sizeof(CHAR));
58 expect(9, r);
59 ok(strcmp(ip, "127.0.0.1") == 0, "Expected 127.0.0.1, got %s\n", ip);
61 DestroyWindow(hwnd);
64 static BOOL init(void)
66 HMODULE hComctl32;
67 BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
68 INITCOMMONCONTROLSEX iccex;
70 hComctl32 = GetModuleHandleA("comctl32.dll");
71 pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
72 if (!pInitCommonControlsEx)
74 win_skip("InitCommonControlsEx() is missing.\n");
75 return FALSE;
78 iccex.dwSize = sizeof(iccex);
79 /* W2K and below need ICC_INTERNET_CLASSES for the IP Address Control */
80 iccex.dwICC = ICC_INTERNET_CLASSES;
81 pInitCommonControlsEx(&iccex);
83 return TRUE;
86 START_TEST(ipaddress)
88 if (!init())
89 return;
91 test_get_set_text();