diff --git a/dlls/comctl32/tests/.cvsignore b/dlls/comctl32/tests/.cvsignore index baaaf5f1a0d..1e63ad22e1c 100644 --- a/dlls/comctl32/tests/.cvsignore +++ b/dlls/comctl32/tests/.cvsignore @@ -5,3 +5,4 @@ mru.ok subclass.ok tab.ok testlist.c +updown.ok diff --git a/dlls/comctl32/tests/Makefile.in b/dlls/comctl32/tests/Makefile.in index 357d2c08824..3aefdef6bcd 100644 --- a/dlls/comctl32/tests/Makefile.in +++ b/dlls/comctl32/tests/Makefile.in @@ -10,7 +10,8 @@ CTESTS = \ imagelist.c \ mru.c \ subclass.c \ - tab.c + tab.c \ + updown.c @MAKE_TEST_RULES@ diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c new file mode 100644 index 00000000000..5084b8919ba --- /dev/null +++ b/dlls/comctl32/tests/updown.c @@ -0,0 +1,98 @@ +/* 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 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "wine/test.h" + +static HDC desktopDC; +static HINSTANCE hinst; + +HWND create_edit_control (DWORD style, DWORD exstyle) +{ + 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; +} + +HWND create_updown_control (HWND hWndEdit) +{ + 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. */ + SendMessage (hWndUpDown, UDM_SETBUDDY, (LONG)hWndEdit, 0L ); + /* 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); + todo_wine { ok(num == 0, "Expected 0 got %d\n", num); } + /* 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(); +}