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
0641192b
Commit
0641192b
authored
Jan 24, 2010
by
Jason Edmeades
Committed by
Alexandre Julliard
Jan 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Combo should preselect all text on first WM_SETFOCUS.
parent
571b7a5a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
0 deletions
+109
-0
combo.c
dlls/user32/tests/combo.c
+101
-0
edit.c
dlls/user32/tests/edit.c
+8
-0
No files found.
dlls/user32/tests/combo.c
View file @
0641192b
...
@@ -401,6 +401,106 @@ static void test_changesize( DWORD style)
...
@@ -401,6 +401,106 @@ static void test_changesize( DWORD style)
DestroyWindow
(
hCombo
);
DestroyWindow
(
hCombo
);
}
}
static
void
test_editselection
(
void
)
{
HWND
hCombo
;
INT
start
,
end
;
HWND
hEdit
;
COMBOBOXINFO
cbInfo
;
BOOL
ret
;
DWORD
len
;
BOOL
(
WINAPI
*
pGetComboBoxInfo
)(
HWND
,
PCOMBOBOXINFO
);
char
edit
[
20
];
pGetComboBoxInfo
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"user32.dll"
),
"GetComboBoxInfo"
);
if
(
!
pGetComboBoxInfo
){
win_skip
(
"GetComboBoxInfo is not available
\n
"
);
return
;
}
/* Build a combo */
hCombo
=
build_combo
(
CBS_SIMPLE
);
cbInfo
.
cbSize
=
sizeof
(
COMBOBOXINFO
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetComboBoxInfo
(
hCombo
,
&
cbInfo
);
ok
(
ret
,
"Failed to get combobox info structure. LastError=%d
\n
"
,
GetLastError
());
hEdit
=
cbInfo
.
hwndItem
;
/* Initially combo selection is empty*/
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
0
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
/* Set some text, and press a key to replace it */
edit
[
0
]
=
0x00
;
SendMessage
(
hCombo
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"Jason1"
);
SendMessage
(
hCombo
,
WM_GETTEXT
,
sizeof
(
edit
),
(
LPARAM
)
edit
);
ok
(
strcmp
(
edit
,
"Jason1"
)
==
0
,
"Unexpected text retrieved %s
\n
"
,
edit
);
/* Now what is the selection - still empty */
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
(
WPARAM
)
&
start
,
(
WPARAM
)
&
end
);
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
0
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
/* Give it focus, and it gets selected */
SendMessage
(
hCombo
,
WM_SETFOCUS
,
0
,
(
LPARAM
)
hEdit
);
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
(
WPARAM
)
&
start
,
(
WPARAM
)
&
end
);
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
todo_wine
ok
(
HIWORD
(
len
)
==
6
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
/* Now emulate a key press */
edit
[
0
]
=
0x00
;
SendMessage
(
hCombo
,
WM_CHAR
,
'A'
,
0x1c0001
);
SendMessage
(
hCombo
,
WM_GETTEXT
,
sizeof
(
edit
),
(
LPARAM
)
edit
);
todo_wine
ok
(
strcmp
(
edit
,
"A"
)
==
0
,
"Unexpected text retrieved %s
\n
"
,
edit
);
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
1
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
1
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
/* Now what happens when it gets more focus a second time - it doesnt reselect */
SendMessage
(
hCombo
,
WM_SETFOCUS
,
0
,
(
LPARAM
)
hEdit
);
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
1
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
1
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
DestroyWindow
(
hCombo
);
/* Start again - Build a combo */
hCombo
=
build_combo
(
CBS_SIMPLE
);
cbInfo
.
cbSize
=
sizeof
(
COMBOBOXINFO
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetComboBoxInfo
(
hCombo
,
&
cbInfo
);
ok
(
ret
,
"Failed to get combobox info structure. LastError=%d
\n
"
,
GetLastError
());
hEdit
=
cbInfo
.
hwndItem
;
/* Set some text and give focus so it gets selected */
edit
[
0
]
=
0x00
;
SendMessage
(
hCombo
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"Jason2"
);
SendMessage
(
hCombo
,
WM_GETTEXT
,
sizeof
(
edit
),
(
LPARAM
)
edit
);
ok
(
strcmp
(
edit
,
"Jason2"
)
==
0
,
"Unexpected text retrieved %s
\n
"
,
edit
);
SendMessage
(
hCombo
,
WM_SETFOCUS
,
0
,
(
LPARAM
)
hEdit
);
/* Now what is the selection */
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
(
WPARAM
)
&
start
,
(
WPARAM
)
&
end
);
len
=
SendMessage
(
hCombo
,
CB_GETEDITSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
todo_wine
ok
(
HIWORD
(
len
)
==
6
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
/* Now change the selection to the apparently invalid start -1, end -1 and
show it means no selection (ie start -1) but cursor at end */
SendMessage
(
hCombo
,
CB_SETEDITSEL
,
0
,
-
1
);
edit
[
0
]
=
0x00
;
SendMessage
(
hCombo
,
WM_CHAR
,
'A'
,
0x1c0001
);
SendMessage
(
hCombo
,
WM_GETTEXT
,
sizeof
(
edit
),
(
LPARAM
)
edit
);
todo_wine
ok
(
strcmp
(
edit
,
"Jason2A"
)
==
0
,
"Unexpected text retrieved %s
\n
"
,
edit
);
DestroyWindow
(
hCombo
);
}
START_TEST
(
combo
)
START_TEST
(
combo
)
{
{
hMainWnd
=
CreateWindow
(
"static"
,
"Test"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
300
,
300
,
NULL
,
NULL
,
NULL
,
0
);
hMainWnd
=
CreateWindow
(
"static"
,
"Test"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
300
,
300
,
NULL
,
NULL
,
NULL
,
0
);
...
@@ -414,6 +514,7 @@ START_TEST(combo)
...
@@ -414,6 +514,7 @@ START_TEST(combo)
test_WM_LBUTTONDOWN
();
test_WM_LBUTTONDOWN
();
test_changesize
(
CBS_DROPDOWN
);
test_changesize
(
CBS_DROPDOWN
);
test_changesize
(
CBS_DROPDOWNLIST
);
test_changesize
(
CBS_DROPDOWNLIST
);
test_editselection
();
DestroyWindow
(
hMainWnd
);
DestroyWindow
(
hMainWnd
);
}
}
dlls/user32/tests/edit.c
View file @
0641192b
...
@@ -869,6 +869,14 @@ static void test_edit_control_3(void)
...
@@ -869,6 +869,14 @@ static void test_edit_control_3(void)
ok
(
lstrlenA
(
str
)
==
len
,
"text shouldn't have been truncated
\n
"
);
ok
(
lstrlenA
(
str
)
==
len
,
"text shouldn't have been truncated
\n
"
);
test_notify
(
1
,
0
,
1
);
test_notify
(
1
,
0
,
1
);
len
=
SendMessageA
(
hWnd
,
EM_GETSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
0
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
SendMessage
(
hParent
,
WM_SETFOCUS
,
0
,
(
LPARAM
)
hWnd
);
len
=
SendMessageA
(
hWnd
,
EM_GETSEL
,
0
,
0
);
ok
(
LOWORD
(
len
)
==
0
,
"Unexpected start position for selection %d
\n
"
,
LOWORD
(
len
));
ok
(
HIWORD
(
len
)
==
0
,
"Unexpected end position for selection %d
\n
"
,
HIWORD
(
len
));
SendMessageA
(
hWnd
,
EM_SETLIMITTEXT
,
5
,
0
);
SendMessageA
(
hWnd
,
EM_SETLIMITTEXT
,
5
,
0
);
SendMessageA
(
hWnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
""
);
SendMessageA
(
hWnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
""
);
...
...
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