comctl32/trackbar: Fix tic count calculation.
This commit is contained in:
parent
6be5ab78b9
commit
42c83b9dc7
|
@ -30,6 +30,7 @@
|
|||
#define PARENT_SEQ_INDEX 0
|
||||
#define TRACKBAR_SEQ_INDEX 1
|
||||
|
||||
HWND hWndParent;
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCE];
|
||||
|
||||
|
@ -846,9 +847,7 @@ static void test_tic_placement(HWND hWndTrackbar){
|
|||
r = SendMessage(hWndTrackbar, TBM_GETTIC, 2,0);
|
||||
expect(4, r);
|
||||
r = SendMessage(hWndTrackbar, TBM_GETTIC, 4,0);
|
||||
todo_wine{
|
||||
expect(-1, r);
|
||||
}
|
||||
|
||||
/* test TBM_GETTICPIC */
|
||||
r = SendMessage(hWndTrackbar, TBM_GETTICPOS, 0, 0);
|
||||
|
@ -967,11 +966,27 @@ static void test_ignore_selection(HWND hWndTrackbar){
|
|||
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_empty_test_seq, "parent ignore selection setting test sequence", FALSE);
|
||||
}
|
||||
|
||||
static void test_initial_state(void)
|
||||
{
|
||||
HWND hWnd;
|
||||
DWORD ret;
|
||||
|
||||
hWnd = create_trackbar(0, hWndParent);
|
||||
|
||||
ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
|
||||
expect(2, ret);
|
||||
ret = SendMessage(hWnd, TBM_GETTIC, 0, 0);
|
||||
expect(-1, ret);
|
||||
ret = SendMessage(hWnd, TBM_GETTICPOS, 0, 0);
|
||||
expect(-1, ret);
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
}
|
||||
|
||||
START_TEST(trackbar)
|
||||
{
|
||||
DWORD style = WS_VISIBLE | TBS_TOOLTIPS | TBS_ENABLESELRANGE | TBS_FIXEDLENGTH | TBS_AUTOTICKS;
|
||||
HWND hWndTrackbar;
|
||||
HWND hWndParent;
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
|
||||
InitCommonControls();
|
||||
|
@ -1036,5 +1051,7 @@ START_TEST(trackbar)
|
|||
|
||||
DestroyWindow(hWndTrackbar);
|
||||
|
||||
test_initial_state();
|
||||
|
||||
DestroyWindow(hWndParent);
|
||||
}
|
||||
|
|
|
@ -151,8 +151,12 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
|
|||
int tic;
|
||||
unsigned nrTics, i;
|
||||
|
||||
if (infoPtr->uTicFreq && infoPtr->lRangeMax >= infoPtr->lRangeMin)
|
||||
if (infoPtr->uTicFreq && infoPtr->lRangeMax >= infoPtr->lRangeMin) {
|
||||
nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq;
|
||||
/* don't add extra tic if there's no remainder */
|
||||
if ((infoPtr->lRangeMax - infoPtr->lRangeMin) % infoPtr->uTicFreq == 0)
|
||||
nrTics--;
|
||||
}
|
||||
else {
|
||||
Free (infoPtr->tics);
|
||||
infoPtr->tics = NULL;
|
||||
|
@ -1042,10 +1046,7 @@ TRACKBAR_GetNumTics (const TRACKBAR_INFO *infoPtr)
|
|||
if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_NOTICKS)
|
||||
return 0;
|
||||
|
||||
if(infoPtr->uNumTics == 0)
|
||||
return 2;
|
||||
else
|
||||
return infoPtr->uNumTics + 1;
|
||||
return infoPtr->uNumTics + 2;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue