[3/4] comctl32: Fix reverting to default value for TBM_SETPAGESIZE with lParam = -1
Nikolay Sivov
bunglehead at gmail.com
Fri Mar 20 13:34:47 CDT 2009
Changelog:
- Fix reverting to default value for TBM_SETPAGESIZE with lParam = -1
>From 5f821e31f32faf191ba37ecac99d9bfc79853f71 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 20 Mar 2009 14:23:19 -0400
Subject: Fix reverting to default value for TBM_SETPAGESIZE with lParam = -1
---
dlls/comctl32/tests/trackbar.c | 20 +++++++++++++++++---
dlls/comctl32/trackbar.c | 9 +++++++--
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index d57e28d..e2a3c76 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -588,12 +588,26 @@ static void test_page_size(HWND hWndTrackbar){
/* test TBM_GETPAGESIZE */
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, 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){
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 3424333..849ebcd 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -81,6 +81,8 @@ typedef struct
#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
need to be recalculated */
@@ -1128,7 +1130,10 @@ TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize)
{
LONG lTemp = infoPtr->lPageSize;
- infoPtr->lPageSize = lPageSize;
+ if (lPageSize != -1)
+ infoPtr->lPageSize = lPageSize;
+ else
+ infoPtr->lPageSize = TB_DEFAULTPAGESIZE;
return lTemp;
}
@@ -1405,7 +1410,7 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->lRangeMin = 0;
infoPtr->lRangeMax = 100;
infoPtr->lLineSize = 1;
- infoPtr->lPageSize = 20;
+ infoPtr->lPageSize = TB_DEFAULTPAGESIZE;
infoPtr->lSelMin = 0;
infoPtr->lSelMax = 0;
infoPtr->lPos = 0;
--
1.5.6.5
More information about the wine-patches
mailing list