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
70f4ce36
Commit
70f4ce36
authored
Aug 13, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Aug 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Add tests for wizard dialog navigation.
parent
c1c22e25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
0 deletions
+179
-0
propsheet.c
dlls/comctl32/tests/propsheet.c
+135
-0
resources.h
dlls/comctl32/tests/resources.h
+10
-0
rsrc.rc
dlls/comctl32/tests/rsrc.rc
+34
-0
No files found.
dlls/comctl32/tests/propsheet.c
View file @
70f4ce36
...
@@ -20,10 +20,14 @@
...
@@ -20,10 +20,14 @@
#include <windows.h>
#include <windows.h>
#include <commctrl.h>
#include <commctrl.h>
#include "resources.h"
#include "wine/test.h"
#include "wine/test.h"
static
HWND
parent
;
static
HWND
parent
;
static
LONG
active_page
=
-
1
;
static
int
CALLBACK
sheet_callback
(
HWND
hwnd
,
UINT
msg
,
LPARAM
lparam
)
static
int
CALLBACK
sheet_callback
(
HWND
hwnd
,
UINT
msg
,
LPARAM
lparam
)
{
{
switch
(
msg
)
switch
(
msg
)
...
@@ -199,9 +203,140 @@ static void test_disableowner(void)
...
@@ -199,9 +203,140 @@ static void test_disableowner(void)
DestroyWindow
(
parent
);
DestroyWindow
(
parent
);
}
}
static
LRESULT
CALLBACK
nav_page_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
{
switch
(
msg
){
case
WM_NOTIFY
:
{
LPNMHDR
hdr
=
(
LPNMHDR
)
lparam
;
switch
(
hdr
->
code
){
case
PSN_SETACTIVE
:
active_page
=
PropSheet_HwndToIndex
(
hdr
->
hwndFrom
,
hwnd
);
break
;
case
PSN_KILLACTIVE
:
/* prevent navigation away from the fourth page */
if
(
active_page
==
3
){
SetWindowLongPtr
(
hwnd
,
DWLP_MSGRESULT
,
TRUE
);
return
TRUE
;
}
}
break
;
}
}
return
DefWindowProc
(
hwnd
,
msg
,
wparam
,
lparam
);
}
static
void
test_wiznavigation
(
void
)
{
HPROPSHEETPAGE
hpsp
[
4
];
PROPSHEETPAGEA
psp
[
4
];
PROPSHEETHEADERA
psh
;
HWND
hdlg
,
control
;
LONG_PTR
controlID
;
LRESULT
defidres
;
const
INT
nextID
=
12324
;
const
INT
backID
=
12323
;
/* create the property sheet pages */
memset
(
psp
,
0
,
sizeof
(
PROPSHEETPAGEA
)
*
4
);
psp
[
0
].
dwSize
=
sizeof
(
PROPSHEETPAGEA
);
psp
[
0
].
hInstance
=
GetModuleHandleW
(
NULL
);
U
(
psp
[
0
]).
pszTemplate
=
MAKEINTRESOURCE
(
IDD_PROP_PAGE_INTRO
);
psp
[
0
].
pfnDlgProc
=
nav_page_proc
;
hpsp
[
0
]
=
CreatePropertySheetPageA
(
&
psp
[
0
]);
psp
[
1
].
dwSize
=
sizeof
(
PROPSHEETPAGEA
);
psp
[
1
].
hInstance
=
GetModuleHandleW
(
NULL
);
U
(
psp
[
1
]).
pszTemplate
=
MAKEINTRESOURCE
(
IDD_PROP_PAGE_EDIT
);
psp
[
1
].
pfnDlgProc
=
nav_page_proc
;
hpsp
[
1
]
=
CreatePropertySheetPageA
(
&
psp
[
1
]);
psp
[
2
].
dwSize
=
sizeof
(
PROPSHEETPAGEA
);
psp
[
2
].
hInstance
=
GetModuleHandleW
(
NULL
);
U
(
psp
[
2
]).
pszTemplate
=
MAKEINTRESOURCE
(
IDD_PROP_PAGE_RADIO
);
psp
[
2
].
pfnDlgProc
=
nav_page_proc
;
hpsp
[
2
]
=
CreatePropertySheetPageA
(
&
psp
[
2
]);
psp
[
3
].
dwSize
=
sizeof
(
PROPSHEETPAGEA
);
psp
[
3
].
hInstance
=
GetModuleHandleW
(
NULL
);
U
(
psp
[
3
]).
pszTemplate
=
MAKEINTRESOURCE
(
IDD_PROP_PAGE_EXIT
);
psp
[
3
].
pfnDlgProc
=
nav_page_proc
;
hpsp
[
3
]
=
CreatePropertySheetPageA
(
&
psp
[
3
]);
/* set up the property sheet dialog */
memset
(
&
psh
,
0
,
sizeof
(
psh
));
psh
.
dwSize
=
sizeof
(
psh
);
psh
.
dwFlags
=
PSH_MODELESS
|
PSH_WIZARD
;
psh
.
pszCaption
=
"A Wizard"
;
psh
.
nPages
=
4
;
psh
.
hwndParent
=
GetDesktopWindow
();
U3
(
psh
).
phpage
=
hpsp
;
hdlg
=
(
HWND
)
PropertySheetA
(
&
psh
);
ok
(
active_page
==
0
,
"Active page should be 0. Is: %d
\n
"
,
active_page
);
control
=
GetFocus
();
controlID
=
GetWindowLongPtr
(
control
,
GWLP_ID
);
ok
(
controlID
==
nextID
,
"Focus should have been set to the Next button. Expected: %d, Found: %ld
\n
"
,
nextID
,
controlID
);
/* simulate pressing the Next button */
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_NEXT
,
0
);
ok
(
active_page
==
1
,
"Active page should be 1 after pressing Next. Is: %d
\n
"
,
active_page
);
control
=
GetFocus
();
controlID
=
GetWindowLongPtr
(
control
,
GWLP_ID
);
ok
(
controlID
==
IDC_PS_EDIT1
,
"Focus should be set to the first item on the second page. Expected: %d, Found: %ld
\n
"
,
IDC_PS_EDIT1
,
controlID
);
defidres
=
SendMessage
(
hdlg
,
DM_GETDEFID
,
0
,
0
);
ok
(
defidres
==
MAKELRESULT
(
nextID
,
DC_HASDEFID
),
"Expected default button ID to be %d, is %d
\n
"
,
nextID
,
LOWORD
(
defidres
));
/* set the focus to the second edit box on this page */
SetFocus
(
GetNextDlgTabItem
(
hdlg
,
control
,
FALSE
));
/* press next again */
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_NEXT
,
0
);
ok
(
active_page
==
2
,
"Active page should be 2 after pressing Next. Is: %d
\n
"
,
active_page
);
control
=
GetFocus
();
controlID
=
GetWindowLongPtr
(
control
,
GWLP_ID
);
ok
(
controlID
==
IDC_PS_RADIO1
,
"Focus should have been set to item on third page. Expected: %d, Found %ld
\n
"
,
IDC_PS_RADIO1
,
controlID
);
/* back button */
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_BACK
,
0
);
ok
(
active_page
==
1
,
"Active page should be 1 after pressing Back. Is: %d
\n
"
,
active_page
);
control
=
GetFocus
();
controlID
=
GetWindowLongPtr
(
control
,
GWLP_ID
);
ok
(
controlID
==
IDC_PS_EDIT1
,
"Focus should have been set to the first item on second page. Expected: %d, Found %ld
\n
"
,
IDC_PS_EDIT1
,
controlID
);
defidres
=
SendMessage
(
hdlg
,
DM_GETDEFID
,
0
,
0
);
ok
(
defidres
==
MAKELRESULT
(
backID
,
DC_HASDEFID
),
"Expected default button ID to be %d, is %d
\n
"
,
backID
,
LOWORD
(
defidres
));
/* press next twice */
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_NEXT
,
0
);
ok
(
active_page
==
2
,
"Active page should be 2 after pressing Next. Is: %d
\n
"
,
active_page
);
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_NEXT
,
0
);
ok
(
active_page
==
3
,
"Active page should be 3 after pressing Next. Is: %d
\n
"
,
active_page
);
control
=
GetFocus
();
controlID
=
GetWindowLongPtr
(
control
,
GWLP_ID
);
ok
(
controlID
==
nextID
,
"Focus should have been set to the Next button. Expected: %d, Found: %ld
\n
"
,
nextID
,
controlID
);
/* try to navigate away, but shouldn't be able to */
SendMessage
(
hdlg
,
PSM_PRESSBUTTON
,
PSBTN_BACK
,
0
);
ok
(
active_page
==
3
,
"Active page should still be 3 after pressing Back. Is: %d
\n
"
,
active_page
);
defidres
=
SendMessage
(
hdlg
,
DM_GETDEFID
,
0
,
0
);
ok
(
defidres
==
MAKELRESULT
(
nextID
,
DC_HASDEFID
),
"Expected default button ID to be %d, is %d
\n
"
,
nextID
,
LOWORD
(
defidres
));
DestroyWindow
(
hdlg
);
}
START_TEST
(
propsheet
)
START_TEST
(
propsheet
)
{
{
test_title
();
test_title
();
test_nopage
();
test_nopage
();
test_disableowner
();
test_disableowner
();
test_wiznavigation
();
}
}
dlls/comctl32/tests/resources.h
View file @
70f4ce36
...
@@ -31,4 +31,14 @@
...
@@ -31,4 +31,14 @@
#define IDS_TBADD5 20
#define IDS_TBADD5 20
#define IDS_TBADD7 22
#define IDS_TBADD7 22
#define IDD_PROP_PAGE_INTRO 30
#define IDD_PROP_PAGE_EDIT 31
#define IDD_PROP_PAGE_RADIO 32
#define IDD_PROP_PAGE_EXIT 33
#define IDC_PS_EDIT1 1000
#define IDC_PS_EDIT2 1001
#define IDC_PS_RADIO1 1010
#define IDC_PS_RADIO2 1011
#endif
/* __WINE_COMCTL32_TEST_RESOURCES_H */
#endif
/* __WINE_COMCTL32_TEST_RESOURCES_H */
dlls/comctl32/tests/rsrc.rc
View file @
70f4ce36
...
@@ -30,6 +30,40 @@ FONT 8, "MS Shell Dlg"
...
@@ -30,6 +30,40 @@ FONT 8, "MS Shell Dlg"
LTEXT "Test", -1, 10, 6, 100, 8
LTEXT "Test", -1, 10, 6, 100, 8
}
}
IDD_PROP_PAGE_INTRO DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
CAPTION "Edit Control Page"
FONT 8, "MS Shell Dlg"
{
LTEXT "This is a test property sheet!", -1, 10, 6, 100, 8
}
IDD_PROP_PAGE_EDIT DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
CAPTION "Edit Control Page"
FONT 8, "MS Shell Dlg"
{
EDITTEXT IDC_PS_EDIT1, 5, 5, 150, 140, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE
EDITTEXT IDC_PS_EDIT2, 5, 160, 150, 28, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE
}
IDD_PROP_PAGE_RADIO DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
CAPTION "Edit Control Page"
FONT 8, "MS Shell Dlg"
{
CONTROL "Radio1", IDC_PS_RADIO1, "Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 20, 20, 39, 10
CONTROL "Radio2", IDC_PS_RADIO2, "Button", BS_AUTORADIOBUTTON, 20, 40, 39, 10
}
IDD_PROP_PAGE_EXIT DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE
CAPTION "Edit Control Page"
FONT 8, "MS Shell Dlg"
{
LTEXT "This has been a test property sheet!", -1, 10, 6, 170, 8
}
STRINGTABLE
STRINGTABLE
{
{
IDS_TBADD1 "abc"
IDS_TBADD1 "abc"
...
...
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