2005-03-16 20:52:40 +01:00
|
|
|
/* Unit test suite for updown control.
|
|
|
|
*
|
|
|
|
* Copyright 2005 C. Scott Ananian
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-03-16 20:52:40 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
static HDC desktopDC;
|
|
|
|
static HINSTANCE hinst;
|
|
|
|
|
2005-06-09 11:50:56 +02:00
|
|
|
static HWND create_edit_control (DWORD style, DWORD exstyle)
|
2005-03-16 20:52:40 +01:00
|
|
|
{
|
|
|
|
HWND handle;
|
|
|
|
|
|
|
|
handle = CreateWindowEx(exstyle,
|
|
|
|
"EDIT",
|
|
|
|
NULL,
|
|
|
|
ES_AUTOHSCROLL | ES_AUTOVSCROLL | style,
|
|
|
|
10, 10, 300, 300,
|
|
|
|
NULL, NULL, hinst, NULL);
|
|
|
|
assert (handle);
|
|
|
|
if (winetest_interactive)
|
|
|
|
ShowWindow (handle, SW_SHOW);
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
2005-06-09 11:50:56 +02:00
|
|
|
static HWND create_updown_control (HWND hWndEdit)
|
2005-03-16 20:52:40 +01:00
|
|
|
{
|
|
|
|
HWND hWndUpDown;
|
|
|
|
|
|
|
|
/* make the control */
|
|
|
|
hWndUpDown = CreateWindowEx
|
|
|
|
(0L, UPDOWN_CLASS, NULL,
|
|
|
|
/* window styles */
|
|
|
|
UDS_SETBUDDYINT | UDS_ALIGNRIGHT |
|
|
|
|
UDS_ARROWKEYS | UDS_NOTHOUSANDS,
|
|
|
|
/* placement */
|
|
|
|
0, 0, 8, 8,
|
|
|
|
/* parent, etc */
|
|
|
|
NULL, NULL, hinst, NULL);
|
|
|
|
assert (hWndUpDown);
|
|
|
|
/* set the buddy. */
|
2005-09-12 23:22:32 +02:00
|
|
|
SendMessage (hWndUpDown, UDM_SETBUDDY, (WPARAM)hWndEdit, 0L );
|
2005-03-16 20:52:40 +01:00
|
|
|
/* set the range. */
|
|
|
|
SendMessage (hWndUpDown, UDM_SETRANGE, 0L, (LPARAM) MAKELONG(32000, 0));
|
|
|
|
/* maybe show it. */
|
|
|
|
if (winetest_interactive)
|
|
|
|
ShowWindow (hWndUpDown, SW_SHOW);
|
|
|
|
return hWndUpDown;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_updown_control (void)
|
|
|
|
{
|
|
|
|
HWND hWndUpDown, hWndEdit;
|
|
|
|
int num;
|
|
|
|
|
|
|
|
hWndEdit = create_edit_control (ES_AUTOHSCROLL | ES_NUMBER, 0);
|
|
|
|
hWndUpDown = create_updown_control (hWndEdit);
|
|
|
|
/* before we set a value, it should be '0' */
|
|
|
|
num = SendMessage(hWndUpDown, UDM_GETPOS, 0, 0L);
|
2005-03-18 15:09:12 +01:00
|
|
|
ok(num == 0, "Expected 0 got %d\n", num);
|
2005-03-16 20:52:40 +01:00
|
|
|
/* set a value, check it. */
|
|
|
|
SendMessage(hWndUpDown, UDM_SETPOS, 0L, MAKELONG( 1, 0));
|
|
|
|
num = SendMessage(hWndUpDown, UDM_GETPOS, 0, 0L);
|
|
|
|
ok(num == 1, "Expected 1 got %d\n", num);
|
|
|
|
/* okay, done (short set of tests!) */
|
|
|
|
DestroyWindow(hWndUpDown);
|
|
|
|
DestroyWindow(hWndEdit);
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(updown)
|
|
|
|
{
|
|
|
|
desktopDC=GetDC(NULL);
|
|
|
|
hinst = GetModuleHandleA(NULL);
|
|
|
|
|
|
|
|
InitCommonControls();
|
|
|
|
|
|
|
|
test_updown_control();
|
|
|
|
}
|