comctl32/trackbar: Fix reverting to default value for TBM_SETPAGESIZE with lParam = -1.

This commit is contained in:
Nikolay Sivov 2009-03-23 16:05:49 -04:00 committed by Alexandre Julliard
parent 92b0ad98e1
commit b7d7d58978
2 changed files with 24 additions and 5 deletions

View File

@ -588,12 +588,26 @@ static void test_page_size(HWND hWndTrackbar){
/* test TBM_GETPAGESIZE */ /* test TBM_GETPAGESIZE */
r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0,0); r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0,0);
todo_wine{ expect(20, r);
expect(20, r);
}
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, page_size_test_seq, "page size test sequence", FALSE); ok_sequence(sequences, TRACKBAR_SEQ_INDEX, page_size_test_seq, "page size test sequence", FALSE);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent page size test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent page size test sequence", FALSE);
/* check for zero page size */
r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, 0);
expect(20, r);
r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
expect(0, r);
/* revert to default */
r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, -1);
expect(0, r);
r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
expect(20, r);
/* < -1 */
r = SendMessage(hWndTrackbar, TBM_SETPAGESIZE, 0, -2);
expect(20, r);
r = SendMessage(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
expect(-2, r);
} }
static void test_position(HWND hWndTrackbar){ static void test_position(HWND hWndTrackbar){

View File

@ -81,6 +81,8 @@ typedef struct
#define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */ #define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */
#define TB_DEFAULTPAGESIZE 20
/* Used by TRACKBAR_Refresh to find out which parts of the control /* Used by TRACKBAR_Refresh to find out which parts of the control
need to be recalculated */ need to be recalculated */
@ -1128,7 +1130,10 @@ TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize)
{ {
LONG lTemp = infoPtr->lPageSize; LONG lTemp = infoPtr->lPageSize;
infoPtr->lPageSize = lPageSize; if (lPageSize != -1)
infoPtr->lPageSize = lPageSize;
else
infoPtr->lPageSize = TB_DEFAULTPAGESIZE;
return lTemp; return lTemp;
} }
@ -1405,7 +1410,7 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->lRangeMin = 0; infoPtr->lRangeMin = 0;
infoPtr->lRangeMax = 100; infoPtr->lRangeMax = 100;
infoPtr->lLineSize = 1; infoPtr->lLineSize = 1;
infoPtr->lPageSize = 20; infoPtr->lPageSize = TB_DEFAULTPAGESIZE;
infoPtr->lSelMin = 0; infoPtr->lSelMin = 0;
infoPtr->lSelMax = 0; infoPtr->lSelMax = 0;
infoPtr->lPos = 0; infoPtr->lPos = 0;