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
8677069c
Commit
8677069c
authored
Mar 09, 2007
by
Felix Nawothnig
Committed by
Alexandre Julliard
Mar 09, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Add a failing custom draw related test.
parent
f0189b87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
9 deletions
+90
-9
listview.c
dlls/comctl32/tests/listview.c
+90
-9
No files found.
dlls/comctl32/tests/listview.c
View file @
8677069c
...
...
@@ -32,6 +32,8 @@
#define LISTVIEW_ID 0
#define HEADER_ID 1
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
HWND
hwndparent
;
static
struct
msg_sequence
*
sequences
[
NUM_MSG_SEQUENCES
];
...
...
@@ -416,14 +418,43 @@ static void test_checkboxes(void)
DestroyWindow
(
hwnd
);
}
static
void
insert_column
(
HWND
hwnd
,
int
idx
)
{
LVCOLUMN
column
;
DWORD
rc
;
memset
(
&
column
,
0xaa
,
sizeof
(
column
));
column
.
mask
=
LVCF_SUBITEM
;
column
.
iSubItem
=
idx
;
rc
=
ListView_InsertColumn
(
hwnd
,
idx
,
&
column
);
expect
(
idx
,
rc
);
}
static
void
insert_item
(
HWND
hwnd
,
int
idx
)
{
static
CHAR
text
[]
=
"foo"
;
LVITEMA
item
;
DWORD
rc
;
memset
(
&
item
,
0xaa
,
sizeof
(
item
));
item
.
mask
=
LVIF_TEXT
;
item
.
iItem
=
idx
;
item
.
iSubItem
=
0
;
item
.
pszText
=
text
;
rc
=
ListView_InsertItemA
(
hwnd
,
&
item
);
expect
(
idx
,
rc
);
}
static
void
test_items
(
void
)
{
const
LPARAM
lparamTest
=
0x42
;
HWND
hwnd
;
LVITEMA
item
;
LVCOLUMNA
column
;
DWORD
r
;
static
CHAR
text
[]
=
"Text"
;
static
CHAR
text
[]
=
"Text"
;
hwnd
=
CreateWindowEx
(
0
,
"SysListView32"
,
"foo"
,
LVS_REPORT
,
10
,
10
,
100
,
200
,
hwndparent
,
NULL
,
NULL
,
NULL
);
...
...
@@ -434,13 +465,8 @@ static void test_items(void)
*/
/* Set up two columns */
column
.
mask
=
LVCF_SUBITEM
;
column
.
iSubItem
=
0
;
r
=
SendMessage
(
hwnd
,
LVM_INSERTCOLUMNA
,
0
,
(
LPARAM
)
&
column
);
ok
(
r
==
0
,
"ret %d
\n
"
,
r
);
column
.
iSubItem
=
1
;
r
=
SendMessage
(
hwnd
,
LVM_INSERTCOLUMNA
,
1
,
(
LPARAM
)
&
column
);
ok
(
r
==
1
,
"ret %d
\n
"
,
r
);
insert_column
(
hwnd
,
0
);
insert_column
(
hwnd
,
1
);
/* Insert an item with just a param */
memset
(
&
item
,
0xaa
,
sizeof
(
item
));
...
...
@@ -580,6 +606,60 @@ static void test_redraw(void)
DestroyWindow
(
hwnd
);
}
static
LRESULT
WINAPI
cd_wndproc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
)
{
COLORREF
clr
,
c0ffee
=
RGB
(
0xc0
,
0xff
,
0xee
);
if
(
msg
==
WM_NOTIFY
)
{
NMHDR
*
nmhdr
=
(
PVOID
)
lp
;
if
(
nmhdr
->
code
==
NM_CUSTOMDRAW
)
{
NMLVCUSTOMDRAW
*
nmlvcd
=
(
PVOID
)
nmhdr
;
trace
(
"NMCUSTOMDRAW (0x%.8x)
\n
"
,
nmlvcd
->
nmcd
.
dwDrawStage
);
switch
(
nmlvcd
->
nmcd
.
dwDrawStage
)
{
case
CDDS_PREPAINT
:
SetBkColor
(
nmlvcd
->
nmcd
.
hdc
,
c0ffee
);
return
CDRF_NOTIFYITEMDRAW
;
case
CDDS_ITEMPREPAINT
:
nmlvcd
->
clrTextBk
=
CLR_DEFAULT
;
return
CDRF_NOTIFYSUBITEMDRAW
;
case
CDDS_ITEMPREPAINT
|
CDDS_SUBITEM
:
clr
=
GetBkColor
(
nmlvcd
->
nmcd
.
hdc
);
todo_wine
ok
(
clr
==
c0ffee
,
"clr=%.8x
\n
"
,
clr
);
return
CDRF_NOTIFYPOSTPAINT
;
case
CDDS_ITEMPOSTPAINT
|
CDDS_SUBITEM
:
clr
=
GetBkColor
(
nmlvcd
->
nmcd
.
hdc
);
todo_wine
ok
(
clr
==
c0ffee
,
"clr=%.8x
\n
"
,
clr
);
return
CDRF_DODEFAULT
;
}
return
CDRF_DODEFAULT
;
}
}
return
DefWindowProcA
(
hwnd
,
msg
,
wp
,
lp
);
}
static
void
test_customdraw
(
void
)
{
HWND
hwnd
;
WNDPROC
oldwndproc
;
hwnd
=
create_listview_control
();
insert_column
(
hwnd
,
0
);
insert_column
(
hwnd
,
1
);
insert_item
(
hwnd
,
0
);
oldwndproc
=
(
WNDPROC
)
SetWindowLongPtr
(
hwndparent
,
GWL_WNDPROC
,
(
INT_PTR
)
cd_wndproc
);
InvalidateRect
(
hwnd
,
NULL
,
TRUE
);
UpdateWindow
(
hwnd
);
SetWindowLongPtr
(
hwndparent
,
GWL_WNDPROC
,
(
INT_PTR
)
oldwndproc
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
listview
)
{
INITCOMMONCONTROLSEX
icc
;
...
...
@@ -597,4 +677,5 @@ START_TEST(listview)
test_items
();
test_create
();
test_redraw
();
test_customdraw
();
}
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