2003-10-31 01:06:42 +01:00
|
|
|
/* Unit test suite for tab control.
|
|
|
|
*
|
|
|
|
* Copyright 2003 Vitaliy Margolen
|
2007-03-11 22:21:12 +01:00
|
|
|
* Copyright 2007 Hagop Hagopian
|
2003-10-31 01:06:42 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-10-31 01:06:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
2007-03-11 22:21:12 +01:00
|
|
|
#include <stdio.h>
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
#include "wine/test.h"
|
2007-03-17 23:12:13 +01:00
|
|
|
#include "msg.h"
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
#define DEFAULT_MIN_TAB_WIDTH 54
|
|
|
|
#define TAB_PADDING_X 6
|
|
|
|
#define EXTRA_ICON_PADDING 3
|
2007-03-11 22:21:12 +01:00
|
|
|
#define MAX_TABLEN 32
|
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
#define NUM_MSG_SEQUENCES 2
|
|
|
|
#define PARENT_SEQ_INDEX 0
|
|
|
|
#define TAB_SEQ_INDEX 1
|
|
|
|
|
2007-03-11 22:21:12 +01:00
|
|
|
#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
|
|
|
|
#define expect_str(expected, got)\
|
|
|
|
ok ( strcmp(expected, got) == 0, "Expected '%s', got '%s'\n", expected, got)
|
2005-08-23 12:05:54 +02:00
|
|
|
|
|
|
|
#define TabWidthPadded(padd_x, num) (DEFAULT_MIN_TAB_WIDTH - (TAB_PADDING_X - (padd_x)) * num)
|
|
|
|
|
|
|
|
#define TabCheckSetSize(hwnd, SetWidth, SetHeight, ExpWidth, ExpHeight, Msg)\
|
|
|
|
SendMessage (hwnd, TCM_SETITEMSIZE, 0,\
|
|
|
|
(LPARAM) MAKELPARAM((SetWidth >= 0) ? SetWidth:0, (SetHeight >= 0) ? SetHeight:0));\
|
|
|
|
if (winetest_interactive) RedrawWindow (hwnd, NULL, 0, RDW_UPDATENOW);\
|
|
|
|
CheckSize(hwnd, ExpWidth, ExpHeight, Msg);
|
|
|
|
|
|
|
|
#define CheckSize(hwnd,width,height,msg)\
|
|
|
|
SendMessage (hwnd, TCM_GETITEMRECT, 0, (LPARAM) &rTab);\
|
|
|
|
if ((width >= 0) && (height < 0))\
|
2006-10-13 15:17:40 +02:00
|
|
|
ok (width == rTab.right - rTab.left, "%s: Expected width [%d] got [%d]\n",\
|
2005-08-23 12:05:54 +02:00
|
|
|
msg, (int)width, rTab.right - rTab.left);\
|
|
|
|
else if ((height >= 0) && (width < 0))\
|
2006-10-13 15:17:40 +02:00
|
|
|
ok (height == rTab.bottom - rTab.top, "%s: Expected height [%d] got [%d]\n",\
|
2005-08-23 12:05:54 +02:00
|
|
|
msg, (int)height, rTab.bottom - rTab.top);\
|
|
|
|
else\
|
|
|
|
ok ((width == rTab.right - rTab.left) &&\
|
|
|
|
(height == rTab.bottom - rTab.top ),\
|
2006-10-13 15:17:40 +02:00
|
|
|
"%s: Expected [%d,%d] got [%d,%d]\n", msg, (int)width, (int)height,\
|
2005-08-23 12:05:54 +02:00
|
|
|
rTab.right - rTab.left, rTab.bottom - rTab.top);
|
|
|
|
|
|
|
|
static HFONT hFont = 0;
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
|
|
|
|
|
|
|
static const struct message create_parent_wnd_seq[] = {
|
|
|
|
{ WM_GETMINMAXINFO, sent },
|
|
|
|
{ WM_NCCREATE, sent },
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam, 0 },
|
|
|
|
{ WM_CREATE, sent },
|
|
|
|
{ WM_SHOWWINDOW, sent|wparam, 1 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ WM_ACTIVATEAPP, sent|wparam, 1 },
|
|
|
|
{ WM_NCACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_ACTIVATE, sent|wparam, 1 },
|
|
|
|
{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
|
|
|
|
{ WM_IME_NOTIFY, sent|defwinproc|optional },
|
|
|
|
{ WM_SETFOCUS, sent|wparam|defwinproc, 0 },
|
|
|
|
/* Win9x adds SWP_NOZORDER below */
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent},
|
|
|
|
{ WM_NCCALCSIZE, sent|wparam|optional, 1 },
|
|
|
|
{ WM_SIZE, sent },
|
|
|
|
{ WM_MOVE, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message add_tab_to_parent[] = {
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
2009-08-05 14:00:03 +02:00
|
|
|
{ TCM_INSERTITEMA, sent|optional },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ WM_NOTIFYFORMAT, sent|defwinproc },
|
2008-09-08 07:46:00 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc|optional, 0, 0 },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ WM_PARENTNOTIFY, sent|defwinproc },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
2009-08-05 14:00:03 +02:00
|
|
|
{ TCM_INSERTITEMA, sent|optional },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message add_tab_to_parent_interactive[] = {
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ WM_NOTIFYFORMAT, sent|defwinproc },
|
|
|
|
{ WM_QUERYUISTATE, sent|wparam|lparam|defwinproc, 0, 0 },
|
|
|
|
{ WM_PARENTNOTIFY, sent|defwinproc },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ TCM_INSERTITEMA, sent },
|
|
|
|
{ WM_SHOWWINDOW, sent},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent},
|
|
|
|
{ WM_NCACTIVATE, sent},
|
|
|
|
{ WM_ACTIVATE, sent},
|
|
|
|
{ WM_IME_SETCONTEXT, sent|defwinproc|optional},
|
|
|
|
{ WM_IME_NOTIFY, sent|defwinproc|optional},
|
|
|
|
{ WM_SETFOCUS, sent|defwinproc},
|
|
|
|
{ WM_WINDOWPOSCHANGED, sent},
|
|
|
|
{ WM_SIZE, sent},
|
|
|
|
{ WM_MOVE, sent},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message add_tab_control_parent_seq[] = {
|
|
|
|
{ WM_NOTIFYFORMAT, sent },
|
2008-09-08 07:46:00 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message add_tab_control_parent_seq_interactive[] = {
|
|
|
|
{ WM_NOTIFYFORMAT, sent },
|
|
|
|
{ WM_QUERYUISTATE, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|optional},
|
|
|
|
{ WM_NCACTIVATE, sent},
|
|
|
|
{ WM_ACTIVATE, sent},
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|optional},
|
|
|
|
{ WM_KILLFOCUS, sent},
|
|
|
|
{ WM_IME_SETCONTEXT, sent|optional},
|
|
|
|
{ WM_IME_NOTIFY, sent|optional},
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message empty_sequence[] = {
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message set_min_tab_width_seq[] = {
|
|
|
|
{ TCM_SETMINTABWIDTH, sent|wparam, 0 },
|
|
|
|
{ TCM_SETMINTABWIDTH, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message get_item_count_seq[] = {
|
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message get_row_count_seq[] = {
|
|
|
|
{ TCM_GETROWCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message get_item_rect_seq[] = {
|
|
|
|
{ TCM_GETITEMRECT, sent },
|
|
|
|
{ TCM_GETITEMRECT, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_cur_focus_seq[] = {
|
|
|
|
{ TCM_SETCURFOCUS, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETCURFOCUS, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETCURSEL, sent|lparam, 0 },
|
|
|
|
{ TCM_SETCURFOCUS, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_cur_sel_seq[] = {
|
|
|
|
{ TCM_SETCURSEL, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
|
2007-09-04 08:38:19 +02:00
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ TCM_SETCURSEL, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURSEL, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETCURSEL, sent|lparam, 0 },
|
|
|
|
{ TCM_SETCURSEL, sent|lparam, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_extended_style_seq[] = {
|
|
|
|
{ TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETEXTENDEDSTYLE, sent },
|
|
|
|
{ TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETEXTENDEDSTYLE, sent },
|
|
|
|
{ TCM_GETEXTENDEDSTYLE, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_unicode_format_seq[] = {
|
|
|
|
{ CCM_SETUNICODEFORMAT, sent|lparam, 0 },
|
|
|
|
{ CCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ CCM_SETUNICODEFORMAT, sent|lparam, 0 },
|
|
|
|
{ CCM_GETUNICODEFORMAT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ CCM_SETUNICODEFORMAT, sent|lparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_item_seq[] = {
|
|
|
|
{ TCM_SETITEMA, sent },
|
|
|
|
{ TCM_GETITEMA, sent },
|
|
|
|
{ TCM_GETITEMA, sent },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_tooltip_seq[] = {
|
2008-09-08 07:46:00 +02:00
|
|
|
{ WM_NOTIFYFORMAT, sent|optional },
|
|
|
|
{ WM_QUERYUISTATE, sent|wparam|lparam|optional, 0, 0 },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
2008-09-08 07:46:00 +02:00
|
|
|
{ WM_NOTIFYFORMAT, sent|optional },
|
2007-03-17 23:12:13 +01:00
|
|
|
{ TCM_SETTOOLTIPS, sent|lparam, 0 },
|
|
|
|
{ TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETTOOLTIPS, sent|lparam, 0 },
|
|
|
|
{ TCM_GETTOOLTIPS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct message getset_tooltip_parent_seq[] = {
|
|
|
|
{ WM_WINDOWPOSCHANGING, sent|wparam, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-10-30 02:32:34 +01:00
|
|
|
static const struct message insert_focus_seq[] = {
|
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_INSERTITEM, sent|wparam, 1 },
|
2009-08-05 14:00:03 +02:00
|
|
|
{ WM_NOTIFYFORMAT, sent|defwinproc|optional },
|
|
|
|
{ WM_QUERYUISTATE, sent|defwinproc|optional },
|
|
|
|
{ WM_PARENTNOTIFY, sent|defwinproc|optional },
|
2007-10-30 02:32:34 +01:00
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_INSERTITEM, sent|wparam, 2 },
|
2009-08-05 14:00:03 +02:00
|
|
|
{ WM_NOTIFYFORMAT, sent|defwinproc|optional },
|
2008-09-08 07:46:00 +02:00
|
|
|
{ WM_QUERYUISTATE, sent|defwinproc|optional, },
|
2009-08-05 14:00:03 +02:00
|
|
|
{ WM_PARENTNOTIFY, sent|defwinproc|optional },
|
2007-10-30 02:32:34 +01:00
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_INSERTITEM, sent|wparam, 3 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-10-30 02:44:48 +01:00
|
|
|
static const struct message delete_focus_seq[] = {
|
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_DELETEITEM, sent|wparam|lparam, 1, 0 },
|
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_SETCURFOCUS, sent|wparam|lparam, -1, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_DELETEITEM, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETITEMCOUNT, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ TCM_GETCURFOCUS, sent|wparam|lparam, 0, 0 },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
2007-10-30 02:32:34 +01:00
|
|
|
|
2005-06-09 11:50:56 +02:00
|
|
|
static HWND
|
2005-08-23 12:05:54 +02:00
|
|
|
create_tabcontrol (DWORD style, DWORD mask)
|
2003-10-31 01:06:42 +01:00
|
|
|
{
|
|
|
|
HWND handle;
|
|
|
|
TCITEM tcNewTab;
|
2006-05-27 19:14:52 +02:00
|
|
|
static char text1[] = "Tab 1",
|
|
|
|
text2[] = "Wide Tab 2",
|
|
|
|
text3[] = "T 3";
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
handle = CreateWindow (
|
|
|
|
WC_TABCONTROLA,
|
|
|
|
"TestTab",
|
|
|
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style,
|
2003-12-02 04:31:44 +01:00
|
|
|
10, 10, 300, 100,
|
2003-10-31 01:06:42 +01:00
|
|
|
NULL, NULL, NULL, 0);
|
|
|
|
|
|
|
|
assert (handle);
|
2005-08-23 12:05:54 +02:00
|
|
|
|
2003-12-02 04:31:44 +01:00
|
|
|
SetWindowLong(handle, GWL_STYLE, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style);
|
2005-08-23 12:05:54 +02:00
|
|
|
SendMessage (handle, WM_SETFONT, 0, (LPARAM) hFont);
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
tcNewTab.mask = mask;
|
2006-05-27 19:14:52 +02:00
|
|
|
tcNewTab.pszText = text1;
|
2003-10-31 01:06:42 +01:00
|
|
|
tcNewTab.iImage = 0;
|
|
|
|
SendMessage (handle, TCM_INSERTITEM, 0, (LPARAM) &tcNewTab);
|
2006-05-27 19:14:52 +02:00
|
|
|
tcNewTab.pszText = text2;
|
2003-10-31 01:06:42 +01:00
|
|
|
tcNewTab.iImage = 1;
|
|
|
|
SendMessage (handle, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
|
2006-05-27 19:14:52 +02:00
|
|
|
tcNewTab.pszText = text3;
|
2003-10-31 01:06:42 +01:00
|
|
|
tcNewTab.iImage = 2;
|
|
|
|
SendMessage (handle, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
if (winetest_interactive)
|
|
|
|
{
|
|
|
|
ShowWindow (handle, SW_SHOW);
|
|
|
|
RedrawWindow (handle, NULL, 0, RDW_UPDATENOW);
|
|
|
|
Sleep (1000);
|
|
|
|
}
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-04-02 12:04:50 +02:00
|
|
|
static LONG defwndproc_counter = 0;
|
2007-03-17 23:12:13 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
/* do not log painting messages */
|
|
|
|
if (message != WM_PAINT &&
|
|
|
|
message != WM_ERASEBKGND &&
|
|
|
|
message != WM_NCPAINT &&
|
|
|
|
message != WM_NCHITTEST &&
|
|
|
|
message != WM_GETTEXT &&
|
|
|
|
message != WM_GETICON &&
|
|
|
|
message != WM_DEVICECHANGE)
|
|
|
|
{
|
2007-05-24 16:41:17 +02:00
|
|
|
trace("parent: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
|
2007-03-17 23:12:13 +01:00
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(sequences, PARENT_SEQ_INDEX, &msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
defwndproc_counter++;
|
|
|
|
ret = DefWindowProcA(hwnd, message, wParam, lParam);
|
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL registerParentWindowClass(void)
|
|
|
|
{
|
|
|
|
WNDCLASSA cls;
|
|
|
|
|
|
|
|
cls.style = 0;
|
|
|
|
cls.lpfnWndProc = parentWindowProcess;
|
|
|
|
cls.cbClsExtra = 0;
|
|
|
|
cls.cbWndExtra = 0;
|
|
|
|
cls.hInstance = GetModuleHandleA(NULL);
|
|
|
|
cls.hIcon = 0;
|
2009-01-04 22:58:57 +01:00
|
|
|
cls.hCursor = LoadCursorA(0, IDC_ARROW);
|
2007-03-17 23:12:13 +01:00
|
|
|
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
|
|
|
|
cls.lpszMenuName = NULL;
|
|
|
|
cls.lpszClassName = "Tab test parent class";
|
|
|
|
return RegisterClassA(&cls);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND createParentWindow(void)
|
|
|
|
{
|
|
|
|
if (!registerParentWindowClass())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return CreateWindowEx(0, "Tab test parent class",
|
|
|
|
"Tab test parent window",
|
|
|
|
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
|
|
|
|
WS_MAXIMIZEBOX | WS_VISIBLE,
|
|
|
|
0, 0, 100, 100,
|
|
|
|
GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI tabSubclassProcess(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-17 23:12:13 +01:00
|
|
|
LRESULT ret;
|
|
|
|
struct message msg;
|
|
|
|
|
|
|
|
/* do not log painting messages */
|
|
|
|
if (message != WM_PAINT &&
|
|
|
|
message != WM_ERASEBKGND &&
|
|
|
|
message != WM_NCPAINT &&
|
|
|
|
message != WM_NCHITTEST &&
|
|
|
|
message != WM_GETTEXT &&
|
|
|
|
message != WM_GETICON &&
|
|
|
|
message != WM_DEVICECHANGE)
|
|
|
|
{
|
2007-05-24 16:41:17 +02:00
|
|
|
trace("tab: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
|
2007-03-17 23:12:13 +01:00
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.flags = sent|wparam|lparam;
|
|
|
|
if (defwndproc_counter) msg.flags |= defwinproc;
|
|
|
|
msg.wParam = wParam;
|
|
|
|
msg.lParam = lParam;
|
|
|
|
add_message(sequences, TAB_SEQ_INDEX, &msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
defwndproc_counter++;
|
2009-10-11 14:25:17 +02:00
|
|
|
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
2007-03-17 23:12:13 +01:00
|
|
|
defwndproc_counter--;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT nTabs)
|
2007-03-11 22:21:12 +01:00
|
|
|
{
|
|
|
|
HWND tabHandle;
|
|
|
|
TCITEM tcNewTab;
|
2009-10-11 14:25:17 +02:00
|
|
|
WNDPROC oldproc;
|
2007-03-17 23:12:13 +01:00
|
|
|
RECT rect;
|
2007-03-11 22:21:12 +01:00
|
|
|
INT i;
|
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
GetClientRect(parent_wnd, &rect);
|
|
|
|
|
2007-03-11 22:21:12 +01:00
|
|
|
tabHandle = CreateWindow (
|
|
|
|
WC_TABCONTROLA,
|
|
|
|
"TestTab",
|
|
|
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style,
|
2007-03-17 23:12:13 +01:00
|
|
|
0, 0, rect.right, rect.bottom,
|
|
|
|
parent_wnd, NULL, NULL, 0);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
assert(tabHandle);
|
|
|
|
|
2009-10-11 14:25:17 +02:00
|
|
|
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
|
|
|
|
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
tcNewTab.mask = mask;
|
|
|
|
|
|
|
|
for (i = 0; i < nTabs; i++)
|
|
|
|
{
|
|
|
|
char tabName[MAX_TABLEN];
|
|
|
|
|
|
|
|
sprintf(tabName, "Tab %d", i+1);
|
|
|
|
tcNewTab.pszText = tabName;
|
|
|
|
tcNewTab.iImage = i;
|
|
|
|
SendMessage (tabHandle, TCM_INSERTITEM, i, (LPARAM) &tcNewTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (winetest_interactive)
|
|
|
|
{
|
|
|
|
ShowWindow (tabHandle, SW_SHOW);
|
|
|
|
RedrawWindow (tabHandle, NULL, 0, RDW_UPDATENOW);
|
|
|
|
Sleep (1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tabHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HWND create_tooltip (HWND hTab, char toolTipText[])
|
|
|
|
{
|
|
|
|
HWND hwndTT;
|
|
|
|
|
|
|
|
TOOLINFO ti;
|
|
|
|
LPTSTR lptstr = toolTipText;
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
/* Creating a tooltip window*/
|
|
|
|
hwndTT = CreateWindowEx(
|
|
|
|
WS_EX_TOPMOST,
|
|
|
|
TOOLTIPS_CLASS,
|
|
|
|
NULL,
|
|
|
|
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
hTab, NULL, 0, NULL);
|
|
|
|
|
|
|
|
SetWindowPos(
|
|
|
|
hwndTT,
|
|
|
|
HWND_TOPMOST,
|
|
|
|
0, 0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
GetClientRect (hTab, &rect);
|
|
|
|
|
|
|
|
/* Initialize members of toolinfo*/
|
|
|
|
ti.cbSize = sizeof(TOOLINFO);
|
|
|
|
ti.uFlags = TTF_SUBCLASS;
|
|
|
|
ti.hwnd = hTab;
|
|
|
|
ti.hinst = 0;
|
|
|
|
ti.uId = 0;
|
|
|
|
ti.lpszText = lptstr;
|
|
|
|
|
|
|
|
ti.rect = rect;
|
|
|
|
|
|
|
|
/* Add toolinfo structure to the tooltip control */
|
2009-02-06 10:38:02 +01:00
|
|
|
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) &ti);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
return hwndTT;
|
|
|
|
}
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
static void test_tab(INT nMinTabWidth)
|
2003-10-31 01:06:42 +01:00
|
|
|
{
|
|
|
|
HWND hwTab;
|
2005-08-23 12:05:54 +02:00
|
|
|
RECT rTab;
|
2003-10-31 01:06:42 +01:00
|
|
|
HIMAGELIST himl = ImageList_Create(21, 21, ILC_COLOR, 3, 4);
|
2005-08-23 12:05:54 +02:00
|
|
|
SIZE size;
|
|
|
|
HDC hdc;
|
|
|
|
HFONT hOldFont;
|
2009-08-05 14:00:03 +02:00
|
|
|
INT i, dpi, exp;
|
2005-08-23 12:05:54 +02:00
|
|
|
|
|
|
|
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
2008-12-02 15:14:35 +01:00
|
|
|
/* Get System default MinTabWidth */
|
|
|
|
if (nMinTabWidth < 0)
|
|
|
|
nMinTabWidth = SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
2005-08-23 12:05:54 +02:00
|
|
|
|
|
|
|
hdc = GetDC(hwTab);
|
2008-10-14 01:17:43 +02:00
|
|
|
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
2005-08-23 12:05:54 +02:00
|
|
|
hOldFont = SelectObject(hdc, (HFONT)SendMessage(hwTab, WM_GETFONT, 0, 0));
|
|
|
|
GetTextExtentPoint32A(hdc, "Tab 1", strlen("Tab 1"), &size);
|
2006-10-13 15:17:40 +02:00
|
|
|
trace("Tab1 text size: size.cx=%d size.cy=%d\n", size.cx, size.cy);
|
2005-08-23 12:05:54 +02:00
|
|
|
SelectObject(hdc, hOldFont);
|
|
|
|
ReleaseDC(hwTab, hdc);
|
|
|
|
|
|
|
|
trace (" TCS_FIXEDWIDTH tabs no icon...\n");
|
2008-10-14 01:17:43 +02:00
|
|
|
CheckSize(hwTab, dpi, -1, "default width");
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 50, 20, 50, 20, "set size");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
trace (" TCS_FIXEDWIDTH tabs with icon...\n");
|
|
|
|
TabCheckSetSize(hwTab, 50, 30, 50, 30, "set size > icon");
|
|
|
|
TabCheckSetSize(hwTab, 20, 20, 25, 20, "set size < icon");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 25, 1, "min size");
|
|
|
|
|
|
|
|
DestroyWindow (hwTab);
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BUTTONS, TCIF_TEXT|TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2008-10-14 01:17:43 +02:00
|
|
|
hdc = GetDC(hwTab);
|
|
|
|
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
|
|
ReleaseDC(hwTab, hdc);
|
2005-08-23 12:05:54 +02:00
|
|
|
trace (" TCS_FIXEDWIDTH buttons no icon...\n");
|
2008-10-14 01:17:43 +02:00
|
|
|
CheckSize(hwTab, dpi, -1, "default width");
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 20, 20, 20, 20, "set size 1");
|
|
|
|
TabCheckSetSize(hwTab, 10, 50, 10, 50, "set size 2");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 0, 1, "min size");
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
trace (" TCS_FIXEDWIDTH buttons with icon...\n");
|
|
|
|
TabCheckSetSize(hwTab, 50, 30, 50, 30, "set size > icon");
|
|
|
|
TabCheckSetSize(hwTab, 20, 20, 25, 20, "set size < icon");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 25, 1, "min size");
|
|
|
|
SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4,4));
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 25, 1, "set padding, min size");
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
DestroyWindow (hwTab);
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
hwTab = create_tabcontrol(TCS_FIXEDWIDTH | TCS_BOTTOM, TCIF_TEXT|TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
|
|
|
|
2008-10-14 01:17:43 +02:00
|
|
|
hdc = GetDC(hwTab);
|
|
|
|
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
|
|
ReleaseDC(hwTab, hdc);
|
2005-08-23 12:05:54 +02:00
|
|
|
trace (" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...\n");
|
2008-10-14 01:17:43 +02:00
|
|
|
CheckSize(hwTab, dpi, -1, "no icon, default width");
|
2003-10-31 01:06:42 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 20, 20, 20, 20, "no icon, set size 1");
|
|
|
|
TabCheckSetSize(hwTab, 10, 50, 10, 50, "no icon, set size 2");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 0, 1, "no icon, min size");
|
2003-10-31 01:06:42 +01:00
|
|
|
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 50, 30, 50, 30, "with icon, set size > icon");
|
|
|
|
TabCheckSetSize(hwTab, 20, 20, 25, 20, "with icon, set size < icon");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, 25, 1, "with icon, min size");
|
2003-10-31 01:06:42 +01:00
|
|
|
SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(4,4));
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 0, 1, 25, 1, "set padding, min size");
|
2003-12-02 04:31:44 +01:00
|
|
|
|
|
|
|
DestroyWindow (hwTab);
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
hwTab = create_tabcontrol(0, TCIF_TEXT|TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
2003-12-02 04:31:44 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
trace (" non fixed width, with text...\n");
|
2009-08-05 14:00:03 +02:00
|
|
|
exp = max(size.cx +TAB_PADDING_X*2, (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth);
|
|
|
|
SendMessage( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
|
|
|
|
ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
|
|
|
|
"no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
for (i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
|
2003-12-02 04:31:44 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, 0);
|
|
|
|
SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i,i));
|
2003-12-02 04:31:44 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
TabCheckSetSize(hwTab, 50, 20, max(size.cx + i*2, nTabWidth), 20, "no icon, set size");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, max(size.cx + i*2, nTabWidth), 1, "no icon, min size");
|
|
|
|
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
|
|
|
nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 3) : nMinTabWidth;
|
|
|
|
|
|
|
|
TabCheckSetSize(hwTab, 50, 30, max(size.cx + 21 + i*3, nTabWidth), 30, "with icon, set size > icon");
|
|
|
|
TabCheckSetSize(hwTab, 20, 20, max(size.cx + 21 + i*3, nTabWidth), 20, "with icon, set size < icon");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, max(size.cx + 21 + i*3, nTabWidth), 1, "with icon, min size");
|
|
|
|
}
|
2003-10-31 01:06:42 +01:00
|
|
|
DestroyWindow (hwTab);
|
2003-12-02 04:31:44 +01:00
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
hwTab = create_tabcontrol(0, TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETMINTABWIDTH, 0, nMinTabWidth);
|
|
|
|
|
|
|
|
trace (" non fixed width, no text...\n");
|
2009-08-05 14:00:03 +02:00
|
|
|
exp = (nMinTabWidth < 0) ? DEFAULT_MIN_TAB_WIDTH : nMinTabWidth;
|
|
|
|
SendMessage( hwTab, TCM_GETITEMRECT, 0, (LPARAM)&rTab );
|
|
|
|
ok( rTab.right - rTab.left == exp || broken(rTab.right - rTab.left == DEFAULT_MIN_TAB_WIDTH),
|
|
|
|
"no icon, default width: Expected width [%d] got [%d]\n", exp, rTab.right - rTab.left );
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
for (i=0; i<8; i++)
|
|
|
|
{
|
|
|
|
INT nTabWidth = (nMinTabWidth < 0) ? TabWidthPadded(i, 2) : nMinTabWidth;
|
|
|
|
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, 0);
|
|
|
|
SendMessage(hwTab, TCM_SETPADDING, 0, MAKELPARAM(i,i));
|
|
|
|
|
|
|
|
TabCheckSetSize(hwTab, 50, 20, nTabWidth, 20, "no icon, set size");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, nTabWidth, 1, "no icon, min size");
|
|
|
|
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
|
|
|
if (i > 1 && nMinTabWidth > 0 && nMinTabWidth < DEFAULT_MIN_TAB_WIDTH)
|
|
|
|
nTabWidth += EXTRA_ICON_PADDING *(i-1);
|
|
|
|
|
|
|
|
TabCheckSetSize(hwTab, 50, 30, nTabWidth, 30, "with icon, set size > icon");
|
|
|
|
TabCheckSetSize(hwTab, 20, 20, nTabWidth, 20, "with icon, set size < icon");
|
|
|
|
TabCheckSetSize(hwTab, 0, 1, nTabWidth, 1, "with icon, min size");
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyWindow (hwTab);
|
2003-12-02 04:31:44 +01:00
|
|
|
|
2003-10-31 01:06:42 +01:00
|
|
|
ImageList_Destroy(himl);
|
2005-08-23 12:05:54 +02:00
|
|
|
DeleteObject(hFont);
|
|
|
|
}
|
|
|
|
|
2009-11-20 06:37:23 +01:00
|
|
|
static void test_curfocus(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
INT focusIndex;
|
|
|
|
HWND hTab;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
/* Testing CurFocus with largest appropriate value */
|
|
|
|
SendMessage(hTab, TCM_SETCURFOCUS, nTabs-1, 0);
|
|
|
|
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(nTabs-1, focusIndex);
|
|
|
|
|
|
|
|
/* Testing CurFocus with negative value */
|
|
|
|
SendMessage(hTab, TCM_SETCURFOCUS, -10, 0);
|
|
|
|
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(-1, focusIndex);
|
|
|
|
|
|
|
|
/* Testing CurFocus with value larger than number of tabs */
|
|
|
|
focusIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
2009-11-20 13:32:44 +01:00
|
|
|
expect(-1, focusIndex);
|
2009-11-20 06:37:23 +01:00
|
|
|
|
|
|
|
SendMessage(hTab, TCM_SETCURFOCUS, nTabs+1, 0);
|
|
|
|
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(1, focusIndex);
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_focus_seq, "Getset curFoc test sequence", FALSE);
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_cursel(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
INT selectionIndex;
|
|
|
|
INT focusIndex;
|
|
|
|
TCITEM tcItem;
|
|
|
|
HWND hTab;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
/* Testing CurSel with largest appropriate value */
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs-1, 0);
|
|
|
|
expect(0, selectionIndex);
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
|
|
|
expect(nTabs-1, selectionIndex);
|
|
|
|
|
|
|
|
/* Focus should switch with selection */
|
|
|
|
focusIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(nTabs-1, focusIndex);
|
|
|
|
|
|
|
|
/* Testing CurSel with negative value */
|
|
|
|
SendMessage(hTab, TCM_SETCURSEL, -10, 0);
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
|
|
|
expect(-1, selectionIndex);
|
|
|
|
|
|
|
|
/* Testing CurSel with value larger than number of tabs */
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, 1, 0);
|
|
|
|
expect(-1, selectionIndex);
|
|
|
|
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_SETCURSEL, nTabs+1, 0);
|
|
|
|
expect(-1, selectionIndex);
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(1, selectionIndex);
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE);
|
|
|
|
|
|
|
|
/* selected item should have TCIS_BUTTONPRESSED state
|
|
|
|
It doesn't depend on button state */
|
|
|
|
memset(&tcItem, 0, sizeof(TCITEM));
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = TCIS_BUTTONPRESSED;
|
|
|
|
selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
|
|
|
SendMessage(hTab, TCM_GETITEM, selectionIndex, (LPARAM) &tcItem);
|
|
|
|
ok (tcItem.dwState & TCIS_BUTTONPRESSED || broken(tcItem.dwState == 0), /* older comctl32 */
|
|
|
|
"Selected item should have TCIS_BUTTONPRESSED\n");
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_extendedstyle(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
DWORD prevExtendedStyle;
|
|
|
|
DWORD extendedStyle;
|
|
|
|
HWND hTab;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
/* Testing Flat Separators */
|
|
|
|
extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
|
|
|
|
prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_FLATSEPARATORS);
|
|
|
|
expect(extendedStyle, prevExtendedStyle);
|
|
|
|
|
|
|
|
extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
|
|
|
|
expect(TCS_EX_FLATSEPARATORS, extendedStyle);
|
|
|
|
|
|
|
|
/* Testing Register Drop */
|
|
|
|
prevExtendedStyle = SendMessage(hTab, TCM_SETEXTENDEDSTYLE, 0, TCS_EX_REGISTERDROP);
|
|
|
|
expect(extendedStyle, prevExtendedStyle);
|
|
|
|
|
|
|
|
extendedStyle = SendMessage(hTab, TCM_GETEXTENDEDSTYLE, 0, 0);
|
|
|
|
todo_wine{
|
|
|
|
expect(TCS_EX_REGISTERDROP, extendedStyle);
|
|
|
|
}
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_extended_style_seq, "Getset extendedStyle test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset extendedStyle test parent sequence", FALSE);
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_unicodeformat(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
INT unicodeFormat;
|
|
|
|
HWND hTab;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
|
|
|
|
todo_wine{
|
|
|
|
expect(0, unicodeFormat);
|
|
|
|
}
|
|
|
|
unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0);
|
|
|
|
expect(1, unicodeFormat);
|
|
|
|
|
|
|
|
unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, FALSE, 0);
|
|
|
|
expect(1, unicodeFormat);
|
|
|
|
unicodeFormat = SendMessage(hTab, TCM_GETUNICODEFORMAT, 0, 0);
|
|
|
|
expect(0, unicodeFormat);
|
|
|
|
|
|
|
|
unicodeFormat = SendMessage(hTab, TCM_SETUNICODEFORMAT, TRUE, 0);
|
|
|
|
expect(0, unicodeFormat);
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_unicode_format_seq, "Getset unicodeFormat test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset unicodeFormat test parent sequence", FALSE);
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_getset_item(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
TCITEM tcItem;
|
|
|
|
DWORD ret;
|
|
|
|
char szText[32] = "New Label";
|
|
|
|
HWND hTab;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
/* passing invalid index should result in initialization to zero
|
|
|
|
for members mentioned in mask requested */
|
|
|
|
|
|
|
|
/* valid range here is [0,4] */
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_PARAM;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
|
|
|
|
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_IMAGE;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
expect(0, tcItem.iImage);
|
|
|
|
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_TEXT;
|
|
|
|
tcItem.pszText = szText;
|
|
|
|
szText[0] = 'a';
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
expect('a', szText[0]);
|
|
|
|
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = 0;
|
|
|
|
tcItem.dwState = TCIS_BUTTONPRESSED;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
ok(tcItem.dwState == 0, "Expected zero dwState, got %u\n", tcItem.dwState);
|
|
|
|
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = TCIS_BUTTONPRESSED;
|
|
|
|
tcItem.dwState = TCIS_BUTTONPRESSED;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, 5, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
ok(tcItem.dwState == 0, "Expected zero dwState\n");
|
|
|
|
|
|
|
|
/* check with negative index to be sure */
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_PARAM;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, -1, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
|
|
|
|
|
|
|
|
memset(&tcItem, 0xcc, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_PARAM;
|
|
|
|
ret = SendMessage(hTab, TCM_GETITEM, -2, (LPARAM)&tcItem);
|
|
|
|
expect(FALSE, ret);
|
|
|
|
ok(tcItem.lParam == 0, "Expected zero lParam, got %lu\n", tcItem.lParam);
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
tcItem.mask = TCIF_TEXT;
|
|
|
|
tcItem.pszText = &szText[0];
|
|
|
|
tcItem.cchTextMax = sizeof(szText);
|
|
|
|
|
|
|
|
strcpy(szText, "New Label");
|
|
|
|
ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
|
|
|
|
ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
|
|
|
|
expect_str("New Label", tcItem.pszText);
|
|
|
|
|
|
|
|
ok ( SendMessage(hTab, TCM_GETITEM, 1, (LPARAM) &tcItem), "Getting item failed.\n");
|
|
|
|
expect_str("Tab 2", tcItem.pszText);
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE);
|
|
|
|
|
|
|
|
/* TCIS_BUTTONPRESSED doesn't depend on tab style */
|
|
|
|
memset(&tcItem, 0, sizeof(tcItem));
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = TCIS_BUTTONPRESSED;
|
|
|
|
tcItem.dwState = TCIS_BUTTONPRESSED;
|
|
|
|
ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
|
|
|
|
tcItem.dwState = 0;
|
|
|
|
ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
|
|
|
|
if (tcItem.dwState)
|
|
|
|
{
|
|
|
|
ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
|
|
|
|
/* next highlight item, test that dwStateMask actually masks */
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = TCIS_HIGHLIGHTED;
|
|
|
|
tcItem.dwState = TCIS_HIGHLIGHTED;
|
|
|
|
ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n");
|
|
|
|
tcItem.dwState = 0;
|
|
|
|
ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
|
|
|
|
ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n");
|
|
|
|
tcItem.mask = TCIF_STATE;
|
|
|
|
tcItem.dwStateMask = TCIS_BUTTONPRESSED;
|
|
|
|
tcItem.dwState = 0;
|
|
|
|
ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n");
|
|
|
|
ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n");
|
|
|
|
}
|
|
|
|
else win_skip( "Item state mask not supported\n" );
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_getset_tooltips(HWND parent_wnd, INT nTabs)
|
|
|
|
{
|
|
|
|
HWND hTab, toolTip;
|
|
|
|
char toolTipText[32] = "ToolTip Text Test";
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
toolTip = create_tooltip(hTab, toolTipText);
|
|
|
|
SendMessage(hTab, TCM_SETTOOLTIPS, (LPARAM) toolTip, 0);
|
|
|
|
ok (toolTip == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
|
|
|
|
|
|
|
|
SendMessage(hTab, TCM_SETTOOLTIPS, 0, 0);
|
|
|
|
ok (NULL == (HWND) SendMessage(hTab,TCM_GETTOOLTIPS,0,0), "ToolTip was set incorrectly.\n");
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, getset_tooltip_seq, "Getset tooltip test sequence", TRUE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, getset_tooltip_parent_seq, "Getset tooltip test parent sequence", TRUE);
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_misc(HWND parent_wnd, INT nTabs)
|
2007-03-11 22:21:12 +01:00
|
|
|
{
|
|
|
|
HWND hTab;
|
|
|
|
RECT rTab;
|
|
|
|
INT nTabsRetrieved;
|
|
|
|
INT rowCount;
|
2008-10-14 01:17:43 +02:00
|
|
|
INT dpi;
|
|
|
|
HDC hdc;
|
2007-03-11 22:21:12 +01:00
|
|
|
|
2007-10-30 00:39:10 +01:00
|
|
|
ok(parent_wnd != NULL, "no parent window!\n");
|
2007-03-17 23:12:13 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, nTabs);
|
2007-03-11 22:21:12 +01:00
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
if(!winetest_interactive)
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent,
|
|
|
|
"Tab sequence, after adding tab control to parent", TRUE);
|
|
|
|
else
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, add_tab_to_parent_interactive,
|
|
|
|
"Tab sequence, after adding tab control to parent", TRUE);
|
|
|
|
|
|
|
|
if(!winetest_interactive)
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq,
|
|
|
|
"Parent after sequence, adding tab control to parent", TRUE);
|
|
|
|
else
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, add_tab_control_parent_seq_interactive,
|
|
|
|
"Parent after sequence, adding tab control to parent", TRUE);
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
2008-12-02 15:14:35 +01:00
|
|
|
ok(SendMessage(hTab, TCM_SETMINTABWIDTH, 0, -1) > 0,"TCM_SETMINTABWIDTH returned < 0\n");
|
2007-03-17 23:12:13 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Set minTabWidth test parent sequence", FALSE);
|
|
|
|
|
2007-03-11 22:21:12 +01:00
|
|
|
/* Testing GetItemCount */
|
2007-03-17 23:12:13 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
2007-03-11 22:21:12 +01:00
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(nTabs, nTabsRetrieved);
|
2007-03-17 23:12:13 +01:00
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_count_seq, "Get itemCount test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset itemCount test parent sequence", FALSE);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
/* Testing GetRowCount */
|
2007-03-17 23:12:13 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
2007-03-11 22:21:12 +01:00
|
|
|
rowCount = SendMessage(hTab, TCM_GETROWCOUNT, 0, 0);
|
|
|
|
expect(1, rowCount);
|
2007-03-17 23:12:13 +01:00
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, get_row_count_seq, "Get rowCount test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get rowCount test parent sequence", FALSE);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
/* Testing GetItemRect */
|
2007-03-17 23:12:13 +01:00
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
2007-03-11 22:21:12 +01:00
|
|
|
ok(SendMessage(hTab, TCM_GETITEMRECT, 0, (LPARAM) &rTab), "GetItemRect failed.\n");
|
2008-10-14 01:17:43 +02:00
|
|
|
|
|
|
|
hdc = GetDC(hTab);
|
|
|
|
dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
|
|
|
ReleaseDC(hTab, hdc);
|
|
|
|
CheckSize(hTab, dpi, -1 , "Default Width");
|
2007-03-17 23:12:13 +01:00
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, get_item_rect_seq, "Get itemRect test sequence", FALSE);
|
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Get itemRect test parent sequence", FALSE);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
2008-11-11 05:39:29 +01:00
|
|
|
static void test_adjustrect(HWND parent_wnd)
|
|
|
|
{
|
|
|
|
HWND hTab;
|
|
|
|
INT r;
|
|
|
|
|
|
|
|
ok(parent_wnd != NULL, "no parent window!\n");
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, 0, 0);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_ADJUSTRECT, FALSE, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_ADJUSTRECT, TRUE, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
}
|
2009-11-20 06:37:23 +01:00
|
|
|
|
2007-10-30 02:32:34 +01:00
|
|
|
static void test_insert_focus(HWND parent_wnd)
|
|
|
|
{
|
|
|
|
HWND hTab;
|
|
|
|
INT nTabsRetrieved;
|
|
|
|
INT r;
|
|
|
|
TCITEM tcNewTab;
|
|
|
|
DWORD mask = TCIF_TEXT|TCIF_IMAGE;
|
|
|
|
static char tabName[] = "TAB";
|
|
|
|
tcNewTab.mask = mask;
|
|
|
|
tcNewTab.pszText = tabName;
|
|
|
|
|
|
|
|
ok(parent_wnd != NULL, "no parent window!\n");
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, mask, 0);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(0, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
|
|
|
|
tcNewTab.iImage = 1;
|
|
|
|
r = SendMessage(hTab, TCM_INSERTITEM, 1, (LPARAM) &tcNewTab);
|
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(1, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
2007-10-30 02:47:09 +01:00
|
|
|
expect(0, r);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
|
|
|
tcNewTab.iImage = 2;
|
|
|
|
r = SendMessage(hTab, TCM_INSERTITEM, 2, (LPARAM) &tcNewTab);
|
|
|
|
expect(1, r);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(2, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
2007-10-30 02:47:09 +01:00
|
|
|
expect(0, r);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0);
|
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
|
|
|
|
tcNewTab.iImage = 3;
|
|
|
|
r = SendMessage(hTab, TCM_INSERTITEM, 3, (LPARAM) &tcNewTab);
|
|
|
|
expect(2, r);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
2007-10-30 02:47:09 +01:00
|
|
|
expect(2, r);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
2009-08-05 14:00:03 +02:00
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, insert_focus_seq, "insert_focus test sequence", FALSE);
|
2009-11-20 13:32:44 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "insert_focus parent test sequence", TRUE);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
2007-10-30 02:44:48 +01:00
|
|
|
static void test_delete_focus(HWND parent_wnd)
|
|
|
|
{
|
|
|
|
HWND hTab;
|
|
|
|
INT nTabsRetrieved;
|
|
|
|
INT r;
|
|
|
|
|
|
|
|
ok(parent_wnd != NULL, "no parent window!\n");
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, 2);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(2, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
2007-10-30 02:47:09 +01:00
|
|
|
expect(0, r);
|
2007-10-30 02:44:48 +01:00
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_DELETEITEM, 1, 0);
|
|
|
|
expect(1, r);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(1, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
2007-10-30 02:47:09 +01:00
|
|
|
expect(0, r);
|
2007-10-30 02:44:48 +01:00
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_SETCURFOCUS, -1, 0);
|
|
|
|
expect(0, r);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_DELETEITEM, 0, 0);
|
|
|
|
expect(1, r);
|
|
|
|
|
|
|
|
nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);
|
|
|
|
expect(0, nTabsRetrieved);
|
|
|
|
|
|
|
|
r = SendMessage(hTab, TCM_GETCURFOCUS, 0, 0);
|
|
|
|
expect(-1, r);
|
|
|
|
|
|
|
|
ok_sequence(sequences, TAB_SEQ_INDEX, delete_focus_seq, "delete_focus test sequence", FALSE);
|
2009-11-20 13:32:44 +01:00
|
|
|
ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "delete_focus parent test sequence", TRUE);
|
2007-10-30 02:44:48 +01:00
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
2009-03-23 20:45:44 +01:00
|
|
|
static void test_removeimage(HWND parent_wnd)
|
|
|
|
{
|
|
|
|
static const BYTE bits[32];
|
|
|
|
HWND hwTab;
|
|
|
|
INT i;
|
|
|
|
TCITEM item;
|
|
|
|
HICON hicon;
|
|
|
|
HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR, 3, 4);
|
|
|
|
|
|
|
|
hicon = CreateIcon(NULL, 16, 16, 1, 1, bits, bits);
|
|
|
|
ImageList_AddIcon(himl, hicon);
|
|
|
|
ImageList_AddIcon(himl, hicon);
|
|
|
|
ImageList_AddIcon(himl, hicon);
|
|
|
|
|
|
|
|
hwTab = create_tabcontrol(TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE);
|
|
|
|
SendMessage(hwTab, TCM_SETIMAGELIST, 0, (LPARAM)himl);
|
|
|
|
|
|
|
|
memset(&item, 0, sizeof(TCITEM));
|
|
|
|
item.mask = TCIF_IMAGE;
|
|
|
|
|
|
|
|
for(i = 0; i < 3; i++) {
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, i, (LPARAM)&item);
|
|
|
|
expect(i, item.iImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove image middle image */
|
|
|
|
SendMessage(hwTab, TCM_REMOVEIMAGE, 1, 0);
|
|
|
|
expect(2, ImageList_GetImageCount(himl));
|
|
|
|
item.iImage = -1;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 0, (LPARAM)&item);
|
|
|
|
expect(0, item.iImage);
|
|
|
|
item.iImage = 0;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 1, (LPARAM)&item);
|
|
|
|
expect(-1, item.iImage);
|
|
|
|
item.iImage = 0;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 2, (LPARAM)&item);
|
|
|
|
expect(1, item.iImage);
|
|
|
|
/* remove first image */
|
|
|
|
SendMessage(hwTab, TCM_REMOVEIMAGE, 0, 0);
|
|
|
|
expect(1, ImageList_GetImageCount(himl));
|
|
|
|
item.iImage = 0;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 0, (LPARAM)&item);
|
|
|
|
expect(-1, item.iImage);
|
|
|
|
item.iImage = 0;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 1, (LPARAM)&item);
|
|
|
|
expect(-1, item.iImage);
|
|
|
|
item.iImage = -1;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, 2, (LPARAM)&item);
|
|
|
|
expect(0, item.iImage);
|
|
|
|
/* remove the last one */
|
|
|
|
SendMessage(hwTab, TCM_REMOVEIMAGE, 0, 0);
|
|
|
|
expect(0, ImageList_GetImageCount(himl));
|
|
|
|
for(i = 0; i < 3; i++) {
|
|
|
|
item.iImage = 0;
|
|
|
|
SendMessage(hwTab, TCM_GETITEM, i, (LPARAM)&item);
|
|
|
|
expect(-1, item.iImage);
|
|
|
|
}
|
|
|
|
|
|
|
|
DestroyWindow(hwTab);
|
|
|
|
ImageList_Destroy(himl);
|
|
|
|
DestroyIcon(hicon);
|
|
|
|
}
|
|
|
|
|
2009-11-20 06:50:24 +01:00
|
|
|
static void test_delete_selection(HWND parent_wnd)
|
|
|
|
{
|
|
|
|
HWND hTab;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, TCIF_TEXT|TCIF_IMAGE, 4);
|
|
|
|
ok(hTab != NULL, "Failed to create tab control\n");
|
|
|
|
|
|
|
|
ret = SendMessage(hTab, TCM_SETCURSEL, 3, 0);
|
|
|
|
expect(0, ret);
|
|
|
|
ret = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
|
|
|
expect(3, ret);
|
|
|
|
/* delete selected item - selection goes to -1 */
|
|
|
|
ret = SendMessage(hTab, TCM_DELETEITEM, 3, 0);
|
|
|
|
expect(TRUE, ret);
|
|
|
|
|
|
|
|
ret = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
|
|
|
|
expect(-1, ret);
|
|
|
|
|
|
|
|
DestroyWindow(hTab);
|
|
|
|
}
|
|
|
|
|
2005-08-23 12:05:54 +02:00
|
|
|
START_TEST(tab)
|
|
|
|
{
|
2007-10-30 00:39:10 +01:00
|
|
|
HWND parent_wnd;
|
2005-08-23 12:05:54 +02:00
|
|
|
LOGFONTA logfont;
|
|
|
|
|
|
|
|
lstrcpyA(logfont.lfFaceName, "Arial");
|
|
|
|
memset(&logfont, 0, sizeof(logfont));
|
|
|
|
logfont.lfHeight = -12;
|
|
|
|
logfont.lfWeight = FW_NORMAL;
|
|
|
|
logfont.lfCharSet = ANSI_CHARSET;
|
|
|
|
hFont = CreateFontIndirectA(&logfont);
|
|
|
|
|
|
|
|
InitCommonControls();
|
|
|
|
|
|
|
|
trace ("Testing with default MinWidth\n");
|
|
|
|
test_tab(-1);
|
|
|
|
trace ("Testing with MinWidth set to -3\n");
|
|
|
|
test_tab(-3);
|
|
|
|
trace ("Testing with MinWidth set to 24\n");
|
|
|
|
test_tab(24);
|
|
|
|
trace ("Testing with MinWidth set to 54\n");
|
|
|
|
test_tab(54);
|
|
|
|
trace ("Testing with MinWidth set to 94\n");
|
|
|
|
test_tab(94);
|
2007-03-11 22:21:12 +01:00
|
|
|
|
2007-03-17 23:12:13 +01:00
|
|
|
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
|
|
|
|
2007-10-30 00:39:10 +01:00
|
|
|
parent_wnd = createParentWindow();
|
|
|
|
ok(parent_wnd != NULL, "Failed to create parent window!\n");
|
|
|
|
|
2009-11-20 06:37:23 +01:00
|
|
|
test_curfocus(parent_wnd, 5);
|
|
|
|
test_cursel(parent_wnd, 5);
|
|
|
|
test_extendedstyle(parent_wnd, 5);
|
|
|
|
test_unicodeformat(parent_wnd, 5);
|
|
|
|
test_getset_item(parent_wnd, 5);
|
|
|
|
test_getset_tooltips(parent_wnd, 5);
|
|
|
|
test_misc(parent_wnd, 5);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
2008-11-11 05:39:29 +01:00
|
|
|
test_adjustrect(parent_wnd);
|
|
|
|
|
2007-10-30 02:32:34 +01:00
|
|
|
test_insert_focus(parent_wnd);
|
2007-10-30 02:44:48 +01:00
|
|
|
test_delete_focus(parent_wnd);
|
2009-11-20 06:50:24 +01:00
|
|
|
test_delete_selection(parent_wnd);
|
2009-03-23 20:45:44 +01:00
|
|
|
test_removeimage(parent_wnd);
|
2007-10-30 02:32:34 +01:00
|
|
|
|
2007-10-30 00:39:10 +01:00
|
|
|
DestroyWindow(parent_wnd);
|
2003-10-31 01:06:42 +01:00
|
|
|
}
|