Finish up edit field accessibility.
This commit is contained in:
1 parent
6f6d4040c4
commit
c5657ee5d4
9 files changed
+361
-39
No files matched your search
+70
-3
@@ -17,6 +17,7 @@ static void key(UINT key, BOOL control, BOOL shift) {
|
||||
|
||||
static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM lp) {
|
||||
if (message == WM_TIMER) {
|
||||
if (step == 0) SetTimer(window, 1, 350, NULL);
|
||||
switch (++step) {
|
||||
case 1: key(VK_RIGHT, FALSE, FALSE); break;
|
||||
case 2: key(VK_RIGHT, TRUE, FALSE); break;
|
||||
@@ -47,8 +48,63 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
|
||||
SetFocus(password); SetFocus(editor);
|
||||
break;
|
||||
case 19: key(VK_DELETE, FALSE, FALSE); break;
|
||||
default:
|
||||
case 20:
|
||||
if (GetWindowTextLengthW(editor) != 7) ExitProcess(2);
|
||||
SendMessageW(editor, EM_SETREADONLY, FALSE, 0);
|
||||
SetWindowTextW(editor, L"hello\r\nmenu return line");
|
||||
SendMessageW(editor, EM_SETSEL, 0, 0);
|
||||
break;
|
||||
case 21:
|
||||
key(VK_RIGHT, FALSE, FALSE);
|
||||
key(VK_RIGHT, FALSE, FALSE);
|
||||
key(VK_RIGHT, FALSE, FALSE);
|
||||
break;
|
||||
case 22:
|
||||
SendMessageW(editor, EM_SETSEL, 7, 7);
|
||||
SendMessageW(window, WM_MENUSELECT, MAKEWPARAM(1, 0), (LPARAM)GetMenu(window));
|
||||
break;
|
||||
case 23: SendMessageW(window, WM_EXITMENULOOP, 0, 0); break;
|
||||
case 24:
|
||||
// Replacement with shorter text is not a Delete/Backspace command.
|
||||
SendMessageW(editor, EM_SETSEL, 0, 5);
|
||||
SendMessageW(editor, EM_REPLACESEL, TRUE, (LPARAM)L"hi");
|
||||
break;
|
||||
case 25:
|
||||
SetWindowTextW(editor, L"first\r\nsecond");
|
||||
SendMessageW(editor, EM_SETSEL, 7, 7);
|
||||
SendMessageW(editor, WM_CHAR, VK_BACK, 1);
|
||||
break;
|
||||
case 26:
|
||||
SetWindowTextW(editor, L"first\r\nsecond");
|
||||
SendMessageW(editor, EM_SETSEL, 5, 5);
|
||||
key(VK_DELETE, FALSE, FALSE);
|
||||
break;
|
||||
case 27:
|
||||
// A surrogate at the 1023-unit line boundary must not discard the line.
|
||||
{
|
||||
WCHAR line[1027];
|
||||
for (int i = 0; i < 1022; ++i) line[i] = L'x';
|
||||
line[1022] = 0xd83d; line[1023] = 0xde00;
|
||||
line[1024] = L'y'; line[1025] = 0;
|
||||
SetWindowTextW(editor, line);
|
||||
SendMessageW(editor, EM_SETSEL, 0, 0);
|
||||
SetFocus(password); SetFocus(editor);
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
SetWindowTextW(editor, L"undo restored");
|
||||
SendMessageW(editor, EM_SETSEL, 0, 4);
|
||||
SendMessageW(editor, EM_REPLACESEL, TRUE, (LPARAM)L"x");
|
||||
SendMessageW(editor, EM_UNDO, 0, 0);
|
||||
SendMessageW(editor, EM_SETSEL, 1, 1);
|
||||
break;
|
||||
case 29:
|
||||
key(VK_RIGHT, FALSE, FALSE); // d, not the space in the old snapshot
|
||||
break;
|
||||
case 30:
|
||||
key(VK_END, TRUE, FALSE); // whole restored line
|
||||
break;
|
||||
default:
|
||||
DestroyWindow(window); break;
|
||||
}
|
||||
return 0;
|
||||
@@ -65,14 +121,25 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show)
|
||||
HWND window = CreateWindowW(cls.lpszClassName, L"Wine editor fixture", WS_OVERLAPPEDWINDOW,
|
||||
120, 120, 500, 300, NULL, NULL, instance, NULL);
|
||||
editor = CreateWindowW(L"Edit", L"alpha beta\r\nsecond line",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL,
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
|
||||
10, 10, 450, 150, window, NULL, instance, NULL);
|
||||
password = CreateWindowW(L"Edit", L"private-password-fixture",
|
||||
WS_CHILD | WS_VISIBLE | ES_PASSWORD, 10, 180, 300, 30,
|
||||
window, NULL, instance, NULL);
|
||||
HMENU menu = CreateMenu();
|
||||
AppendMenuW(menu, MF_STRING, 1, L"Test menu");
|
||||
SetMenu(window, menu);
|
||||
ShowWindow(window, SW_SHOW); SetForegroundWindow(window); SetFocus(editor);
|
||||
SendMessageW(editor, EM_SETSEL, 0, 0);
|
||||
SetTimer(window, 1, 350, NULL);
|
||||
WCHAR ready[1024];
|
||||
if (GetEnvironmentVariableW(L"WINE_ACCESS_FIXTURE_READY", ready, 1024)) {
|
||||
HANDLE file = CreateFileW(ready, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE) return 2;
|
||||
CloseHandle(file);
|
||||
}
|
||||
// Leave time to attach/restart a helper while this already-focused window
|
||||
// keeps pumping messages. Subsequent actions use the ordinary short timer.
|
||||
SetTimer(window, 1, 1500, NULL);
|
||||
MSG message;
|
||||
while (GetMessageW(&message, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&message); DispatchMessageW(&message);
|
||||
|
||||
Reference in new issue
Block a user