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
6b1e80cb
Commit
6b1e80cb
authored
Jun 13, 2005
by
Krzysztof Foltman
Committed by
Alexandre Julliard
Jun 13, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test when TVN_SELCHANGING and TVN_SELCHANGED are really sent.
parent
c2d5b444
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
219 additions
and
0 deletions
+219
-0
.cvsignore
dlls/comctl32/tests/.cvsignore
+1
-0
Makefile.in
dlls/comctl32/tests/Makefile.in
+1
-0
treeview.c
dlls/comctl32/tests/treeview.c
+217
-0
No files found.
dlls/comctl32/tests/.cvsignore
View file @
6b1e80cb
...
...
@@ -5,4 +5,5 @@ mru.ok
subclass.ok
tab.ok
testlist.c
treeview.ok
updown.ok
dlls/comctl32/tests/Makefile.in
View file @
6b1e80cb
...
...
@@ -11,6 +11,7 @@ CTESTS = \
mru.c
\
subclass.c
\
tab.c
\
treeview.c
\
updown.c
@MAKE_TEST_RULES@
...
...
dlls/comctl32/tests/treeview.c
0 → 100644
View file @
6b1e80cb
/* Unit tests for treeview.
*
* Copyright 2005 Krzysztof Foltman
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "commctrl.h"
#include "wine/test.h"
static
HWND
hMainWnd
;
static
HWND
hTree
;
static
HTREEITEM
hRoot
,
hChild
;
static
int
pos
=
0
;
static
char
sequence
[
256
];
static
void
Clear
()
{
pos
=
0
;
sequence
[
0
]
=
'\0'
;
}
static
void
AddItem
(
char
ch
)
{
sequence
[
pos
++
]
=
ch
;
sequence
[
pos
]
=
'\0'
;
}
static
void
IdentifyItem
(
HTREEITEM
hItem
)
{
if
(
hItem
==
hRoot
)
{
AddItem
(
'R'
);
return
;
}
if
(
hItem
==
hChild
)
{
AddItem
(
'C'
);
return
;
}
if
(
hItem
==
NULL
)
{
AddItem
(
'n'
);
return
;
}
AddItem
(
'?'
);
}
static
void
FillRoot
()
{
TVINSERTSTRUCTA
ins
;
Clear
();
AddItem
(
'A'
);
ins
.
hParent
=
TVI_ROOT
;
ins
.
hInsertAfter
=
TVI_ROOT
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
"Root"
;
hRoot
=
TreeView_InsertItemA
(
hTree
,
&
ins
);
assert
(
hRoot
);
AddItem
(
'B'
);
ins
.
hParent
=
hRoot
;
ins
.
hInsertAfter
=
TVI_FIRST
;
U
(
ins
).
item
.
mask
=
TVIF_TEXT
;
U
(
ins
).
item
.
pszText
=
"Child"
;
hChild
=
TreeView_InsertItemA
(
hTree
,
&
ins
);
assert
(
hChild
);
AddItem
(
'.'
);
ok
(
!
strcmp
(
sequence
,
"AB."
),
"Item creation"
);
}
static
void
DoTest1
()
{
TreeView_SelectItem
(
hTree
,
NULL
);
Clear
();
AddItem
(
'1'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'2'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'3'
);
TreeView_SelectItem
(
hTree
,
NULL
);
AddItem
(
'4'
);
TreeView_SelectItem
(
hTree
,
NULL
);
AddItem
(
'5'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'.'
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(Rn)Rn45(nR)nR."
),
"root-none select test"
);
}
static
void
DoTest2
()
{
TreeView_SelectItem
(
hTree
,
NULL
);
Clear
();
AddItem
(
'1'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'2'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'3'
);
TreeView_SelectItem
(
hTree
,
hChild
);
AddItem
(
'4'
);
TreeView_SelectItem
(
hTree
,
hChild
);
AddItem
(
'5'
);
TreeView_SelectItem
(
hTree
,
hRoot
);
AddItem
(
'.'
);
ok
(
!
strcmp
(
sequence
,
"1(nR)nR23(RC)RC45(CR)CR."
),
"root-child select test"
);
}
LRESULT
CALLBACK
MyWndProc
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
msg
)
{
case
WM_CREATE
:
{
hTree
=
CreateWindowExA
(
WS_EX_CLIENTEDGE
,
WC_TREEVIEWA
,
NULL
,
WS_CHILD
|
WS_VISIBLE
|
TVS_LINESATROOT
|
TVS_HASLINES
|
TVS_HASBUTTONS
,
0
,
0
,
300
,
50
,
hWnd
,
(
HMENU
)
100
,
GetModuleHandleA
(
0
),
0
);
SetFocus
(
hTree
);
return
0
;
}
case
WM_NOTIFY
:
{
NMHDR
*
pHdr
=
(
NMHDR
*
)
lParam
;
if
(
pHdr
->
idFrom
==
100
)
{
NMTREEVIEWA
*
pTreeView
=
(
LPNMTREEVIEWA
)
lParam
;
switch
(
pHdr
->
code
)
{
case
TVN_SELCHANGINGA
:
AddItem
(
'('
);
IdentifyItem
(
pTreeView
->
itemOld
.
hItem
);
IdentifyItem
(
pTreeView
->
itemNew
.
hItem
);
return
0
;
case
TVN_SELCHANGEDA
:
AddItem
(
')'
);
IdentifyItem
(
pTreeView
->
itemOld
.
hItem
);
IdentifyItem
(
pTreeView
->
itemNew
.
hItem
);
return
0
;
}
}
return
0
;
}
case
WM_SIZE
:
MoveWindow
(
hTree
,
0
,
0
,
LOWORD
(
lParam
),
HIWORD
(
lParam
),
TRUE
);
break
;
case
WM_DESTROY
:
PostQuitMessage
(
0
);
break
;
default:
return
DefWindowProcA
(
hWnd
,
msg
,
wParam
,
lParam
);
}
return
0L
;
}
START_TEST
(
treeview
)
{
WNDCLASSA
wc
;
MSG
msg
;
INITCOMMONCONTROLSEX
icex
;
RECT
rc
;
icex
.
dwSize
=
sizeof
(
INITCOMMONCONTROLSEX
);
icex
.
dwICC
=
ICC_TREEVIEW_CLASSES
;
InitCommonControlsEx
(
&
icex
);
wc
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
wc
.
cbClsExtra
=
0
;
wc
.
cbWndExtra
=
0
;
wc
.
hInstance
=
GetModuleHandleA
(
NULL
);
wc
.
hIcon
=
NULL
;
wc
.
hCursor
=
LoadCursorA
(
NULL
,
MAKEINTRESOURCEA
(
IDC_IBEAM
));
wc
.
hbrBackground
=
GetSysColorBrush
(
COLOR_WINDOW
);
wc
.
lpszMenuName
=
NULL
;
wc
.
lpszClassName
=
"MyTestWnd"
;
wc
.
lpfnWndProc
=
MyWndProc
;
RegisterClassA
(
&
wc
);
hMainWnd
=
CreateWindowExA
(
0
,
"MyTestWnd"
,
"Blah"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
680
,
260
,
NULL
,
NULL
,
GetModuleHandleA
(
NULL
),
0
);
GetClientRect
(
hMainWnd
,
&
rc
);
FillRoot
();
DoTest1
();
DoTest2
();
PostMessageA
(
hMainWnd
,
WM_CLOSE
,
0
,
0
);
while
(
GetMessageA
(
&
msg
,
0
,
0
,
0
))
{
TranslateMessage
(
&
msg
);
DispatchMessageA
(
&
msg
);
}
}
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