Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Torge Matthies
wine
Commits
0adb4ef4
Commit
0adb4ef4
authored
15 years ago
by
Nikolay Sivov
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
comctl32/treeview: Make tests not depend from each other, replace some magics with macros.
parent
b32bccb4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/comctl32/tests/treeview.c
+178
-163
178 additions, 163 deletions
dlls/comctl32/tests/treeview.c
with
178 additions
and
163 deletions
dlls/comctl32/tests/treeview.c
+
178
−
163
View file @
0adb4ef4
...
@@ -37,104 +37,96 @@ const char *TEST_CALLBACK_TEXT = "callback_text";
...
@@ -37,104 +37,96 @@ const char *TEST_CALLBACK_TEXT = "callback_text";
#define NUM_MSG_SEQUENCES 1
#define NUM_MSG_SEQUENCES 1
#define TREEVIEW_SEQ_INDEX 0
#define TREEVIEW_SEQ_INDEX 0
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
static
struct
msg_sequence
*
MsgSequences
[
NUM_MSG_SEQUENCES
];
static
struct
msg_sequence
*
MsgSequences
[
NUM_MSG_SEQUENCES
];
static
const
struct
message
FillRootSeq
[]
=
{
static
const
struct
message
FillRootSeq
[]
=
{
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_GETITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
0
}
{
0
}
};
};
static
const
struct
message
DoTest1S
eq
[]
=
{
static
const
struct
message
rootnone_select_s
eq
[]
=
{
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
0
}
{
0
}
};
};
static
const
struct
message
DoTest2S
eq
[]
=
{
static
const
struct
message
rootchild_select_s
eq
[]
=
{
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x0000000
9
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
{
0
}
{
0
}
};
};
static
const
struct
message
DoTest3S
eq
[]
=
{
static
const
struct
message
getitemtext_s
eq
[]
=
{
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_GETITEM
,
sent
},
{
TVM_GETITEM
,
sent
},
{
TVM_DELETEITEM
,
sent
},
{
TVM_DELETEITEM
,
sent
},
{
0
}
{
0
}
};
};
static
const
struct
message
DoF
ocus
TestS
eq
[]
=
{
static
const
struct
message
f
ocus
_s
eq
[]
=
{
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_INSERTITEM
,
sent
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
9
},
/* The following end up out of order in wine */
{
WM_WINDOWPOSCHANGING
,
sent
|
defwinproc
},
{
WM_WINDOWPOSCHANGING
,
sent
|
defwinproc
},
{
WM_NCCALCSIZE
,
sent
|
wparam
|
defwinproc
,
0x00000001
},
{
WM_NCCALCSIZE
,
sent
|
wparam
|
defwinproc
,
TRUE
},
{
WM_WINDOWPOSCHANGED
,
sent
|
defwinproc
},
{
WM_WINDOWPOSCHANGED
,
sent
|
defwinproc
},
{
WM_SIZE
,
sent
|
defwinproc
},
{
WM_SIZE
,
sent
|
defwinproc
},
{
WM_WINDOWPOSCHANGING
,
sent
},
{
WM_NCCALCSIZE
,
sent
|
wparam
,
0x00000001
},
{
WM_WINDOWPOSCHANGED
,
sent
},
{
WM_SIZE
,
sent
|
defwinproc
},
{
WM_WINDOWPOSCHANGING
,
sent
|
defwinproc
|
optional
},
{
WM_NCCALCSIZE
,
sent
|
wparam
|
defwinproc
|
optional
,
0x00000001
},
{
WM_WINDOWPOSCHANGED
,
sent
|
defwinproc
|
optional
},
{
WM_SIZE
,
sent
|
defwinproc
|
optional
},
{
TVM_SELECTITEM
,
sent
|
wparam
,
0x00000009
},
/* The following end up out of order in wine */
{
WM_PAINT
,
sent
|
defwinproc
},
{
WM_PAINT
,
sent
|
defwinproc
},
{
WM_NCPAINT
,
sent
|
wparam
|
defwinproc
,
0x0000000
1
},
{
WM_NCPAINT
,
sent
|
wparam
|
defwinproc
,
1
},
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
TVM_EDITLABEL
,
sent
},
{
TVM_EDITLABEL
,
sent
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
0x04000000
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
MAKEWPARAM
(
0
,
EN_UPDATE
)
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
0x03000000
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
MAKEWPARAM
(
0
,
EN_CHANGE
)
},
{
WM_PARENTNOTIFY
,
sent
|
wparam
|
defwinproc
,
0x00000001
},
{
WM_PARENTNOTIFY
,
sent
|
wparam
|
defwinproc
,
MAKEWPARAM
(
WM_CREATE
,
0
)
},
{
WM_KILLFOCUS
,
sent
|
defwinproc
},
{
WM_KILLFOCUS
,
sent
|
defwinproc
},
{
WM_PAINT
,
sent
|
defwinproc
},
{
WM_PAINT
,
sent
|
defwinproc
},
{
WM_IME_SETCONTEXT
,
sent
|
defwinproc
|
optional
},
{
WM_IME_SETCONTEXT
,
sent
|
defwinproc
|
optional
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
0x01000000
},
{
WM_COMMAND
,
sent
|
wparam
|
defwinproc
,
MAKEWPARAM
(
0
,
EN_SETFOCUS
)
},
{
WM_ERASEBKGND
,
sent
|
defwinproc
},
{
WM_CTLCOLOREDIT
,
sent
|
defwinproc
|
optional
},
{
WM_CTLCOLOREDIT
,
sent
|
defwinproc
|
optional
},
{
WM_CTLCOLOREDIT
,
sent
|
defwinproc
|
optional
},
{
WM_CTLCOLOREDIT
,
sent
|
defwinproc
|
optional
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetBkColorSeq
[]
=
{
static
const
struct
message
TestGetSetBkColorSeq
[]
=
{
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0x0000000
0
,
0x00ffffff
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0x00ffffff
},
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0x0000000
0
,
-
1
},
{
TVM_SETBKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
-
1
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetImageListSeq
[]
=
{
static
const
struct
message
TestGetSetImageListSeq
[]
=
{
{
TVM_SETIMAGELIST
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETIMAGELIST
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETIMAGELIST
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETIMAGELIST
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetIndentSeq
[]
=
{
static
const
struct
message
TestGetSetIndentSeq
[]
=
{
{
TVM_SETINDENT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETINDENT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETINDENT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETINDENT
,
sent
|
wparam
|
lparam
,
0
,
0
},
/* The actual amount to indent is dependent on the system for this message */
/* The actual amount to indent is dependent on the system for this message */
{
TVM_SETINDENT
,
sent
},
{
TVM_SETINDENT
,
sent
},
{
TVM_GETINDENT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETINDENT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetInsertMarkColorSeq
[]
=
{
static
const
struct
message
TestGetSetInsertMarkColorSeq
[]
=
{
{
TVM_SETINSERTMARKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETINSERTMARKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETINSERTMARKCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETINSERTMARKCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
0
}
{
0
}
};
};
...
@@ -147,50 +139,45 @@ static const struct message TestGetSetItemSeq[] = {
...
@@ -147,50 +139,45 @@ static const struct message TestGetSetItemSeq[] = {
};
};
static
const
struct
message
TestGetSetItemHeightSeq
[]
=
{
static
const
struct
message
TestGetSetItemHeightSeq
[]
=
{
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0x00000000
,
0x00000000
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
-
1
,
0x00000000
},
{
TVM_SETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
-
1
,
0
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0x00000000
,
0x00000000
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETITEMHEIGHT
,
sent
|
lparam
,
0xcccccccc
,
0x00000000
},
{
TVM_SETITEMHEIGHT
,
sent
|
lparam
,
0xcccccccc
,
0
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
|
optional
,
0x00000000
,
0x00000000
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
|
optional
,
0
,
0
},
{
TVM_SETITEMHEIGHT
,
sent
|
wparam
|
lparam
|
optional
,
0x00000009
,
0x00000000
},
{
TVM_SETITEMHEIGHT
,
sent
|
wparam
|
lparam
|
optional
,
9
,
0
},
{
WM_WINDOWPOSCHANGING
,
sent
|
defwinproc
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
WM_NCCALCSIZE
,
sent
|
wparam
|
defwinproc
,
0x00000001
},
{
WM_WINDOWPOSCHANGED
,
sent
|
defwinproc
},
{
WM_SIZE
,
sent
|
defwinproc
},
{
TVM_GETITEMHEIGHT
,
sent
|
wparam
|
lparam
,
0x00000000
,
0x00000000
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetScrollTimeSeq
[]
=
{
static
const
struct
message
TestGetSetScrollTimeSeq
[]
=
{
{
TVM_SETSCROLLTIME
,
sent
|
wparam
|
lparam
,
0x00000014
,
0x0000000
0
},
{
TVM_SETSCROLLTIME
,
sent
|
wparam
|
lparam
,
20
,
0
},
{
TVM_GETSCROLLTIME
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETSCROLLTIME
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetTextColorSeq
[]
=
{
static
const
struct
message
TestGetSetTextColorSeq
[]
=
{
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0x0000000
0
,
0x00ffffff
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0x00ffffff
},
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0x0000000
0
,
-
1
},
{
TVM_SETTEXTCOLOR
,
sent
|
wparam
|
lparam
,
0
,
-
1
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetToolTipsSeq
[]
=
{
static
const
struct
message
TestGetSetToolTipsSeq
[]
=
{
{
WM_COMMAND
,
sent
|
wparam
,
0x02000000
},
{
WM_KILLFOCUS
,
sent
},
{
WM_PARENTNOTIFY
,
sent
|
wparam
|
defwinproc
,
0x00020002
},
{
TVM_SETTOOLTIPS
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETTOOLTIPS
,
sent
|
wparam
|
lparam
,
0x00000000
,
0x00000000
},
{
TVM_GETTOOLTIPS
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETTOOLTIPS
,
sent
|
wparam
|
lparam
,
0x00000000
,
0x00000000
},
{
0
}
{
0
}
};
};
static
const
struct
message
TestGetSetUnicodeFormatSeq
[]
=
{
static
const
struct
message
TestGetSetUnicodeFormatSeq
[]
=
{
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0x00000001
,
0x0000000
0
},
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
TRUE
,
0
},
{
TVM_GETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_GETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_GETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
x00000000
,
0x0000000
0
},
{
TVM_SETUNICODEFORMAT
,
sent
|
wparam
|
lparam
,
0
,
0
},
{
0
}
{
0
}
};
};
...
@@ -231,45 +218,95 @@ static void IdentifyItem(HTREEITEM hItem)
...
@@ -231,45 +218,95 @@ static void IdentifyItem(HTREEITEM hItem)
AddItem
(
'?'
);
AddItem
(
'?'
);
}
}
static
void
FillRoot
(
void
)
/* This function hooks in and records all messages to the treeview control */
static
LRESULT
WINAPI
TreeviewWndProc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
LONG
defwndproc_counter
=
0
;
LRESULT
ret
;
struct
message
msg
;
WNDPROC
lpOldProc
=
(
WNDPROC
)
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
msg
.
message
=
message
;
msg
.
flags
=
sent
|
wparam
|
lparam
;
if
(
defwndproc_counter
)
msg
.
flags
|=
defwinproc
;
msg
.
wParam
=
wParam
;
msg
.
lParam
=
lParam
;
add_message
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
&
msg
);
defwndproc_counter
++
;
ret
=
CallWindowProcA
(
lpOldProc
,
hwnd
,
message
,
wParam
,
lParam
);
defwndproc_counter
--
;
return
ret
;
}
static
HWND
create_treeview_control
(
void
)
{
WNDPROC
pOldWndProc
;
HWND
hTree
;
hTree
=
CreateWindowExA
(
WS_EX_CLIENTEDGE
,
WC_TREEVIEWA
,
NULL
,
WS_CHILD
|
WS_VISIBLE
|
TVS_LINESATROOT
|
TVS_HASLINES
|
TVS_HASBUTTONS
|
TVS_EDITLABELS
,
0
,
0
,
120
,
100
,
hMainWnd
,
(
HMENU
)
100
,
GetModuleHandleA
(
0
),
0
);
SetFocus
(
hTree
);
/* Record the old WNDPROC so we can call it after recording the messages */
pOldWndProc
=
(
WNDPROC
)
SetWindowLongPtrA
(
hTree
,
GWLP_WNDPROC
,
(
LONG_PTR
)
TreeviewWndProc
);
SetWindowLongPtrA
(
hTree
,
GWLP_USERDATA
,
(
LONG_PTR
)
pOldWndProc
);
return
hTree
;
}
static
void
fill_tree
(
HWND
hTree
)
{
{
TVINSERTSTRUCTA
ins
;
TVINSERTSTRUCTA
ins
;
TVITEM
tvi
;
static
CHAR
root
[]
=
"Root"
,
static
CHAR
root
[]
=
"Root"
,
child
[]
=
"Child"
;
child
[]
=
"Child"
;
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
Clear
();
AddItem
(
'A'
);
ins
.
hParent
=
TVI_ROOT
;
ins
.
hParent
=
TVI_ROOT
;
ins
.
hInsertAfter
=
TVI_ROOT
;
ins
.
hInsertAfter
=
TVI_ROOT
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
root
;
U
(
ins
).
item
.
pszText
=
root
;
hRoot
=
TreeView_InsertItem
(
hTree
,
&
ins
);
hRoot
=
TreeView_InsertItem
(
hTree
,
&
ins
);
assert
(
hRoot
);
/* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
tvi
.
hItem
=
hRoot
;
tvi
.
mask
=
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
;
SendMessage
(
hTree
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
ok
(
tvi
.
iImage
==
0
,
"tvi.iImage=%d
\n
"
,
tvi
.
iImage
);
ok
(
tvi
.
iSelectedImage
==
0
,
"tvi.iSelectedImage=%d
\n
"
,
tvi
.
iSelectedImage
);
AddItem
(
'B'
);
ins
.
hParent
=
hRoot
;
ins
.
hParent
=
hRoot
;
ins
.
hInsertAfter
=
TVI_FIRST
;
ins
.
hInsertAfter
=
TVI_FIRST
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
child
;
U
(
ins
).
item
.
pszText
=
child
;
hChild
=
TreeView_InsertItem
(
hTree
,
&
ins
);
hChild
=
TreeView_InsertItem
(
hTree
,
&
ins
);
}
static
void
test_fillroot
(
void
)
{
TVITEM
tvi
;
hTree
=
create_treeview_control
();
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
fill_tree
(
hTree
);
Clear
();
AddItem
(
'A'
);
assert
(
hRoot
);
AddItem
(
'B'
);
assert
(
hChild
);
assert
(
hChild
);
AddItem
(
'.'
);
AddItem
(
'.'
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
FillRootSeq
,
"FillRoot"
,
FALSE
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
FillRootSeq
,
"FillRoot"
,
FALSE
);
ok
(
!
strcmp
(
sequence
,
"AB."
),
"Item creation
\n
"
);
ok
(
!
strcmp
(
sequence
,
"AB."
),
"Item creation
\n
"
);
/* UMLPad 1.15 depends on this being not -1 (I_IMAGECALLBACK) */
tvi
.
hItem
=
hRoot
;
tvi
.
mask
=
TVIF_IMAGE
|
TVIF_SELECTEDIMAGE
;
SendMessage
(
hTree
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
ok
(
tvi
.
iImage
==
0
,
"tvi.iImage=%d
\n
"
,
tvi
.
iImage
);
ok
(
tvi
.
iSelectedImage
==
0
,
"tvi.iSelectedImage=%d
\n
"
,
tvi
.
iSelectedImage
);
DestroyWindow
(
hTree
);
}
}
static
void
T
est
C
allback
(
void
)
static
void
t
est
_c
allback
(
void
)
{
{
HTREEITEM
hRoot
;
HTREEITEM
hRoot
;
HTREEITEM
hItem1
,
hItem2
;
HTREEITEM
hItem1
,
hItem2
;
...
@@ -279,6 +316,9 @@ static void TestCallback(void)
...
@@ -279,6 +316,9 @@ static void TestCallback(void)
CHAR
buf
[
128
];
CHAR
buf
[
128
];
LRESULT
ret
;
LRESULT
ret
;
hTree
=
create_treeview_control
();
fill_tree
(
hTree
);
ret
=
TreeView_DeleteAllItems
(
hTree
);
ret
=
TreeView_DeleteAllItems
(
hTree
);
ok
(
ret
==
TRUE
,
"ret
\n
"
);
ok
(
ret
==
TRUE
,
"ret
\n
"
);
ins
.
hParent
=
TVI_ROOT
;
ins
.
hParent
=
TVI_ROOT
;
...
@@ -329,14 +369,19 @@ static void TestCallback(void)
...
@@ -329,14 +369,19 @@ static void TestCallback(void)
ok
(
ret
==
TRUE
,
"Expected GetItem return TRUE, got %ld
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"Expected GetItem return TRUE, got %ld
\n
"
,
ret
);
ok
(
strcmp
(
tvi
.
pszText
,
TEST_CALLBACK_TEXT
)
==
0
,
"Item text mismatch %s vs %s
\n
"
,
ok
(
strcmp
(
tvi
.
pszText
,
TEST_CALLBACK_TEXT
)
==
0
,
"Item text mismatch %s vs %s
\n
"
,
tvi
.
pszText
,
TEST_CALLBACK_TEXT
);
tvi
.
pszText
,
TEST_CALLBACK_TEXT
);
DestroyWindow
(
hTree
);
}
}
static
void
DoTest1
(
void
)
static
void
test_select
(
void
)
{
{
BOOL
r
;
BOOL
r
;
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
hTree
=
create_treeview_control
();
fill_tree
(
hTree
);
/* root-none select tests */
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
r
=
TreeView_SelectItem
(
hTree
,
NULL
);
r
=
TreeView_SelectItem
(
hTree
,
NULL
);
Clear
();
Clear
();
AddItem
(
'1'
);
AddItem
(
'1'
);
...
@@ -351,15 +396,11 @@ static void DoTest1(void)
...
@@ -351,15 +396,11 @@ static void DoTest1(void)
r
=
TreeView_SelectItem
(
hTree
,
hRoot
);
r
=
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'.'
);
AddItem
(
'.'
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(Rn)Rn45(nR)nR."
),
"root-none select test
\n
"
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(Rn)Rn45(nR)nR."
),
"root-none select test
\n
"
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
DoTest1Seq
,
"DoTest1"
,
FALSE
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
rootnone_select_seq
,
}
"root-none select seq"
,
FALSE
);
static
void
DoTest2
(
void
)
{
BOOL
r
;
/* root-child select tests */
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
r
=
TreeView_SelectItem
(
hTree
,
NULL
);
r
=
TreeView_SelectItem
(
hTree
,
NULL
);
Clear
();
Clear
();
AddItem
(
'1'
);
AddItem
(
'1'
);
...
@@ -374,17 +415,23 @@ static void DoTest2(void)
...
@@ -374,17 +415,23 @@ static void DoTest2(void)
r
=
TreeView_SelectItem
(
hTree
,
hRoot
);
r
=
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'.'
);
AddItem
(
'.'
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(RC)RC45(CR)CR."
),
"root-child select test
\n
"
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(RC)RC45(CR)CR."
),
"root-child select test
\n
"
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
DoTest2Seq
,
"DoTest2"
,
FALSE
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
rootchild_select_seq
,
"root-child select seq"
,
FALSE
);
DestroyWindow
(
hTree
);
}
}
static
void
DoTest3
(
void
)
static
void
test_getitemtext
(
void
)
{
{
TVINSERTSTRUCTA
ins
;
TVINSERTSTRUCTA
ins
;
HTREEITEM
hChild
;
HTREEITEM
hChild
;
TVITEM
tvi
;
TVITEM
tvi
;
int
nBufferSize
=
80
;
CHAR
szBuffer
[
80
]
=
"Blah"
;
CHAR
szBuffer
[
80
]
=
"Blah"
;
int
nBufferSize
=
sizeof
(
szBuffer
)
/
sizeof
(
CHAR
);
hTree
=
create_treeview_control
();
fill_tree
(
hTree
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
...
@@ -406,16 +453,21 @@ static void DoTest3(void)
...
@@ -406,16 +453,21 @@ static void DoTest3(void)
SendMessageA
(
hTree
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
SendMessageA
(
hTree
,
TVM_GETITEM
,
0
,
(
LPARAM
)
&
tvi
);
ok
(
!
strcmp
(
szBuffer
,
""
),
"szBuffer=
\"
%s
\"
, expected
\"\"\n
"
,
szBuffer
);
ok
(
!
strcmp
(
szBuffer
,
""
),
"szBuffer=
\"
%s
\"
, expected
\"\"\n
"
,
szBuffer
);
ok
(
SendMessageA
(
hTree
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
hChild
),
"DeleteItem failed
\n
"
);
ok
(
SendMessageA
(
hTree
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
hChild
),
"DeleteItem failed
\n
"
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
DoTest3Seq
,
"DoTest3"
,
FALSE
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
getitemtext_seq
,
"get item text seq"
,
FALSE
);
DestroyWindow
(
hTree
);
}
}
static
void
DoFocusTest
(
void
)
static
void
test_focus
(
void
)
{
{
TVINSERTSTRUCTA
ins
;
TVINSERTSTRUCTA
ins
;
static
CHAR
child1
[]
=
"Edit"
,
static
CHAR
child1
[]
=
"Edit"
,
child2
[]
=
"A really long string"
;
child2
[]
=
"A really long string"
;
HTREEITEM
hChild1
,
hChild2
;
HTREEITEM
hChild1
,
hChild2
;
hTree
=
create_treeview_control
();
fill_tree
(
hTree
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
/* This test verifies that when a label is being edited, scrolling
/* This test verifies that when a label is being edited, scrolling
...
@@ -436,12 +488,13 @@ static void DoFocusTest(void)
...
@@ -436,12 +488,13 @@ static void DoFocusTest(void)
assert
(
hChild2
);
assert
(
hChild2
);
ShowWindow
(
hMainWnd
,
SW_SHOW
);
ShowWindow
(
hMainWnd
,
SW_SHOW
);
/* Using SendMessageA since Win98 doesn't have default unicode support */
SendMessageA
(
hTree
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hChild
);
SendMessageA
(
hTree
,
TVM_SELECTITEM
,
TVGN_CARET
,
(
LPARAM
)
hChild
);
hEdit
=
TreeView_EditLabel
(
hTree
,
hChild
);
hEdit
=
TreeView_EditLabel
(
hTree
,
hChild
);
ScrollWindowEx
(
hTree
,
-
10
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
SW_SCROLLCHILDREN
);
ScrollWindowEx
(
hTree
,
-
10
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
SW_SCROLLCHILDREN
);
ok
(
GetFocus
()
==
hEdit
,
"Edit control should have focus
\n
"
);
ok
(
GetFocus
()
==
hEdit
,
"Edit control should have focus
\n
"
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
DoFocusTestSeq
,
"DoFocusTest"
,
TRUE
);
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
focus_seq
,
"focus test"
,
TRUE
);
DestroyWindow
(
hTree
);
}
}
static
void
TestGetSetBkColor
(
void
)
static
void
TestGetSetBkColor
(
void
)
...
@@ -620,8 +673,11 @@ static void TestGetSetUnicodeFormat(void)
...
@@ -620,8 +673,11 @@ static void TestGetSetUnicodeFormat(void)
SendMessage
(
hTree
,
TVM_SETUNICODEFORMAT
,
(
LPARAM
)
bPreviousSetting
,
0
);
SendMessage
(
hTree
,
TVM_SETUNICODEFORMAT
,
(
LPARAM
)
bPreviousSetting
,
0
);
}
}
static
void
T
est
G
et
S
et
(
void
)
static
void
t
est
_g
et
s
et
(
void
)
{
{
hTree
=
create_treeview_control
();
fill_tree
(
hTree
);
/* TVM_GETBKCOLOR and TVM_SETBKCOLOR */
/* TVM_GETBKCOLOR and TVM_SETBKCOLOR */
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
flush_sequences
(
MsgSequences
,
NUM_MSG_SEQUENCES
);
TestGetSetBkColor
();
TestGetSetBkColor
();
...
@@ -681,50 +737,13 @@ static void TestGetSet(void)
...
@@ -681,50 +737,13 @@ static void TestGetSet(void)
TestGetSetUnicodeFormat
();
TestGetSetUnicodeFormat
();
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
TestGetSetUnicodeFormatSeq
,
ok_sequence
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
TestGetSetUnicodeFormatSeq
,
"TestGetSetUnicodeFormat"
,
FALSE
);
"TestGetSetUnicodeFormat"
,
FALSE
);
}
/* This function hooks in and records all messages to the treeview control */
DestroyWindow
(
hTree
);
static
LRESULT
WINAPI
TreeviewWndProc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
static
LONG
defwndproc_counter
=
0
;
LRESULT
ret
;
struct
message
msg
;
WNDPROC
lpOldProc
=
(
WNDPROC
)
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
msg
.
message
=
message
;
msg
.
flags
=
sent
|
wparam
|
lparam
;
if
(
defwndproc_counter
)
msg
.
flags
|=
defwinproc
;
msg
.
wParam
=
wParam
;
msg
.
lParam
=
lParam
;
add_message
(
MsgSequences
,
TREEVIEW_SEQ_INDEX
,
&
msg
);
defwndproc_counter
++
;
ret
=
CallWindowProcA
(
lpOldProc
,
hwnd
,
message
,
wParam
,
lParam
);
defwndproc_counter
--
;
return
ret
;
}
}
static
LRESULT
CALLBACK
MyWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
static
LRESULT
CALLBACK
MyWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
{
WNDPROC
pOldWndProc
;
switch
(
msg
)
{
switch
(
msg
)
{
case
WM_CREATE
:
{
hTree
=
CreateWindowExA
(
WS_EX_CLIENTEDGE
,
WC_TREEVIEWA
,
NULL
,
WS_CHILD
|
WS_VISIBLE
|
TVS_LINESATROOT
|
TVS_HASLINES
|
TVS_HASBUTTONS
|
TVS_EDITLABELS
,
0
,
0
,
120
,
100
,
hWnd
,
(
HMENU
)
100
,
GetModuleHandleA
(
0
),
0
);
SetFocus
(
hTree
);
/* Record the old WNDPROC so we can call it after recording the messages */
pOldWndProc
=
(
WNDPROC
)
SetWindowLongPtrA
(
hTree
,
GWLP_WNDPROC
,
(
LONG_PTR
)
TreeviewWndProc
);
SetWindowLongPtrA
(
hTree
,
GWLP_USERDATA
,
(
LONG_PTR
)
pOldWndProc
);
return
0
;
}
case
WM_NOTIFY
:
case
WM_NOTIFY
:
{
{
NMHDR
*
pHdr
=
(
NMHDR
*
)
lParam
;
NMHDR
*
pHdr
=
(
NMHDR
*
)
lParam
;
...
@@ -755,10 +774,6 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
...
@@ -755,10 +774,6 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
return
0
;
return
0
;
}
}
case
WM_SIZE
:
MoveWindow
(
hTree
,
0
,
0
,
LOWORD
(
lParam
),
HIWORD
(
lParam
),
TRUE
);
break
;
case
WM_DESTROY
:
case
WM_DESTROY
:
PostQuitMessage
(
0
);
PostQuitMessage
(
0
);
break
;
break
;
...
@@ -769,7 +784,7 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
...
@@ -769,7 +784,7 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
return
0L
;
return
0L
;
}
}
static
void
T
est
E
xpand
I
nvisible
(
void
)
static
void
t
est
_e
xpand
i
nvisible
(
void
)
{
{
static
CHAR
nodeText
[][
5
]
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
};
static
CHAR
nodeText
[][
5
]
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
};
TVINSERTSTRUCTA
ins
;
TVINSERTSTRUCTA
ins
;
...
@@ -778,6 +793,8 @@ static void TestExpandInvisible(void)
...
@@ -778,6 +793,8 @@ static void TestExpandInvisible(void)
BOOL
nodeVisible
;
BOOL
nodeVisible
;
LRESULT
ret
;
LRESULT
ret
;
hTree
=
create_treeview_control
();
/* The test builds the following tree and expands then node 1, while node 0 is collapsed.
/* The test builds the following tree and expands then node 1, while node 0 is collapsed.
*
*
* 0
* 0
...
@@ -837,8 +854,9 @@ static void TestExpandInvisible(void)
...
@@ -837,8 +854,9 @@ static void TestExpandInvisible(void)
ok
(
!
nodeVisible
,
"Node 3 should not be visible.
\n
"
);
ok
(
!
nodeVisible
,
"Node 3 should not be visible.
\n
"
);
nodeVisible
=
TreeView_GetItemRect
(
hTree
,
node
[
4
],
&
dummyRect
,
FALSE
);
nodeVisible
=
TreeView_GetItemRect
(
hTree
,
node
[
4
],
&
dummyRect
,
FALSE
);
ok
(
!
nodeVisible
,
"Node 4 should not be visible.
\n
"
);
ok
(
!
nodeVisible
,
"Node 4 should not be visible.
\n
"
);
}
DestroyWindow
(
hTree
);
}
START_TEST
(
treeview
)
START_TEST
(
treeview
)
{
{
...
@@ -880,16 +898,13 @@ START_TEST(treeview)
...
@@ -880,16 +898,13 @@ START_TEST(treeview)
if
(
!
ok
(
hMainWnd
!=
NULL
,
"Failed to create parent window. Tests aborted.
\n
"
)
)
if
(
!
ok
(
hMainWnd
!=
NULL
,
"Failed to create parent window. Tests aborted.
\n
"
)
)
return
;
return
;
FillRoot
();
test_fillroot
();
DoTest1
();
test_select
();
DoTest2
();
test_getitemtext
();
DoTest3
();
test_focus
();
DoFocusTest
();
test_getset
();
TestGetSet
();
test_callback
();
/* Clears all the previous items */
test_expandinvisible
();
TestCallback
();
/* Clears all the previous items */
TestExpandInvisible
();
PostMessageA
(
hMainWnd
,
WM_CLOSE
,
0
,
0
);
PostMessageA
(
hMainWnd
,
WM_CLOSE
,
0
,
0
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment