2007-02-13 00:31:23 +01:00
|
|
|
/* Unit tests for the track bar control.
|
|
|
|
*
|
|
|
|
* Copyright 2007 Keith Stevens
|
|
|
|
*
|
|
|
|
* 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.
|
2007-05-04 12:08:15 +02:00
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
2007-03-15 19:48:56 +01:00
|
|
|
#include "msg.h"
|
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
2007-03-15 19:48:56 +01:00
|
|
|
#define NUM_MSG_SEQUENCE 2
|
|
|
|
#define PARENT_SEQ_INDEX 0
|
|
|
|
#define TRACKBAR_SEQ_INDEX 1
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static const DWORD defaultstyle = WS_VISIBLE | TBS_TOOLTIPS | TBS_ENABLESELRANGE | TBS_FIXEDLENGTH | TBS_AUTOTICKS;
|
2010-10-01 13:35:49 +02:00
|
|
|
static HWND hWndParent;
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2016-01-09 21:45:20 +01:00
|
|
|
static LRESULT WINAPI trackbar_no_wmpaint_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
|
|
|
|
|
|
|
if (message == WM_PAINT)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
static struct msg_sequence *sequences[NUM_MSG_SEQUENCE];
|
|
|
|
|
2012-03-09 17:09:35 +01:00
|
|
|
static const struct message empty_seq[] = {
|
2007-03-15 19:48:56 +01:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_create_trackbar_wnd_seq[] = {
|
|
|
|
{ WM_NOTIFYFORMAT, sent},
|
2008-09-08 07:48:00 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|optional},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent},
|
|
|
|
{ WM_NCACTIVATE, sent},
|
|
|
|
{ PBT_APMRESUMECRITICAL, sent},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent},
|
|
|
|
{ PBT_APMRESUMESTANDBY, sent},
|
|
|
|
{ WM_IME_SETCONTEXT, sent|optional},
|
|
|
|
{ WM_IME_NOTIFY, sent|optional},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_new_window_test_seq[] = {
|
2008-09-08 07:55:32 +02:00
|
|
|
{ WM_QUERYNEWPALETTE, sent|optional },
|
2009-08-31 09:14:25 +02:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|optional},
|
|
|
|
{ WM_NCACTIVATE, sent|optional},
|
|
|
|
{ PBT_APMRESUMECRITICAL, sent|optional},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ WM_IME_SETCONTEXT, sent|defwinproc|optional},
|
|
|
|
{ WM_IME_NOTIFY, sent|defwinproc|optional},
|
2009-08-31 09:14:25 +02:00
|
|
|
{ WM_SETFOCUS, sent|defwinproc|optional},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ WM_NOTIFYFORMAT, sent},
|
2008-09-08 07:48:00 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|optional},
|
2007-03-15 19:48:56 +01:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message buddy_window_test_seq[] = {
|
|
|
|
{ TBM_GETBUDDY, sent|wparam, TRUE},
|
|
|
|
{ TBM_SETBUDDY, sent|wparam, FALSE},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_SETBUDDY, sent|wparam, FALSE},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETBUDDY, sent|wparam, TRUE},
|
|
|
|
{ TBM_SETBUDDY, sent|wparam, TRUE},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_SETBUDDY, sent|wparam, TRUE},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETBUDDY, sent|wparam, FALSE},
|
|
|
|
{ TBM_GETBUDDY, sent|wparam, TRUE},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_buddy_window_test_seq[] = {
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message line_size_test_seq[] = {
|
|
|
|
{ TBM_SETLINESIZE, sent|lparam, 0, 10},
|
|
|
|
{ TBM_SETLINESIZE, sent|lparam, 0, 4},
|
|
|
|
{ TBM_GETLINESIZE, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message page_size_test_seq[] = {
|
|
|
|
{ TBM_SETPAGESIZE, sent|lparam, 0, 10},
|
|
|
|
{ TBM_SETPAGESIZE, sent|lparam, 0, -1},
|
|
|
|
{ TBM_GETPAGESIZE, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message position_test_seq[] = {
|
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, TRUE, -1},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETPOS, sent},
|
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETPOS, sent},
|
2008-11-16 04:50:54 +01:00
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 5},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 1000},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETPOS, sent},
|
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, FALSE, 20},
|
|
|
|
{ TBM_GETPOS, sent},
|
2008-11-16 04:50:54 +01:00
|
|
|
{ TBM_SETPOS, sent|wparam|lparam, TRUE, 20},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ TBM_GETPOS, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_position_test_seq[] = {
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message range_test_seq[] = {
|
|
|
|
{ TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(0, 10)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(-1, 1000)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(10, 0)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGE, sent|wparam|lparam, FALSE, MAKELONG(0, 10)},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGEMAX, sent|wparam|lparam, TRUE, 10},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_SETRANGEMAX, sent|wparam|lparam, TRUE, -1},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_SETRANGEMAX, sent|wparam|lparam, FALSE, 10},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, 0},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, 10},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGEMIN, sent|wparam|lparam, TRUE, -10},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_SETRANGEMIN, sent|wparam|lparam, FALSE, 5},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{ TBM_GETRANGEMAX, sent},
|
|
|
|
{ TBM_GETRANGEMIN, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_range_test_seq[] = {
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message selection_test_seq[] = {
|
|
|
|
{ TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(0, 10)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(5, 20)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSEL, sent|wparam|lparam, FALSE, MAKELONG(5, 10)},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, TRUE, 10},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, TRUE, 20},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, TRUE, 4},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, FALSE, 2},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, TRUE, 5},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, TRUE, 0},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, TRUE, 20},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, FALSE, 8},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_selection_test_seq[] = {
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message tic_settings_test_seq[] = {
|
|
|
|
{ TBM_SETTIC, sent|lparam, 0, 0},
|
|
|
|
{ TBM_SETTIC, sent|lparam, 0, 5},
|
|
|
|
{ TBM_SETTIC, sent|lparam, 0, 10},
|
|
|
|
{ TBM_SETTIC, sent|lparam, 0, 20},
|
|
|
|
{ TBM_SETRANGE, sent|wparam|lparam, TRUE, MAKELONG(0,10)},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_SETTICFREQ, sent|wparam, 2},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETNUMTICS, sent},
|
|
|
|
{ TBM_SETTICFREQ, sent|wparam, 5},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETNUMTICS, sent},
|
|
|
|
{ TBM_SETTICFREQ, sent|wparam, 15},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETNUMTICS, sent},
|
|
|
|
{ TBM_GETNUMTICS, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_tic_settings_test_seq[] = {
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message thumb_length_test_seq[] = {
|
|
|
|
{ TBM_SETTHUMBLENGTH, sent|wparam|lparam, 15, 0},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETTHUMBLENGTH, sent},
|
|
|
|
{ TBM_SETTHUMBLENGTH, sent|wparam|lparam, 20, 0},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETTHUMBLENGTH, sent},
|
|
|
|
{ TBM_GETTHUMBLENGTH, sent},
|
2012-02-05 16:43:34 +01:00
|
|
|
{ WM_SIZE, sent},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETTHUMBLENGTH, sent},
|
|
|
|
{ WM_SIZE, sent},
|
|
|
|
{ WM_PAINT, sent|defwinproc},
|
|
|
|
{ TBM_GETTHUMBLENGTH, sent},
|
2007-03-15 19:48:56 +01:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message parent_thumb_length_test_seq[] = {
|
2012-02-05 16:43:34 +01:00
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{ WM_CTLCOLORSTATIC, sent},
|
|
|
|
{ WM_NOTIFY, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message tic_placement_test_seq[] = {
|
|
|
|
{ TBM_GETPTICS, sent},
|
|
|
|
{ TBM_GETTIC, sent|wparam, 0},
|
2008-07-12 02:37:21 +02:00
|
|
|
{ TBM_GETTIC, sent|wparam, 2},
|
2007-03-15 19:48:56 +01:00
|
|
|
{ TBM_GETTIC, sent|wparam, 4},
|
|
|
|
{ TBM_GETTICPOS, sent|wparam, 0},
|
2008-07-12 02:37:21 +02:00
|
|
|
{ TBM_GETTICPOS, sent|wparam, 2},
|
2007-03-15 19:48:56 +01:00
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message tool_tips_test_seq[] = {
|
|
|
|
{ TBM_SETTIPSIDE, sent|wparam, TBTS_TOP},
|
|
|
|
{ TBM_SETTIPSIDE, sent|wparam, TBTS_LEFT},
|
|
|
|
{ TBM_SETTIPSIDE, sent|wparam, TBTS_BOTTOM},
|
|
|
|
{ TBM_SETTIPSIDE, sent|wparam, TBTS_RIGHT},
|
|
|
|
{ TBM_SETTOOLTIPS, sent},
|
|
|
|
{ TBM_GETTOOLTIPS, sent},
|
|
|
|
{ TBM_SETTOOLTIPS, sent},
|
|
|
|
{ TBM_GETTOOLTIPS, sent},
|
|
|
|
{ TBM_SETTOOLTIPS, sent},
|
|
|
|
{ TBM_GETTOOLTIPS, sent},
|
|
|
|
{ TBM_GETTOOLTIPS, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message unicode_test_seq[] = {
|
|
|
|
{ TBM_SETUNICODEFORMAT, sent|wparam, TRUE},
|
|
|
|
{ TBM_SETUNICODEFORMAT, sent|wparam, FALSE},
|
|
|
|
{ TBM_GETUNICODEFORMAT, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message ignore_selection_test_seq[] = {
|
|
|
|
{ TBM_SETSEL, sent|wparam|lparam, TRUE, MAKELONG(0,10)},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSEL, sent|wparam|lparam, FALSE, MAKELONG(0,10)},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, TRUE,0},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, TRUE, 10},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELEND, sent|wparam|lparam, FALSE,0},
|
|
|
|
{ TBM_GETSELEND, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, TRUE,0},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, TRUE, 10},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{ TBM_SETSELSTART, sent|wparam|lparam, FALSE,0},
|
|
|
|
{ TBM_GETSELSTART, sent},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
2009-04-02 12:04:50 +02:00
|
|
|
static LONG defwndproc_counter = 0;
|
2007-03-15 19:48:56 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
2008-09-15 20:24:46 +02:00
|
|
|
/* log system messages, except for painting */
|
|
|
|
if (message < WM_USER &&
|
|
|
|
message != WM_PAINT &&
|
2007-03-15 19:48:56 +01:00
|
|
|
message != WM_ERASEBKGND &&
|
|
|
|
message != WM_NCPAINT &&
|
|
|
|
message != WM_NCHITTEST &&
|
|
|
|
message != WM_GETTEXT &&
|
|
|
|
message != WM_GETICON &&
|
|
|
|
message != WM_DEVICECHANGE)
|
|
|
|
{
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
2013-03-31 10:11:36 +02:00
|
|
|
msg.id = 0;
|
2007-03-15 19:48:56 +01:00
|
|
|
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
|
|
|
}
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL register_parent_wnd_class(void){
|
|
|
|
WNDCLASSA cls;
|
|
|
|
|
|
|
|
cls.style = 0;
|
|
|
|
cls.lpfnWndProc = parent_wnd_proc;
|
|
|
|
cls.cbClsExtra = 0;
|
|
|
|
cls.cbWndExtra = 0;
|
|
|
|
cls.hInstance = GetModuleHandleA(NULL);
|
|
|
|
cls.hIcon = 0;
|
2013-12-02 23:07:08 +01:00
|
|
|
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
|
2007-03-15 19:48:56 +01:00
|
|
|
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
|
|
|
|
cls.lpszMenuName = NULL;
|
|
|
|
cls.lpszClassName = "Trackbar test parent class";
|
|
|
|
return RegisterClassA(&cls);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND create_parent_window(void){
|
|
|
|
if (!register_parent_wnd_class())
|
|
|
|
return NULL;
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
return CreateWindowA("Trackbar test parent class", "Trackbar test parent window",
|
|
|
|
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE,
|
|
|
|
0, 0, 100, 100, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
2007-03-15 19:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
|
2009-10-11 14:25:17 +02:00
|
|
|
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
2009-04-02 12:04:50 +02:00
|
|
|
static LONG defwndproc_counter = 0;
|
2007-03-15 19:48:56 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
2012-12-08 17:38:27 +01:00
|
|
|
msg.id = 0;
|
2007-03-15 19:48:56 +01:00
|
|
|
add_message(sequences, TRACKBAR_SEQ_INDEX, &msg);
|
|
|
|
|
|
|
|
defwndproc_counter++;
|
2009-10-11 14:25:17 +02:00
|
|
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
2007-03-15 19:48:56 +01:00
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND create_trackbar(DWORD style, HWND parent){
|
2007-02-13 00:31:23 +01:00
|
|
|
HWND hWndTrack;
|
2009-10-11 14:25:17 +02:00
|
|
|
WNDPROC oldproc;
|
2007-03-15 19:48:56 +01:00
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
GetClientRect(parent, &rect);
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndTrack = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", style,
|
|
|
|
rect.right, rect.bottom, 100, 50,
|
|
|
|
parent, NULL, GetModuleHandleA(NULL), NULL);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2009-10-11 14:25:17 +02:00
|
|
|
if (!hWndTrack) return NULL;
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2009-10-11 14:25:17 +02:00
|
|
|
oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
|
|
|
|
SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)oldproc);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
return hWndTrack;
|
|
|
|
}
|
|
|
|
|
2016-01-09 21:45:20 +01:00
|
|
|
static HWND create_trackbar2(DWORD style, HWND parent)
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
GetClientRect(parent, &rect);
|
|
|
|
return CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", style,
|
|
|
|
rect.right, rect.bottom, 100, 50,
|
|
|
|
parent, NULL, GetModuleHandleA(NULL), NULL);
|
|
|
|
}
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
/* test functions for setters, getters, and sequences */
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_trackbar_buddy(void)
|
|
|
|
{
|
|
|
|
HWND hWndLeftBuddy, hWndTrackbar;
|
2007-02-13 00:31:23 +01:00
|
|
|
HWND hWndRightBuddy;
|
|
|
|
HWND hWndCurrentBuddy;
|
|
|
|
HWND rTest;
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndLeftBuddy = CreateWindowA(STATUSCLASSNAMEA, NULL, 0, 0, 0, 300, 20, NULL, NULL, NULL, NULL);
|
2007-02-15 22:37:53 +01:00
|
|
|
ok(hWndLeftBuddy != NULL, "Expected non NULL value\n");
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
if (hWndLeftBuddy != NULL){
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndCurrentBuddy = (HWND) SendMessageA(hWndTrackbar, TBM_GETBUDDY, TRUE, 0);
|
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_SETBUDDY, FALSE, (LPARAM) hWndLeftBuddy);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndCurrentBuddy, "Expected hWndCurrentBuddy\n");
|
2013-12-02 23:07:08 +01:00
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_SETBUDDY, FALSE, (LPARAM) hWndLeftBuddy);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndLeftBuddy, "Expected hWndLeftBuddy\n");
|
|
|
|
} else
|
|
|
|
skip ("left buddy control not present?\n");
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndRightBuddy = CreateWindowA(STATUSCLASSNAMEA, NULL, 0, 0, 0, 300, 20, NULL, NULL, NULL, NULL);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2007-02-15 22:37:53 +01:00
|
|
|
ok(hWndRightBuddy != NULL, "expected non NULL value\n");
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2007-03-15 19:47:32 +01:00
|
|
|
/* test TBM_SETBUDDY */
|
2007-02-13 00:31:23 +01:00
|
|
|
if (hWndRightBuddy != NULL){
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndCurrentBuddy = (HWND) SendMessageA(hWndTrackbar, TBM_GETBUDDY, TRUE, 0);
|
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_SETBUDDY, TRUE, (LPARAM) hWndRightBuddy);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndCurrentBuddy, "Expected hWndCurrentBuddy\n");
|
2013-12-02 23:07:08 +01:00
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_SETBUDDY, TRUE, (LPARAM) hWndRightBuddy);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndRightBuddy, "Expected hWndRightbuddy\n");
|
|
|
|
} else
|
2007-03-15 19:47:32 +01:00
|
|
|
skip("Right buddy control not present?\n");
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* test TBM_GETBUDDY */
|
|
|
|
if (hWndLeftBuddy != NULL){
|
2013-12-02 23:07:08 +01:00
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETBUDDY, FALSE, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndLeftBuddy, "Expected hWndLeftBuddy\n");
|
|
|
|
DestroyWindow(hWndLeftBuddy);
|
|
|
|
}
|
|
|
|
if (hWndRightBuddy != NULL){
|
2013-12-02 23:07:08 +01:00
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETBUDDY, TRUE,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndRightBuddy, "Expected hWndRightBuddy\n");
|
|
|
|
DestroyWindow(hWndRightBuddy);
|
|
|
|
}
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, buddy_window_test_seq, "buddy test sequence", TRUE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_buddy_window_test_seq, "parent buddy test seq", TRUE);
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_line_size(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETLINESIZE */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETLINESIZE, 0, 10);
|
2011-02-17 03:21:09 +01:00
|
|
|
expect(1,r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETLINESIZE, 0, 4);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
|
|
|
|
|
|
|
/* test TBM_GETLINESIZE */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETLINESIZE, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(4, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, line_size_test_seq, "linesize test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent line test sequence", FALSE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_page_size(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETPAGESIZE */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETPAGESIZE, 0, 10);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETPAGESIZE, 0, -1);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
|
|
|
|
|
|
|
/* test TBM_GETPAGESIZE */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPAGESIZE, 0,0);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(20, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, page_size_test_seq, "page size test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent page size test sequence", FALSE);
|
2009-03-23 21:05:49 +01:00
|
|
|
|
|
|
|
/* check for zero page size */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETPAGESIZE, 0, 0);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(0, r);
|
|
|
|
/* revert to default */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETPAGESIZE, 0, -1);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(20, r);
|
|
|
|
/* < -1 */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETPAGESIZE, 0, -2);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPAGESIZE, 0, 0);
|
2009-03-23 21:05:49 +01:00
|
|
|
expect(-2, r);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_position(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2016-01-09 21:45:20 +01:00
|
|
|
RECT rect, rect2;
|
|
|
|
WNDPROC oldproc;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETPOS */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, -1);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 5);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 5);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 1000);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(100, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 20);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 20);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* test TBM_GETPOS */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, position_test_seq, "position test sequence", TRUE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_position_test_seq, "parent position test sequence", TRUE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2016-01-09 21:45:20 +01:00
|
|
|
|
|
|
|
hWndTrackbar = create_trackbar2(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
|
|
|
/* subclassing procedure blocks WM_PAINT */
|
|
|
|
oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)trackbar_no_wmpaint_proc);
|
|
|
|
SetWindowLongPtrA(hWndTrackbar, GWLP_USERDATA, (LONG_PTR)oldproc);
|
|
|
|
|
2016-07-30 21:55:12 +02:00
|
|
|
SetRectEmpty(&rect);
|
|
|
|
SetRectEmpty(&rect2);
|
2016-01-09 21:45:20 +01:00
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
|
|
|
|
/* without repaint */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 25);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 25, "got %d\n", r);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2);
|
|
|
|
ok(rect.left == rect2.left, "got %d\n", rect.left);
|
|
|
|
|
|
|
|
/* with repaint */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 30);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 30, "got %d\n", r);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2);
|
2016-01-18 09:43:57 +01:00
|
|
|
ok(rect.left != rect2.left, "got %d, expected %d\n", rect2.left, rect.left);
|
|
|
|
|
|
|
|
/* now move it with keys */
|
|
|
|
SendMessageA(hWndTrackbar, WM_KEYDOWN, VK_END, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 100, "got %d\n", r);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
ok(rect.left != rect2.left, "got %d, expected %d\n", rect.left, rect2.left);
|
2016-01-09 21:45:20 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_range(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2016-07-14 22:39:53 +02:00
|
|
|
RECT rect1, rect2;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETRANGE */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-1, 1000));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(1000, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(-1, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(10, 0));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(0,10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
/*test TBM_SETRANGEMAX */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, -1);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(-1, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
|
|
|
|
|
|
|
/* testing TBM_SETRANGEMIN */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, -10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(-10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
|
|
|
|
|
|
|
/* test TBM_GETRANGEMAX */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
|
|
|
|
|
|
|
/* test TBM_GETRANGEMIN */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, range_test_seq, "range test sequence", TRUE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_range_test_seq, "parent range test sequence", TRUE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2016-07-14 22:39:53 +02:00
|
|
|
/* TBM_SETRANGE updates thumb visual position (rectangle) if needed */
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 0));
|
|
|
|
ok(r == 0, "got %d\n", r);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 0);
|
|
|
|
|
|
|
|
RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 10));
|
|
|
|
ok(r == 0, "got %d\n", r);
|
|
|
|
RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW);
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2);
|
|
|
|
ok(!EqualRect(&rect1, &rect2), "thumb rectangle not updated\n");
|
|
|
|
|
|
|
|
/* change range back, don't force repaint */
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(-10, 0));
|
|
|
|
ok(r == 0, "got %d\n", r);
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
ok(EqualRect(&rect1, &rect2), "thumb rectangle not updated\n");
|
|
|
|
|
2017-01-12 15:22:25 +01:00
|
|
|
/* test position update on range change */
|
|
|
|
|
|
|
|
/* set to [20, 50], position at 30, reduce range to [20,25] */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 20);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 50);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 30);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 25);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 25, "Unexpected position %d\n", r);
|
|
|
|
|
|
|
|
/* set to [20, 50], position at 30, flip max to 10 */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 20);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 50);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 30);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 20, "Unexpected position %d\n", r);
|
|
|
|
|
|
|
|
/* set to [20, 50], position at 30, flip min to 70 */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 20);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 50);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 30);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 70);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETPOS, 0, 0);
|
|
|
|
ok(r == 70, "Unexpected position %d\n", r);
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_selection(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETSEL */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(5, 20));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(5, 10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
|
|
|
|
|
|
|
/* test TBM_SETSELEND */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, TRUE, 20);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, TRUE, 4);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(4, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, FALSE, 2);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(2, r);
|
|
|
|
|
|
|
|
/* test TBM_GETSELEND */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(2, r);
|
|
|
|
|
|
|
|
/* testing TBM_SETSELSTART */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, TRUE, 5);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, TRUE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(5, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, TRUE, 20);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, FALSE, 8);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(8, r);
|
|
|
|
|
|
|
|
/* test TBM_GETSELSTART */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(8, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, selection_test_seq, "selection test sequence", TRUE);
|
2013-10-01 17:02:00 +02:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_selection_test_seq, "parent selection test sequence", TRUE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_thumb_length(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* testing TBM_SETTHUMBLENGTH */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTHUMBLENGTH, 15, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(15, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTHUMBLENGTH, 20, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
|
|
|
|
|
|
|
/* test TBM_GETTHUMBLENGTH */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(20, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, WM_SIZE, 0,0);
|
2012-02-05 16:43:34 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
|
2012-02-05 16:43:34 +01:00
|
|
|
expect(20, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, WM_SIZE, 0, MAKELPARAM(50, 50) );
|
2012-02-05 16:43:34 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0,0);
|
2012-02-05 16:43:34 +01:00
|
|
|
expect(20, r);
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, thumb_length_test_seq, "thumb length test sequence", TRUE);
|
2012-02-05 16:43:34 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_thumb_length_test_seq, "parent thumb length test sequence", TRUE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_tic_settings(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2016-12-12 20:03:20 +01:00
|
|
|
int r, i;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, FALSE, 5);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, FALSE, 10);
|
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* testing TBM_SETTIC */
|
|
|
|
/* Set tics at 5 and 10 */
|
|
|
|
/* 0 and 20 are out of range and should not be set */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMAX, 0, 0);
|
2009-09-02 19:06:08 +02:00
|
|
|
expect(10, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETRANGEMIN, 0, 0);
|
2009-09-02 19:06:08 +02:00
|
|
|
expect(5, r);
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(r == FALSE, "Expected FALSE, got %d\n", r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 5);
|
2009-09-02 19:06:08 +02:00
|
|
|
ok(r == TRUE, "Expected TRUE, got %d\n", r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 10);
|
2009-09-02 19:06:08 +02:00
|
|
|
ok(r == TRUE, "Expected TRUE, got %d\n", r);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIC, 0, 20);
|
2014-01-11 16:02:02 +01:00
|
|
|
ok(r == FALSE, "Expected FALSE, got %d\n", r);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* test TBM_SETTICFREQ */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(0, 10));
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 2, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2007-03-16 06:11:14 +01:00
|
|
|
expect(6, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 5, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2007-03-16 06:11:14 +01:00
|
|
|
expect(3, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 15, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(2, r);
|
|
|
|
|
|
|
|
/* test TBM_GETNUMTICS */
|
|
|
|
/* since TIC FREQ is 15, there should be only 2 tics now */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(2, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_settings_test_seq, "tic settings test sequence", TRUE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_tic_settings_test_seq, "parent tic settings test sequence", TRUE);
|
2009-09-18 00:18:48 +02:00
|
|
|
|
|
|
|
/* range [0,0], freq = 1 */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2009-09-18 00:18:48 +02:00
|
|
|
expect(2, r);
|
|
|
|
/* range [0,1], freq = 1 */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 1);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2009-09-18 00:18:48 +02:00
|
|
|
expect(2, r);
|
|
|
|
/* range [0,2], freq = 1 */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMAX, TRUE, 2);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGEMIN, TRUE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2009-09-18 00:18:48 +02:00
|
|
|
expect(3, r);
|
2016-12-12 20:03:20 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
|
|
|
|
|
|
|
/* Test to show that TBM_SETTICFREQ updates thumb */
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
DWORD style = i ? defaultstyle : defaultstyle & ~TBS_AUTOTICKS;
|
|
|
|
RECT rect, rect1;
|
|
|
|
WNDPROC oldproc;
|
|
|
|
|
|
|
|
hWndTrackbar = create_trackbar2(style, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
|
|
|
oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)trackbar_no_wmpaint_proc);
|
|
|
|
SetWindowLongPtrA(hWndTrackbar, GWLP_USERDATA, (LONG_PTR)oldproc);
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, FALSE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n",
|
|
|
|
wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect));
|
|
|
|
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(-100, 100));
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n",
|
|
|
|
wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect));
|
|
|
|
/* Old position is also 0, but thumb position will be different after range change */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
ok(EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n",
|
|
|
|
wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect));
|
|
|
|
/* Previous frequency is also 1, yet thumb is updated */
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
|
|
|
|
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
|
|
|
|
ok(!EqualRect(&rect, &rect1), "Unexpected thumb rectangle %s, previous %s\n",
|
|
|
|
wine_dbgstr_rect(&rect1), wine_dbgstr_rect(&rect));
|
|
|
|
|
|
|
|
SetWindowLongPtrA(hWndTrackbar, GWLP_WNDPROC, (LONG_PTR)oldproc);
|
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
|
|
|
}
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_tic_placement(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
|
|
|
DWORD *rPTics;
|
2008-07-12 02:37:21 +02:00
|
|
|
DWORD numtics;
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(1, 6));
|
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTICFREQ, 1, 0);
|
2008-07-12 02:37:21 +02:00
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
numtics = SendMessageA(hWndTrackbar, TBM_GETNUMTICS, 0, 0);
|
2008-07-12 02:37:21 +02:00
|
|
|
ok(numtics == 6, "Expected 6, got %d\n", numtics);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_GETPTICS */
|
2013-12-02 23:07:08 +01:00
|
|
|
rPTics = (DWORD *) SendMessageA(hWndTrackbar, TBM_GETPTICS, 0,0);
|
2008-07-12 02:37:21 +02:00
|
|
|
expect(2, rPTics[0]);
|
|
|
|
expect(3, rPTics[1]);
|
|
|
|
expect(4, rPTics[2]);
|
|
|
|
expect(5, rPTics[3]);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* test TBM_GETTIC */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTIC, 0,0);
|
2008-07-12 02:37:21 +02:00
|
|
|
expect(2, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTIC, 2,0);
|
2008-07-12 02:37:21 +02:00
|
|
|
expect(4, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTIC, 4,0);
|
2009-09-02 13:43:21 +02:00
|
|
|
expect(-1, r);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* test TBM_GETTICPIC */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTICPOS, 0, 0);
|
2008-07-12 02:37:21 +02:00
|
|
|
ok(r > 0, "Expected r > 0, got %d\n", r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETTICPOS, 2, 0);
|
2008-07-12 02:37:21 +02:00
|
|
|
ok(r > 0, "Expected r > 0, got %d\n", r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tic_placement_test_seq, "get tic placement test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent get tic placement test sequence", FALSE);
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
DestroyWindow(hWndTrackbar);
|
|
|
|
}
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_tool_tips(void)
|
|
|
|
{
|
|
|
|
HWND hWndTooltip, hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
HWND rTest;
|
2016-01-08 13:47:07 +01:00
|
|
|
int r;
|
|
|
|
|
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* testing TBM_SETTIPSIDE */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIPSIDE, TBTS_TOP, 0);
|
2009-09-02 18:35:15 +02:00
|
|
|
expect(TBTS_TOP, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIPSIDE, TBTS_LEFT, 0);
|
2009-09-02 18:35:15 +02:00
|
|
|
expect(TBTS_TOP, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIPSIDE, TBTS_BOTTOM, 0);
|
2009-09-02 18:35:15 +02:00
|
|
|
expect(TBTS_LEFT, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETTIPSIDE, TBTS_RIGHT, 0);
|
2009-09-02 18:35:15 +02:00
|
|
|
expect(TBTS_BOTTOM, r);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
/* testing TBM_SETTOOLTIPS */
|
2013-12-02 23:07:08 +01:00
|
|
|
hWndTooltip = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASSA, NULL, 0,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
NULL, NULL, NULL, NULL);
|
2007-02-13 00:31:23 +01:00
|
|
|
|
|
|
|
ok(hWndTooltip != NULL, "Expected non NULL value\n");
|
|
|
|
if (hWndTooltip != NULL){
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 0);
|
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
|
2007-02-15 22:37:53 +01:00
|
|
|
ok(rTest == hWndTooltip, "Expected hWndToolTip, got\n");
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTOOLTIPS, 0, 0);
|
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == NULL, "Expected NULL\n");
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETTOOLTIPS, (LPARAM) hWndTooltip, 5);
|
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndTooltip, "Expected hWndTooltip, got\n");
|
|
|
|
} else
|
|
|
|
skip("tool tip control not present?\n");
|
|
|
|
|
|
|
|
/* test TBM_GETTOOLTIPS */
|
2013-12-02 23:07:08 +01:00
|
|
|
rTest = (HWND) SendMessageA(hWndTrackbar, TBM_GETTOOLTIPS, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(rTest == hWndTooltip, "Expected hWndTooltip\n");
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, tool_tips_test_seq, "tool tips test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent tool tips test sequence", FALSE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_unicode(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
2007-02-13 00:31:23 +01:00
|
|
|
/* testing TBM_SETUNICODEFORMAT */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETUNICODEFORMAT, TRUE, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(r == FALSE, "Expected FALSE, got %d\n",r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_SETUNICODEFORMAT, FALSE, 0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(r == TRUE, "Expected TRUE, got %d\n",r);
|
|
|
|
|
|
|
|
/* test TBM_GETUNICODEFORMAT */
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETUNICODEFORMAT, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
ok(r == FALSE, "Expected FALSE, got %d\n",r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, unicode_test_seq, "unicode test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent unicode test sequence", FALSE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
}
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_ignore_selection(void)
|
|
|
|
{
|
|
|
|
HWND hWndTrackbar;
|
2007-03-15 19:47:32 +01:00
|
|
|
int r;
|
2007-02-13 00:31:23 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(0, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2007-02-13 00:31:23 +01:00
|
|
|
/* test TBM_SETSEL ensure that it is ignored */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-03-16 06:04:45 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(0,10));
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-03-16 06:04:45 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
/* test TBM_SETSELEND, ensure that it is ignored */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, TRUE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-03-16 06:04:45 +01:00
|
|
|
expect(0,r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELEND, FALSE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELEND, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
/* test TBM_SETSELSTART, ensure that it is ignored */
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, TRUE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, TRUE, 10);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-03-16 06:04:45 +01:00
|
|
|
expect(0,r);
|
2013-12-02 23:07:08 +01:00
|
|
|
SendMessageA(hWndTrackbar, TBM_SETSELSTART, FALSE, 0);
|
|
|
|
r = SendMessageA(hWndTrackbar, TBM_GETSELSTART, 0,0);
|
2007-02-13 00:31:23 +01:00
|
|
|
expect(0, r);
|
2007-03-15 19:48:56 +01:00
|
|
|
|
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, ignore_selection_test_seq, "ignore selection setting test sequence", FALSE);
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "parent ignore selection setting test sequence", FALSE);
|
2016-01-08 13:47:07 +01:00
|
|
|
|
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-02-13 00:31:23 +01:00
|
|
|
}
|
|
|
|
|
2009-09-02 13:43:21 +02:00
|
|
|
static void test_initial_state(void)
|
|
|
|
{
|
|
|
|
HWND hWnd;
|
2011-05-27 14:49:05 +02:00
|
|
|
int ret;
|
2009-09-02 13:43:21 +02:00
|
|
|
|
|
|
|
hWnd = create_trackbar(0, hWndParent);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2009-09-02 13:43:21 +02:00
|
|
|
expect(2, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETTIC, 0, 0);
|
2009-09-02 13:43:21 +02:00
|
|
|
expect(-1, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETTICPOS, 0, 0);
|
2009-09-02 13:43:21 +02:00
|
|
|
expect(-1, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETRANGEMIN, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETRANGEMAX, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(100, ret);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMAX, TRUE, 200);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(0, ret);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(2, ret);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMIN, TRUE, 10);
|
2012-02-12 14:22:37 +01:00
|
|
|
expect(0, ret);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:22:37 +01:00
|
|
|
expect(2, ret);
|
|
|
|
|
2012-02-12 14:17:53 +01:00
|
|
|
DestroyWindow(hWnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_TBS_AUTOTICKS(void)
|
|
|
|
{
|
|
|
|
HWND hWnd;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
hWnd = create_trackbar(TBS_AUTOTICKS, hWndParent);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(2, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETTIC, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(-1, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETTICPOS, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(-1, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETRANGEMIN, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETRANGEMAX, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(100, ret);
|
|
|
|
|
2012-02-12 14:22:37 +01:00
|
|
|
/* TBM_SETRANGEMAX rebuilds tics */
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMAX, TRUE, 200);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:17:53 +01:00
|
|
|
expect(201, ret);
|
2009-09-02 13:43:21 +02:00
|
|
|
|
2012-02-12 14:22:37 +01:00
|
|
|
/* TBM_SETRANGEMIN rebuilds tics */
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMAX, TRUE, 100);
|
2012-02-12 14:22:37 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMIN, TRUE, 10);
|
2012-02-12 14:22:37 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:22:37 +01:00
|
|
|
expect(91, ret);
|
|
|
|
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGEMIN, TRUE, 0);
|
2012-02-12 14:29:54 +01:00
|
|
|
expect(0, ret);
|
|
|
|
|
|
|
|
/* TBM_SETRANGE rebuilds tics */
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_SETRANGE, TRUE, MAKELONG(10, 200));
|
2012-02-12 14:29:54 +01:00
|
|
|
expect(0, ret);
|
2013-12-02 23:07:08 +01:00
|
|
|
ret = SendMessageA(hWnd, TBM_GETNUMTICS, 0, 0);
|
2012-02-12 14:29:54 +01:00
|
|
|
expect(191, ret);
|
|
|
|
|
2009-09-02 13:43:21 +02:00
|
|
|
DestroyWindow(hWnd);
|
|
|
|
}
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
static void test_create(void)
|
2007-02-13 00:31:23 +01:00
|
|
|
{
|
2007-03-15 19:47:32 +01:00
|
|
|
HWND hWndTrackbar;
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
|
2007-03-15 19:47:32 +01:00
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
2012-03-09 17:09:35 +01:00
|
|
|
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, empty_seq, "create Trackbar Window", FALSE);
|
2007-03-15 19:48:56 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_create_trackbar_wnd_seq, "parent trackbar window", TRUE);
|
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
DestroyWindow(hWndTrackbar);
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
/* no style bits */
|
2007-03-15 19:48:56 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCE);
|
2016-01-08 13:47:07 +01:00
|
|
|
hWndTrackbar = create_trackbar(0, hWndParent);
|
|
|
|
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_new_window_test_seq, "new trackbar window test sequence", TRUE);
|
2007-03-15 19:47:32 +01:00
|
|
|
DestroyWindow(hWndTrackbar);
|
2016-01-08 13:47:07 +01:00
|
|
|
}
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
START_TEST(trackbar)
|
|
|
|
{
|
|
|
|
init_msg_sequences(sequences, NUM_MSG_SEQUENCE);
|
|
|
|
InitCommonControls();
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
/* create parent window */
|
|
|
|
hWndParent = create_parent_window();
|
|
|
|
ok(hWndParent != NULL, "Failed to create parent Window!\n");
|
2007-03-15 19:47:32 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
if(!hWndParent){
|
|
|
|
skip("parent window not present\n");
|
2007-03-15 19:47:32 +01:00
|
|
|
return;
|
|
|
|
}
|
2007-03-15 19:48:56 +01:00
|
|
|
|
2016-01-08 13:47:07 +01:00
|
|
|
test_create();
|
|
|
|
test_trackbar_buddy();
|
|
|
|
test_line_size();
|
|
|
|
test_page_size();
|
|
|
|
test_position();
|
|
|
|
test_range();
|
|
|
|
test_selection();
|
|
|
|
test_thumb_length();
|
|
|
|
test_tic_settings();
|
|
|
|
test_tic_placement();
|
|
|
|
test_tool_tips();
|
|
|
|
test_unicode();
|
|
|
|
test_TBS_AUTOTICKS();
|
|
|
|
test_ignore_selection();
|
2009-09-02 13:43:21 +02:00
|
|
|
test_initial_state();
|
|
|
|
|
2007-03-15 19:48:56 +01:00
|
|
|
DestroyWindow(hWndParent);
|
2007-02-13 00:31:23 +01:00
|
|
|
}
|