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
c1c22e25
Commit
c1c22e25
authored
Aug 13, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Aug 14, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for saving and restoring control focus.
parent
ac34e22e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
dialog.c
dlls/user32/tests/dialog.c
+58
-0
No files found.
dlls/user32/tests/dialog.c
View file @
c1c22e25
...
...
@@ -1069,6 +1069,63 @@ static void test_MessageBoxFontTest(void)
DestroyWindow
(
hDlg
);
}
static
void
test_SaveRestoreFocus
(
void
)
{
HWND
hDlg
;
HRSRC
hResource
;
HANDLE
hTemplate
;
DLGTEMPLATE
*
pTemplate
;
LONG_PTR
foundId
;
HWND
foundHwnd
;
/* create the dialog */
hResource
=
FindResourceA
(
g_hinst
,
"MULTI_EDIT_DIALOG"
,
RT_DIALOG
);
hTemplate
=
LoadResource
(
g_hinst
,
hResource
);
pTemplate
=
LockResource
(
hTemplate
);
hDlg
=
CreateDialogIndirectParamA
(
g_hinst
,
pTemplate
,
NULL
,
messageBoxFontDlgWinProc
,
0
);
ok
(
hDlg
!=
0
,
"Failed to create test dialog.
\n
"
);
foundId
=
GetWindowLongPtr
(
GetFocus
(),
GWLP_ID
);
ok
(
foundId
==
1000
,
"First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld
\n
"
,
1000
,
foundId
);
/* de- then reactivate the dialog */
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_INACTIVE
,
0
),
0
);
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_ACTIVE
,
0
),
0
);
foundId
=
GetWindowLongPtr
(
GetFocus
(),
GWLP_ID
);
ok
(
foundId
==
1000
,
"First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld
\n
"
,
1000
,
foundId
);
/* select the next tabbable item */
SetFocus
(
GetNextDlgTabItem
(
hDlg
,
GetFocus
(),
FALSE
));
foundId
=
GetWindowLongPtr
(
GetFocus
(),
GWLP_ID
);
ok
(
foundId
==
1001
,
"Second edit box should have gained focus. Expected: %d, Found: %ld
\n
"
,
1001
,
foundId
);
/* de- then reactivate the dialog */
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_INACTIVE
,
0
),
0
);
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_ACTIVE
,
0
),
0
);
foundId
=
GetWindowLongPtr
(
GetFocus
(),
GWLP_ID
);
ok
(
foundId
==
1001
,
"Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld
\n
"
,
1001
,
foundId
);
/* disable the 2nd box */
EnableWindow
(
GetFocus
(),
FALSE
);
foundHwnd
=
GetFocus
();
ok
(
foundHwnd
==
NULL
,
"Second edit box should have lost focus after being disabled. Expected: %p, Found: %p
\n
"
,
NULL
,
foundHwnd
);
/* de- then reactivate the dialog */
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_INACTIVE
,
0
),
0
);
SendMessage
(
hDlg
,
WM_ACTIVATE
,
MAKEWPARAM
(
WA_ACTIVE
,
0
),
0
);
foundHwnd
=
GetFocus
();
ok
(
foundHwnd
==
NULL
,
"No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p
\n
"
,
NULL
,
foundHwnd
);
/* clean up */
DestroyWindow
(
hDlg
);
}
START_TEST
(
dialog
)
{
g_hinst
=
GetModuleHandleA
(
0
);
...
...
@@ -1083,4 +1140,5 @@ START_TEST(dialog)
test_DialogBoxParamA
();
test_DisabledDialogTest
();
test_MessageBoxFontTest
();
test_SaveRestoreFocus
();
}
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