Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
97314eee
Commit
97314eee
authored
May 12, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Make functions from test macros.
parent
7df286c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
52 deletions
+67
-52
tab.c
dlls/comctl32/tests/tab.c
+67
-52
No files found.
dlls/comctl32/tests/tab.c
View file @
97314eee
...
...
@@ -41,25 +41,40 @@
#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))\
ok (width == rTab.right - rTab.left, "%s: Expected width [%d] got [%d]\n",\
msg, (int)width, rTab.right - rTab.left);\
else if ((height >= 0) && (width < 0))\
ok (height == rTab.bottom - rTab.top, "%s: Expected height [%d] got [%d]\n",\
msg, (int)height, rTab.bottom - rTab.top);\
else\
ok ((width == rTab.right - rTab.left) &&\
(height == rTab.bottom - rTab.top ),\
"%s: Expected [%d,%d] got [%d,%d]\n", msg, (int)width, (int)height,\
rTab.right - rTab.left, rTab.bottom - rTab.top);
static
void
CheckSize
(
HWND
hwnd
,
INT
width
,
INT
height
,
const
char
*
msg
,
int
line
)
{
RECT
r
;
SendMessage
(
hwnd
,
TCM_GETITEMRECT
,
0
,
(
LPARAM
)
&
r
);
if
(
width
>=
0
&&
height
<
0
)
{
ok_
(
__FILE__
,
line
)
(
width
==
r
.
right
-
r
.
left
,
"%s: Expected width [%d] got [%d]
\n
"
,
\
msg
,
width
,
r
.
right
-
r
.
left
);
}
else
if
(
height
>=
0
&&
width
<
0
)
{
ok_
(
__FILE__
,
line
)
(
height
==
r
.
bottom
-
r
.
top
,
"%s: Expected height [%d] got [%d]
\n
"
,
\
msg
,
height
,
r
.
bottom
-
r
.
top
);
}
else
ok_
(
__FILE__
,
line
)
((
width
==
r
.
right
-
r
.
left
)
&&
(
height
==
r
.
bottom
-
r
.
top
),
"%s: Expected [%d,%d] got [%d,%d]
\n
"
,
msg
,
width
,
height
,
r
.
right
-
r
.
left
,
r
.
bottom
-
r
.
top
);
}
#define CHECKSIZE(hwnd,width,height,msg) CheckSize(hwnd,width,height,msg,__LINE__)
static
void
TabCheckSetSize
(
HWND
hwnd
,
INT
set_width
,
INT
set_height
,
INT
exp_width
,
INT
exp_height
,
const
char
*
msg
,
int
line
)
{
SendMessage
(
hwnd
,
TCM_SETITEMSIZE
,
0
,
(
LPARAM
)
MAKELPARAM
((
set_width
>=
0
)
?
set_width
:
0
,
(
set_height
>=
0
)
?
set_height
:
0
));
if
(
winetest_interactive
)
RedrawWindow
(
hwnd
,
NULL
,
0
,
RDW_UPDATENOW
);
CheckSize
(
hwnd
,
exp_width
,
exp_height
,
msg
,
line
);
}
#define TABCHECKSETSIZE(hwnd,set_width,set_height,exp_width,exp_height,msg) \
TabCheckSetSize(hwnd,set_width,set_height,exp_width,exp_height,msg,__LINE__)
static
HFONT
hFont
;
static
DRAWITEMSTRUCT
g_drawitem
;
...
...
@@ -523,16 +538,16 @@ static void test_tab(INT nMinTabWidth)
ReleaseDC
(
hwTab
,
hdc
);
trace
(
" TCS_FIXEDWIDTH tabs no icon...
\n
"
);
C
heckSize
(
hwTab
,
dpi
,
-
1
,
"default width"
);
T
abCheckSetSize
(
hwTab
,
50
,
20
,
50
,
20
,
"set size"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
0
,
1
,
"min size"
);
C
HECKSIZE
(
hwTab
,
dpi
,
-
1
,
"default width"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
20
,
50
,
20
,
"set size"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
0
,
1
,
"min size"
);
SendMessage
(
hwTab
,
TCM_SETIMAGELIST
,
0
,
(
LPARAM
)
himl
);
trace
(
" TCS_FIXEDWIDTH tabs with icon...
\n
"
);
T
abCheckSetSize
(
hwTab
,
50
,
30
,
50
,
30
,
"set size > icon"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
25
,
20
,
"set size < icon"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
25
,
1
,
"min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
30
,
50
,
30
,
"set size > icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
25
,
20
,
"set size < icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
25
,
1
,
"min size"
);
DestroyWindow
(
hwTab
);
...
...
@@ -543,19 +558,19 @@ static void test_tab(INT nMinTabWidth)
dpi
=
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
hwTab
,
hdc
);
trace
(
" TCS_FIXEDWIDTH buttons no icon...
\n
"
);
C
heckSize
(
hwTab
,
dpi
,
-
1
,
"default width"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
20
,
20
,
"set size 1"
);
T
abCheckSetSize
(
hwTab
,
10
,
50
,
10
,
50
,
"set size 2"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
0
,
1
,
"min size"
);
C
HECKSIZE
(
hwTab
,
dpi
,
-
1
,
"default width"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
20
,
20
,
"set size 1"
);
T
ABCHECKSETSIZE
(
hwTab
,
10
,
50
,
10
,
50
,
"set size 2"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
0
,
1
,
"min size"
);
SendMessage
(
hwTab
,
TCM_SETIMAGELIST
,
0
,
(
LPARAM
)
himl
);
trace
(
" TCS_FIXEDWIDTH buttons with icon...
\n
"
);
T
abCheckSetSize
(
hwTab
,
50
,
30
,
50
,
30
,
"set size > icon"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
25
,
20
,
"set size < icon"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
25
,
1
,
"min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
30
,
50
,
30
,
"set size > icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
25
,
20
,
"set size < icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
25
,
1
,
"min size"
);
SendMessage
(
hwTab
,
TCM_SETPADDING
,
0
,
MAKELPARAM
(
4
,
4
));
T
abCheckSetSize
(
hwTab
,
0
,
1
,
25
,
1
,
"set padding, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
25
,
1
,
"set padding, min size"
);
DestroyWindow
(
hwTab
);
...
...
@@ -566,19 +581,19 @@ static void test_tab(INT nMinTabWidth)
dpi
=
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
hwTab
,
hdc
);
trace
(
" TCS_FIXEDWIDTH | TCS_BOTTOM tabs...
\n
"
);
C
heckSize
(
hwTab
,
dpi
,
-
1
,
"no icon, default width"
);
C
HECKSIZE
(
hwTab
,
dpi
,
-
1
,
"no icon, default width"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
20
,
20
,
"no icon, set size 1"
);
T
abCheckSetSize
(
hwTab
,
10
,
50
,
10
,
50
,
"no icon, set size 2"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
0
,
1
,
"no icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
20
,
20
,
"no icon, set size 1"
);
T
ABCHECKSETSIZE
(
hwTab
,
10
,
50
,
10
,
50
,
"no icon, set size 2"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
0
,
1
,
"no icon, min size"
);
SendMessage
(
hwTab
,
TCM_SETIMAGELIST
,
0
,
(
LPARAM
)
himl
);
T
abCheckSetSize
(
hwTab
,
50
,
30
,
50
,
30
,
"with icon, set size > icon"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
25
,
20
,
"with icon, set size < icon"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
25
,
1
,
"with icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
30
,
50
,
30
,
"with icon, set size > icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
25
,
20
,
"with icon, set size < icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
25
,
1
,
"with icon, min size"
);
SendMessage
(
hwTab
,
TCM_SETPADDING
,
0
,
MAKELPARAM
(
4
,
4
));
T
abCheckSetSize
(
hwTab
,
0
,
1
,
25
,
1
,
"set padding, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
25
,
1
,
"set padding, min size"
);
DestroyWindow
(
hwTab
);
...
...
@@ -598,15 +613,15 @@ static void test_tab(INT nMinTabWidth)
SendMessage
(
hwTab
,
TCM_SETIMAGELIST
,
0
,
0
);
SendMessage
(
hwTab
,
TCM_SETPADDING
,
0
,
MAKELPARAM
(
i
,
i
));
T
abCheckSetSize
(
hwTab
,
50
,
20
,
max
(
size
.
cx
+
i
*
2
,
nTabWidth
),
20
,
"no icon, set size"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
max
(
size
.
cx
+
i
*
2
,
nTabWidth
),
1
,
"no icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
20
,
max
(
size
.
cx
+
i
*
2
,
nTabWidth
),
20
,
"no icon, set size"
);
T
ABCHECKSETSIZE
(
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
;
T
abCheckSetSize
(
hwTab
,
50
,
30
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
30
,
"with icon, set size > icon"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
20
,
"with icon, set size < icon"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
1
,
"with icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
30
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
30
,
"with icon, set size > icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
20
,
"with icon, set size < icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
max
(
size
.
cx
+
21
+
i
*
3
,
nTabWidth
),
1
,
"with icon, min size"
);
}
DestroyWindow
(
hwTab
);
...
...
@@ -626,16 +641,16 @@ static void test_tab(INT nMinTabWidth)
SendMessage
(
hwTab
,
TCM_SETIMAGELIST
,
0
,
0
);
SendMessage
(
hwTab
,
TCM_SETPADDING
,
0
,
MAKELPARAM
(
i
,
i
));
T
abCheckSetSize
(
hwTab
,
50
,
20
,
nTabWidth
,
20
,
"no icon, set size"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
nTabWidth
,
1
,
"no icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
20
,
nTabWidth
,
20
,
"no icon, set size"
);
T
ABCHECKSETSIZE
(
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
);
T
abCheckSetSize
(
hwTab
,
50
,
30
,
nTabWidth
,
30
,
"with icon, set size > icon"
);
T
abCheckSetSize
(
hwTab
,
20
,
20
,
nTabWidth
,
20
,
"with icon, set size < icon"
);
T
abCheckSetSize
(
hwTab
,
0
,
1
,
nTabWidth
,
1
,
"with icon, min size"
);
T
ABCHECKSETSIZE
(
hwTab
,
50
,
30
,
nTabWidth
,
30
,
"with icon, set size > icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
20
,
20
,
nTabWidth
,
20
,
"with icon, set size < icon"
);
T
ABCHECKSETSIZE
(
hwTab
,
0
,
1
,
nTabWidth
,
1
,
"with icon, min size"
);
}
DestroyWindow
(
hwTab
);
...
...
@@ -1034,7 +1049,7 @@ static void test_misc(void)
hdc
=
GetDC
(
hTab
);
dpi
=
GetDeviceCaps
(
hdc
,
LOGPIXELSX
);
ReleaseDC
(
hTab
,
hdc
);
C
heckSize
(
hTab
,
dpi
,
-
1
,
"Default Width"
);
C
HECKSIZE
(
hTab
,
dpi
,
-
1
,
"Default Width"
);
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment