Merge branch 'dev_edit_passwd1' into 'master'

user32/edit: multiple edits control also can set passwords.

See merge request wine/wine!6750
This commit is contained in:
Haoyang Chen 2024-11-19 08:26:38 +00:00
commit cbf8ac7db3
2 changed files with 63 additions and 7 deletions

View file

@ -387,10 +387,15 @@ static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef(EDITSTATE *es, HD
tabdef.pTabStops = es->tabs; tabdef.pTabStops = es->tabs;
tabdef.iTabOrigin = 0; tabdef.iTabOrigin = 0;
hr = ScriptStringAnalyse(udc, &es->text[index], line_def->net_length, if (es->style & ES_PASSWORD)
(1.5*line_def->net_length+16), -1, hr = ScriptStringAnalyse(udc, &es->password_char, line_def->net_length,
SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_TAB, -1, (1.5*line_def->net_length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_TAB|SSA_PASSWORD,
NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa); -1, NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
else
hr = ScriptStringAnalyse(udc, &es->text[index], line_def->net_length,
(1.5*line_def->net_length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_TAB,
-1, NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("ScriptStringAnalyse failed (%lx)\n",hr); WARN("ScriptStringAnalyse failed (%lx)\n",hr);
@ -2964,9 +2969,6 @@ static void EDIT_EM_SetPasswordChar(EDITSTATE *es, WCHAR c)
{ {
LONG style; LONG style;
if (es->style & ES_MULTILINE)
return;
if (es->password_char == c) if (es->password_char == c)
return; return;

View file

@ -3474,6 +3474,59 @@ static void test_format_rect(void)
} }
} }
static void test_PASSWORDCHAR(void)
{
HWND hwEdit;
LONG r;
CHAR passwdChar = '#';
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
r = SendMessageA(hwEdit, EM_SETPASSWORDCHAR, passwdChar, 0);
todo_wine ok(r == 1, "Expected: 1, got: %ld\n", r);
r = get_edit_style(hwEdit);
ok(r & ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
r = SendMessageA(hwEdit, EM_GETPASSWORDCHAR, 0, 0);
ok(r == passwdChar, "Expected: 0, got: %ld\n", r);
DestroyWindow (hwEdit);
hwEdit = create_editcontrol(ES_MULTILINE, 0);
r = get_edit_style(hwEdit);
ok(r == ES_MULTILINE, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
r = SendMessageA(hwEdit, EM_SETPASSWORDCHAR, passwdChar, 0);
todo_wine ok(r == 1, "Expected: 1, got: %ld\n", r);
r = get_edit_style(hwEdit);
ok(r == (ES_MULTILINE | ES_PASSWORD), "Wrong style expected ES_MULTILINE|ES_PASSWORD got: 0x%lx\n", r);
if (winetest_interactive)
SetWindowTextA(hwEdit, "TEST");
r = SendMessageA(hwEdit, EM_GETPASSWORDCHAR, 0, 0);
ok(r == passwdChar, "Expected: 0, got: %ld\n", r);
if (winetest_interactive)
{
RedrawWindow(hwEdit, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
Sleep(2000);
}
r = SendMessageA(hwEdit, EM_SETPASSWORDCHAR, 0, 0);
todo_wine ok(r == 1, "Expected: 1, got: %ld\n", r);
r = get_edit_style(hwEdit);
ok(r == ES_MULTILINE, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
r = SendMessageA(hwEdit, EM_GETPASSWORDCHAR, 0, 0);
ok(r == 0, "Expected: 0, got: %ld\n", r);
DestroyWindow (hwEdit);
}
START_TEST(edit) START_TEST(edit)
{ {
BOOL b; BOOL b;
@ -3513,6 +3566,7 @@ START_TEST(edit)
test_wordbreak_proc(); test_wordbreak_proc();
test_dbcs_WM_CHAR(); test_dbcs_WM_CHAR();
test_format_rect(); test_format_rect();
test_PASSWORDCHAR();
UnregisterWindowClasses(); UnregisterWindowClasses();
} }