1 /* Unit test suite for updown control.
3 * Copyright 2005 C. Scott Ananian
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "wine/test.h"
28 static HINSTANCE hinst
;
30 static HWND
create_edit_control (DWORD style
, DWORD exstyle
)
34 handle
= CreateWindowEx(exstyle
,
37 ES_AUTOHSCROLL
| ES_AUTOVSCROLL
| style
,
39 NULL
, NULL
, hinst
, NULL
);
41 if (winetest_interactive
)
42 ShowWindow (handle
, SW_SHOW
);
46 static HWND
create_updown_control (HWND hWndEdit
)
50 /* make the control */
51 hWndUpDown
= CreateWindowEx
52 (0L, UPDOWN_CLASS
, NULL
,
54 UDS_SETBUDDYINT
| UDS_ALIGNRIGHT
|
55 UDS_ARROWKEYS
| UDS_NOTHOUSANDS
,
59 NULL
, NULL
, hinst
, NULL
);
62 SendMessage (hWndUpDown
, UDM_SETBUDDY
, (WPARAM
)hWndEdit
, 0L );
64 SendMessage (hWndUpDown
, UDM_SETRANGE
, 0L, (LPARAM
) MAKELONG(32000, 0));
66 if (winetest_interactive
)
67 ShowWindow (hWndUpDown
, SW_SHOW
);
71 static void test_updown_control (void)
73 HWND hWndUpDown
, hWndEdit
;
76 hWndEdit
= create_edit_control (ES_AUTOHSCROLL
| ES_NUMBER
, 0);
77 hWndUpDown
= create_updown_control (hWndEdit
);
78 /* before we set a value, it should be '0' */
79 num
= SendMessage(hWndUpDown
, UDM_GETPOS
, 0, 0L);
80 ok(num
== 0, "Expected 0 got %d\n", num
);
81 /* set a value, check it. */
82 SendMessage(hWndUpDown
, UDM_SETPOS
, 0L, MAKELONG( 1, 0));
83 num
= SendMessage(hWndUpDown
, UDM_GETPOS
, 0, 0L);
84 ok(num
== 1, "Expected 1 got %d\n", num
);
85 /* okay, done (short set of tests!) */
86 DestroyWindow(hWndUpDown
);
87 DestroyWindow(hWndEdit
);
92 desktopDC
=GetDC(NULL
);
93 hinst
= GetModuleHandleA(NULL
);
97 test_updown_control();