From 4c86e860e60de954059ddbb09931c52ca1d198f0 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 25 Sep 2020 10:36:17 +0300 Subject: [PATCH] comctl32/tests: Use wide strings literals. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/tests/button.c | 16 +++++----------- dlls/comctl32/tests/combo.c | 6 +++--- dlls/comctl32/tests/dpa.c | 6 ++---- dlls/comctl32/tests/listview.c | 17 +++++------------ dlls/comctl32/tests/misc.c | 13 +++++-------- dlls/comctl32/tests/mru.c | 22 ++++++++++------------ dlls/comctl32/tests/pager.c | 20 ++++++-------------- dlls/comctl32/tests/propsheet.c | 3 +-- dlls/comctl32/tests/syslink.c | 10 +++------- dlls/comctl32/tests/taskdialog.c | 14 +++++--------- dlls/comctl32/tests/toolbar.c | 30 ++++++++++++------------------ dlls/comctl32/tests/tooltips.c | 3 +-- dlls/comctl32/tests/treeview.c | 11 ++++++----- 13 files changed, 64 insertions(+), 107 deletions(-) diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index 716850073ff..93b6ddcec36 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -1014,7 +1014,6 @@ static void test_button_messages(void) static void test_button_class(void) { - static const WCHAR testW[] = {'t','e','s','t',0}; WNDCLASSEXW exW, ex2W; WNDCLASSEXA exA; char buffA[100]; @@ -1055,7 +1054,7 @@ static void test_button_class(void) DestroyWindow(hwnd); /* explicitly create with versioned class name */ - hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL); + hwnd = CreateWindowExW(0, nameW, L"test", BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL); ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW)); len = GetClassNameA(hwnd, buffA, sizeof(buffA)); @@ -1889,12 +1888,6 @@ static void test_bcm_get_ideal_size(void) { static const char *button_text2 = "WWWW\nWWWW"; static const char *button_text = "WWWW"; - static const WCHAR button_note_short[] = { 'W',0 }; - static const WCHAR button_note_long[] = { 'W','W','W','W','W','W','W','W','W','W','W','W','W','W','W','W',0 }; - static const WCHAR button_note_wordy[] = { 'T','h','i','s',' ','i','s',' ','a',' ','l','o','n','g',' ','n','o','t','e',' ','f','o','r',' ','t','h','e',' ','b','u','t','t','o','n',',',' ', - 'w','i','t','h',' ','m','a','n','y',' ','w','o','r','d','s',',',' ','w','h','i','c','h',' ','s','h','o','u','l','d',' ','b','e',' ', - 'o','v','e','r','a','l','l',' ','l','o','n','g','e','r',' ','t','h','a','n',' ','t','h','e',' ','t','e','x','t',' ','(','g','i','v','e','n',' ', - 't','h','e',' ','s','m','a','l','l','e','r',' ','f','o','n','t',')',' ','a','n','d',' ','t','h','u','s',' ','w','r','a','p','.',0 }; static const DWORD imagelist_aligns[] = {BUTTON_IMAGELIST_ALIGN_LEFT, BUTTON_IMAGELIST_ALIGN_RIGHT, BUTTON_IMAGELIST_ALIGN_TOP, BUTTON_IMAGELIST_ALIGN_BOTTOM, BUTTON_IMAGELIST_ALIGN_CENTER}; @@ -2222,7 +2215,7 @@ static void test_bcm_get_ideal_size(void) hwnd = CreateWindowA(WC_BUTTONA, "a", style, 0, 0, client_width, client_height, NULL, NULL, 0, NULL); ok(hwnd != NULL, "Expected hwnd not NULL\n"); SendMessageA(hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); - ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)button_note_short); + ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)L"W"); ok(ret == TRUE, "Expected BCM_SETNOTE to return true\n"); size.cx = 13; size.cy = 0; @@ -2238,7 +2231,7 @@ static void test_bcm_get_ideal_size(void) ok(size.cx > image_width && size.cy == height, "Expected ideal cx %d > %d and ideal cy %d == %d\n", size.cx, image_width, size.cy, height); /* Try longer note without word breaks, shouldn't extend height because no word splitting */ - ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)button_note_long); + ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)L"WWWWWWWWWWWWWWWW"); ok(ret == TRUE, "Expected BCM_SETNOTE to return true\n"); k = size.cx; size.cy = 0; @@ -2254,7 +2247,8 @@ static void test_bcm_get_ideal_size(void) ok(size.cx > k && size.cy == height, "Expected ideal cx %d > %d and ideal cy %d == %d\n", size.cx, k, size.cy, height); /* Use a very long note with words and the same width, should extend the height due to word wrap */ - ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)button_note_wordy); + ret = SendMessageA(hwnd, BCM_SETNOTE, 0, (LPARAM)L"This is a long note for the button with many words, which should " + "be overall longer than the text (given the smaller font) and thus wrap."); ok(ret == TRUE, "Expected BCM_SETNOTE to return true\n"); k = size.cx; ret = SendMessageA(hwnd, BCM_GETIDEALSIZE, 0, (LPARAM)&size); diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 64785326c93..63470a50ff7 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -260,15 +260,15 @@ static void test_comboex_WM_LBUTTONDOWN(void) RECT rect; WCHAR buffer[3]; static const UINT choices[] = {8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72}; - static const WCHAR stringFormat[] = {'%','2','d','\0'}; hComboEx = CreateWindowExA(0, WC_COMBOBOXEXA, NULL, WS_VISIBLE|WS_CHILD|CBS_DROPDOWN, 0, 0, 200, 150, hComboExParentWnd, NULL, hMainHinst, NULL); - for (i = 0; i < ARRAY_SIZE(choices); i++){ + for (i = 0; i < ARRAY_SIZE(choices); i++) + { COMBOBOXEXITEMW cbexItem; - wsprintfW(buffer, stringFormat, choices[i]); + wsprintfW(buffer, L"%2d", choices[i]); memset(&cbexItem, 0x00, sizeof(cbexItem)); cbexItem.mask = CBEIF_TEXT; diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c index 39f6b460e97..2a5eb503d9f 100644 --- a/dlls/comctl32/tests/dpa.c +++ b/dlls/comctl32/tests/dpa.c @@ -538,7 +538,6 @@ static void test_DPA_DestroyCallback(void) static void test_DPA_LoadStream(void) { - static const WCHAR szStg[] = { 'S','t','g',0 }; IStorage* pStg = NULL; IStream* pStm = NULL; LARGE_INTEGER li; @@ -566,7 +565,7 @@ static void test_DPA_LoadStream(void) hRes = StgCreateDocfile(NULL, dwMode|STGM_DELETEONRELEASE, 0, &pStg); expect(S_OK, hRes); - hRes = IStorage_CreateStream(pStg, szStg, dwMode, 0, 0, &pStm); + hRes = IStorage_CreateStream(pStg, L"Stg", dwMode, 0, 0, &pStm); expect(S_OK, hRes); /* write less than header size */ @@ -658,7 +657,6 @@ static void test_DPA_LoadStream(void) static void test_DPA_SaveStream(void) { HDPA dpa; - static const WCHAR szStg[] = { 'S','t','g',0 }; IStorage* pStg = NULL; IStream* pStm = NULL; DWORD dwMode, dw; @@ -685,7 +683,7 @@ static void test_DPA_SaveStream(void) hRes = StgCreateDocfile(NULL, dwMode|STGM_DELETEONRELEASE, 0, &pStg); expect(S_OK, hRes); - hRes = IStorage_CreateStream(pStg, szStg, dwMode, 0, 0, &pStm); + hRes = IStorage_CreateStream(pStg, L"Stg", dwMode, 0, 0, &pStm); expect(S_OK, hRes); dpa = pDPA_Create(0); diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 500cc363c2d..9db3dc6ec44 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -50,9 +50,6 @@ enum seq_index { #define expect2(expected1, expected2, got1, got2) ok(expected1 == got1 && expected2 == got2, \ "expected (%d,%d), got (%d,%d)\n", expected1, expected2, got1, got2) -static const WCHAR testparentclassW[] = - {'L','i','s','t','v','i','e','w',' ','t','e','s','t',' ','p','a','r','e','n','t','W', 0}; - static HWND hwndparent, hwndparentW; /* prevents edit box creation, LVN_BEGINLABELEDIT return value */ static BOOL blockEdit; @@ -555,9 +552,8 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP if (g_disp_A_to_W && (dispinfo->item.mask & LVIF_TEXT)) { - static const WCHAR testW[] = {'T','E','S','T',0}; dispinfo->hdr.code = LVN_GETDISPINFOW; - memcpy(dispinfo->item.pszText, testW, sizeof(testW)); + lstrcpyW((WCHAR *)dispinfo->item.pszText, L"TEST"); } /* test control buffer size for text, 10 used to mask cases when control @@ -618,7 +614,7 @@ static BOOL register_parent_wnd_class(BOOL Unicode) clsW.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW); clsW.hbrBackground = GetStockObject(WHITE_BRUSH); clsW.lpszMenuName = NULL; - clsW.lpszClassName = testparentclassW; + clsW.lpszClassName = L"Listview test parentW"; } else { @@ -639,7 +635,6 @@ static BOOL register_parent_wnd_class(BOOL Unicode) static HWND create_parent_window(BOOL Unicode) { - static const WCHAR nameW[] = {'t','e','s','t','p','a','r','e','n','t','n','a','m','e','W',0}; HWND hwnd; if (!register_parent_wnd_class(Unicode)) @@ -649,7 +644,7 @@ static HWND create_parent_window(BOOL Unicode) notifyFormat = -1; if (Unicode) - hwnd = CreateWindowExW(0, testparentclassW, nameW, + hwnd = CreateWindowExW(0, L"Listview test parentW", L"testparentnameW", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE, 0, 0, 100, 100, @@ -715,10 +710,9 @@ static HWND create_listview_controlW(DWORD style, HWND parent) WNDPROC oldproc; HWND hwnd; RECT rect; - static const WCHAR nameW[] = {'f','o','o',0}; GetClientRect(parent, &rect); - hwnd = CreateWindowExW(0, WC_LISTVIEWW, nameW, + hwnd = CreateWindowExW(0, WC_LISTVIEWW, L"foo", WS_CHILD | WS_BORDER | WS_VISIBLE | style, 0, 0, rect.right, rect.bottom, parent, NULL, GetModuleHandleW(NULL), NULL); @@ -1633,7 +1627,6 @@ static void test_header_presence_(HWND hwnd, BOOL present, int line) static void test_create(BOOL is_version_6) { - static const WCHAR testtextW[] = {'t','e','s','t',' ','t','e','x','t',0}; char buff[16]; HWND hList; HWND hHeader; @@ -1822,7 +1815,7 @@ todo_wine_if(is_version_6) ok(!strcmp(buff, "test text"), "Unexpected window text %s.\n", buff); DestroyWindow(hList); - hList = CreateWindowExW(0, WC_LISTVIEWW, testtextW, WS_CHILD | WS_BORDER | WS_VISIBLE, + hList = CreateWindowExW(0, WC_LISTVIEWW, L"test text", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 100, 100, hwndparent, NULL, GetModuleHandleA(NULL), NULL); ok(hList != NULL, "Failed to create ListView window.\n"); *buff = 0; diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index c027852047a..a3ba2028873 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -202,9 +202,6 @@ static void test_Alloc(void) static void test_LoadIconWithScaleDown(void) { - static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0}; - static const WCHAR nonexisting_resourceW[] = {'N','o','n','e','x','i','s','t','i','n','g',0}; - static const WCHAR prefixW[] = {'I','C','O',0}; HRESULT (WINAPI *pLoadIconMetric)(HINSTANCE, const WCHAR *, int, HICON *); HRESULT (WINAPI *pLoadIconWithScaleDown)(HINSTANCE, const WCHAR *, int, int, HICON *); WCHAR tmp_path[MAX_PATH], icon_path[MAX_PATH]; @@ -230,7 +227,7 @@ static void test_LoadIconWithScaleDown(void) } GetTempPathW(MAX_PATH, tmp_path); - GetTempFileNameW(tmp_path, prefixW, 0, icon_path); + GetTempFileNameW(tmp_path, L"ICO", 0, icon_path); handle = CreateFileW(icon_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(handle != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError()); @@ -264,21 +261,21 @@ static void test_LoadIconWithScaleDown(void) ok(icon == NULL, "Expected NULL, got %p\n", icon); /* non-existing filename */ - hr = pLoadIconMetric(NULL, nonexisting_fileW, LIM_LARGE, &icon); + hr = pLoadIconMetric(NULL, L"nonexisting.ico", LIM_LARGE, &icon); ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND) || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* Win7 */, "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); - hr = pLoadIconWithScaleDown(NULL, nonexisting_fileW, 32, 32, &icon); + hr = pLoadIconWithScaleDown(NULL, L"nonexisting.ico", 32, 32, &icon); todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); /* non-existing resource name */ - hr = pLoadIconMetric(hinst, nonexisting_resourceW, LIM_LARGE, &icon); + hr = pLoadIconMetric(hinst, L"Nonexisting", LIM_LARGE, &icon); ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); - hr = pLoadIconWithScaleDown(hinst, nonexisting_resourceW, 32, 32, &icon); + hr = pLoadIconWithScaleDown(hinst, L"Noneexisting", 32, 32, &icon); ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); diff --git a/dlls/comctl32/tests/mru.c b/dlls/comctl32/tests/mru.c index b3d3e7a265b..87677b33902 100644 --- a/dlls/comctl32/tests/mru.c +++ b/dlls/comctl32/tests/mru.c @@ -545,7 +545,6 @@ static void test_AddMRUData(void) static void test_CreateMRUListW(void) { - static const WCHAR mrutestW[] = {'M','R','U','T','e','s','t',0}; MRUINFOW infoW; void *named; HKEY hKey; @@ -568,7 +567,7 @@ static void test_CreateMRUListW(void) infoW.cbSize = sizeof(infoW); infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -580,7 +579,7 @@ static void test_CreateMRUListW(void) infoW.cbSize = sizeof(infoW) - 1; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -592,7 +591,7 @@ static void test_CreateMRUListW(void) infoW.cbSize = sizeof(infoW) + 1; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -604,7 +603,7 @@ static void test_CreateMRUListW(void) infoW.cbSize = 0; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -616,7 +615,7 @@ static void test_CreateMRUListW(void) infoW.cbSize = sizeof(infoW); infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = NULL; infoW.lpfnCompare = NULL; @@ -628,7 +627,6 @@ static void test_CreateMRUListW(void) static void test_CreateMRUListLazyW(void) { - static const WCHAR mrutestW[] = {'M','R','U','T','e','s','t',0}; MRUINFOW infoW; void *named; HKEY hKey; @@ -650,7 +648,7 @@ static void test_CreateMRUListLazyW(void) infoW.cbSize = sizeof(infoW); infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -662,7 +660,7 @@ static void test_CreateMRUListLazyW(void) infoW.cbSize = sizeof(infoW) - 1; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -674,7 +672,7 @@ static void test_CreateMRUListLazyW(void) infoW.cbSize = sizeof(infoW) + 1; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -686,7 +684,7 @@ static void test_CreateMRUListLazyW(void) infoW.cbSize = 0; infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = hKey; infoW.lpfnCompare = NULL; @@ -698,7 +696,7 @@ static void test_CreateMRUListLazyW(void) infoW.cbSize = sizeof(infoW); infoW.uMax = 1; infoW.fFlags = 0; - infoW.lpszSubKey = mrutestW; + infoW.lpszSubKey = L"MRUTest"; infoW.hKey = NULL; infoW.lpfnCompare = NULL; diff --git a/dlls/comctl32/tests/pager.c b/dlls/comctl32/tests/pager.c index fba3cb8bef3..a4d6a658cda 100644 --- a/dlls/comctl32/tests/pager.c +++ b/dlls/comctl32/tests/pager.c @@ -529,23 +529,16 @@ static LRESULT WINAPI test_notifyformat_proc(HWND hwnd, UINT message, WPARAM wPa static BOOL register_notifyformat_class(void) { - static const WCHAR class_w[] = {'P', 'a', 'g', 'e', 'r', ' ', 'n', 'o', 't', 'i', 'f', 'y', 'f', - 'o', 'r', 'm', 'a', 't', ' ', 'c', 'l', 'a', 's', 's', 0}; WNDCLASSW cls = {0}; cls.lpfnWndProc = test_notifyformat_proc; cls.hInstance = GetModuleHandleW(NULL); - cls.lpszClassName = class_w; + cls.lpszClassName = L"Pager notifyformat class"; return RegisterClassW(&cls); } static void test_wm_notifyformat(void) { - static const WCHAR class_w[] = {'P', 'a', 'g', 'e', 'r', ' ', 'n', 'o', 't', 'i', 'f', 'y', 'f', - 'o', 'r', 'm', 'a', 't', ' ', 'c', 'l', 'a', 's', 's', 0}; - static const WCHAR parent_w[] = {'p', 'a', 'r', 'e', 'n', 't', 0}; - static const WCHAR pager_w[] = {'p', 'a', 'g', 'e', 'r', 0}; - static const WCHAR child_w[] = {'c', 'h', 'i', 'l', 'd', 0}; static const INT formats[] = {NFR_UNICODE, NFR_ANSI}; HWND parent, pager, child; LRESULT ret; @@ -558,11 +551,11 @@ static void test_wm_notifyformat(void) for (i = 0; i < ARRAY_SIZE(formats); i++) { notify_format = formats[i]; - parent = CreateWindowW(class_w, parent_w, WS_OVERLAPPED, 0, 0, 100, 100, 0, 0, GetModuleHandleW(0), 0); + parent = CreateWindowW(L"Pager notifyformat class", L"parent", WS_OVERLAPPED, 0, 0, 100, 100, 0, 0, GetModuleHandleW(0), 0); ok(parent != NULL, "CreateWindow failed\n"); - pager = CreateWindowW(WC_PAGESCROLLERW, pager_w, WS_CHILD, 0, 0, 100, 100, parent, 0, GetModuleHandleW(0), 0); + pager = CreateWindowW(WC_PAGESCROLLERW, L"pager", WS_CHILD, 0, 0, 100, 100, parent, 0, GetModuleHandleW(0), 0); ok(pager != NULL, "CreateWindow failed\n"); - child = CreateWindowW(class_w, child_w, WS_CHILD, 0, 0, 100, 100, pager, 0, GetModuleHandleW(0), 0); + child = CreateWindowW(L"Pager notifyformat class", L"child", WS_CHILD, 0, 0, 100, 100, pager, 0, GetModuleHandleW(0), 0); ok(child != NULL, "CreateWindow failed\n"); SendMessageW(pager, PGM_SETCHILD, 0, (LPARAM)child); @@ -593,7 +586,7 @@ static void test_wm_notifyformat(void) DestroyWindow(parent); } - UnregisterClassW(class_w, GetModuleHandleW(NULL)); + UnregisterClassW(L"Pager notifyformat class", GetModuleHandleW(NULL)); } static void notify_generic_text_handler(CHAR **text, INT *text_max) @@ -685,7 +678,6 @@ static void notify_datetime_handler(NMDATETIMEFORMATA *nm) static LRESULT WINAPI test_notify_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static const WCHAR test[] = {'t', 'e', 's', 't', 0}; switch (message) { case WM_NOTIFY: @@ -895,7 +887,7 @@ static LRESULT WINAPI test_notify_proc(HWND hwnd, UINT message, WPARAM wParam, L } notify_test_info.received = TRUE; ok(!lstrcmpA(test_a, "test"), "test_a got modified\n"); - ok(!lstrcmpW(test_w, test), "test_w got modified\n"); + ok(!lstrcmpW(test_w, L"test"), "test_w got modified\n"); return 0; } case WM_NOTIFYFORMAT: diff --git a/dlls/comctl32/tests/propsheet.c b/dlls/comctl32/tests/propsheet.c index ea9b4a8e626..9acdea85c66 100644 --- a/dlls/comctl32/tests/propsheet.c +++ b/dlls/comctl32/tests/propsheet.c @@ -1077,7 +1077,6 @@ static UINT CALLBACK proppage_callback_w(HWND hwnd, UINT msg, PROPSHEETPAGEW *ps static void test_CreatePropertySheetPage(void) { - static const WCHAR titleW[] = {'T','i','t','l','e',0}; struct custom_proppage page; HPROPSHEETPAGE hpsp; BOOL ret; @@ -1117,7 +1116,7 @@ static void test_CreatePropertySheetPage(void) page.u.pageW.pfnDlgProc = page_dlg_proc_messages; page.u.pageW.pfnCallback = proppage_callback_w; page.u.pageW.lParam = (LPARAM)&page; - page.u.pageW.pszTitle = titleW; + page.u.pageW.pszTitle = L"Title"; for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++) { diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index a6b90b6a25b..7f3e19fc670 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -106,8 +106,6 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP return ret; } -static const WCHAR parentClassW[] = {'S','y','s','l','i','n','k',' ','t','e','s','t',' ','p','a','r','e','n','t',' ','c','l','a','s','s',0}; - static BOOL register_parent_wnd_class(void) { WNDCLASSW cls; @@ -121,17 +119,16 @@ static BOOL register_parent_wnd_class(void) cls.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); cls.hbrBackground = GetStockObject(WHITE_BRUSH); cls.lpszMenuName = NULL; - cls.lpszClassName = parentClassW; + cls.lpszClassName = L"Syslink test parent class"; return RegisterClassW(&cls); } static HWND create_parent_window(void) { - static const WCHAR titleW[] = {'S','y','s','l','i','n','k',' ','t','e','s','t',' ','p','a','r','e','n','t',' ','w','i','n','d','o','w',0}; if (!register_parent_wnd_class()) return NULL; - return CreateWindowExW(0, parentClassW, titleW, + return CreateWindowExW(0, L"Syslink test parent class", L"Syslink test parent window", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE, 0, 0, 200, 100, GetDesktopWindow(), @@ -163,10 +160,9 @@ static LRESULT WINAPI syslink_subclass_proc(HWND hwnd, UINT message, WPARAM wPar static HWND create_syslink(DWORD style, HWND parent) { HWND hWndSysLink; - static const WCHAR linkW[] = {'H','e','a','d',' ','<','a',' ','h','r','e','f','=','"','l','i','n','k','1','"','>','N','a','m','e','1','<','/','a','>',' ','M','i','d','d','l','e',' ','<','a',' ','h','r','e','f','=','"','l','i','n','k','2','"','>','N','a','m','e','2','<','/','a','>',' ','T','a','i','l',0}; /* Only Unicode will do here */ - hWndSysLink = CreateWindowExW(0, WC_LINK, linkW, + hWndSysLink = CreateWindowExW(0, WC_LINK, L"Head Name1 Middle Name2 Tail", style, 0, 0, 150, 50, parent, NULL, GetModuleHandleW(NULL), NULL); if (!hWndSysLink) return NULL; diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c index d25c67f7bc5..9c0b8772a59 100644 --- a/dlls/comctl32/tests/taskdialog.c +++ b/dlls/comctl32/tests/taskdialog.c @@ -489,7 +489,6 @@ static void test_buttons(void) TASKDIALOGCONFIG info = {0}; static const DWORD command_link_flags[] = {0, TDF_USE_COMMAND_LINKS, TDF_USE_COMMAND_LINKS_NO_ICON}; TASKDIALOG_BUTTON custom_buttons[TEST_NUM_BUTTONS], radio_buttons[TEST_NUM_RADIO_BUTTONS]; - const WCHAR button_format[] = {'%','0','2','d',0}; /* Each button has two digits as title, plus null-terminator */ WCHAR button_titles[TEST_NUM_BUTTONS * 3], radio_button_titles[TEST_NUM_BUTTONS * 3]; int i; @@ -502,7 +501,7 @@ static void test_buttons(void) for (i = 0; i < TEST_NUM_BUTTONS; i++) { WCHAR *text = &button_titles[i * 3]; - wsprintfW(text, button_format, i); + wsprintfW(text, L"%02d", i); custom_buttons[i].pszButtonText = text; custom_buttons[i].nButtonID = ID_START_BUTTON + i; @@ -513,7 +512,7 @@ static void test_buttons(void) for (i = 0; i < TEST_NUM_RADIO_BUTTONS; i++) { WCHAR *text = &radio_button_titles[i * 3]; - wsprintfW(text, button_format, i); + wsprintfW(text, L"%02d", i); radio_buttons[i].pszButtonText = text; radio_buttons[i].nButtonID = ID_START_RADIO_BUTTON + i; @@ -779,7 +778,6 @@ static void test_progress_bar(void) static void test_verification_box(void) { TASKDIALOGCONFIG info = {0}; - WCHAR textW[] = {'t', 'e', 'x', 't', 0}; info.cbSize = sizeof(TASKDIALOGCONFIG); info.pfCallback = taskdialog_callback_proc; @@ -792,7 +790,7 @@ static void test_verification_box(void) info.dwFlags = TDF_VERIFICATION_FLAG_CHECKED; run_test(&info, IDOK, 0, FALSE, msg_return_default_verification_checked, "default verification box: checked"); - info.pszVerificationText = textW; + info.pszVerificationText = L"text"; run_test(&info, IDOK, 0, FALSE, msg_return_default_verification_unchecked, "default verification box: unchecked"); info.dwFlags = TDF_VERIFICATION_FLAG_CHECKED; @@ -809,8 +807,6 @@ static void test_verification_box(void) static void test_navigate_page(void) { TASKDIALOGCONFIG info = {0}; - static const WCHAR textW[] = {'t', 'e', 'x', 't', 0}; - static const WCHAR button_format[] = {'%', '0', '2', 'd', 0}; TASKDIALOG_BUTTON radio_buttons[TEST_NUM_RADIO_BUTTONS]; WCHAR radio_button_titles[TEST_NUM_BUTTONS * 3]; int i; @@ -819,7 +815,7 @@ static void test_navigate_page(void) for (i = 0; i < TEST_NUM_RADIO_BUTTONS; i++) { WCHAR *text = &radio_button_titles[i * 3]; - wsprintfW(text, button_format, i); + wsprintfW(text, L"%02d", i); radio_buttons[i].pszButtonText = text; radio_buttons[i].nButtonID = ID_START_RADIO_BUTTON + i; @@ -833,7 +829,7 @@ static void test_navigate_page(void) info.pRadioButtons = radio_buttons; navigated_info = info; - navigated_info.pszVerificationText = textW; + navigated_info.pszVerificationText = L"text"; navigated_info.dwFlags = TDF_VERIFICATION_FLAG_CHECKED; run_test(&info, IDOK, ID_START_RADIO_BUTTON, TRUE, msg_return_navigated_page, "navigate page: default"); diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index b1ac1cd8bf2..b7e03c3e378 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -1992,8 +1992,6 @@ static void test_getstring(void) HWND hToolbar = NULL; char str[10]; WCHAR strW[10]; - static const char answer[] = "STR"; - static const WCHAR answerW[] = { 'S','T','R',0 }; INT r; hToolbar = CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hMainWnd, (HMENU)5, GetModuleHandleA(NULL), NULL); @@ -2009,18 +2007,17 @@ static void test_getstring(void) expect(-1, r); r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0); expect(-1, r); - r = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)answer); + r = SendMessageA(hToolbar, TB_ADDSTRINGA, 0, (LPARAM)"STR"); expect(0, r); r = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(0, 0), 0); - expect(lstrlenA(answer), r); + ok(r == 3, "Unexpected return value %d.\n", r); r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), 0); - expect(lstrlenA(answer), r); + ok(r == 3, "Unexpected return value %d.\n", r); r = SendMessageA(hToolbar, TB_GETSTRINGA, MAKEWPARAM(sizeof(str), 0), (LPARAM)str); - expect(lstrlenA(answer), r); - expect(0, lstrcmpA(answer, str)); + ok(r == 3, "Unexpected return value %d.\n", r); r = SendMessageW(hToolbar, TB_GETSTRINGW, MAKEWPARAM(sizeof(strW), 0), (LPARAM)strW); - expect(lstrlenA(answer), r); - expect(0, lstrcmpW(answerW, strW)); + ok(r == 3, "Unexpected return value %d.\n", r); + ok(!lstrcmpW(L"STR", strW), "Unexpected string %s.\n", wine_dbgstr_w(strW)); DestroyWindow(hToolbar); } @@ -2387,9 +2384,6 @@ static void test_save(void) { HWND wnd = NULL; TBSAVEPARAMSW params; - static const WCHAR subkey[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', - 'W','i','n','e','T','e','s','t',0}; - static const WCHAR value[] = {'t','o','o','l','b','a','r','t','e','s','t',0}; LONG res; HKEY key; BYTE data[100]; @@ -2420,8 +2414,8 @@ static void test_save(void) }; params.hkr = HKEY_CURRENT_USER; - params.pszSubKey = subkey; - params.pszValueName = value; + params.pszSubKey = L"Software\\Wine\\WineTest"; + params.pszValueName = L"toolbartest"; rebuild_toolbar_with_buttons( &wnd ); SendMessageW(wnd, TB_ADDBUTTONSW, ARRAY_SIZE(more_btns), (LPARAM)more_btns); @@ -2432,9 +2426,9 @@ static void test_save(void) ok_sequence(sequences, PARENT_SEQ_INDEX, save_parent_seq, "save", FALSE); DestroyWindow( wnd ); - res = RegOpenKeyW( HKEY_CURRENT_USER, subkey, &key ); + res = RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\WineTest", &key ); ok( !res, "got %08x\n", res ); - res = RegQueryValueExW( key, value, NULL, &type, data, &size ); + res = RegQueryValueExW( key, L"toolbartest", NULL, &type, data, &size ); ok( !res, "got %08x\n", res ); ok( type == REG_BINARY, "got %08x\n", type ); ok( size == sizeof(expect), "got %08x\n", size ); @@ -2474,8 +2468,8 @@ static void test_save(void) } DestroyWindow( wnd ); - RegOpenKeyW( HKEY_CURRENT_USER, subkey, &key ); - RegDeleteValueW( key, value ); + RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\WineTest", &key ); + RegDeleteValueW( key, L"toolbartest" ); RegCloseKey( key ); } diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 6156bffa13b..639d51f7c28 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -1106,7 +1106,6 @@ static void test_margin(void) static void test_TTM_ADDTOOL(BOOL is_v6) { - static const WCHAR testW[] = {'T','e','s','t',0}; TTTOOLINFOW tiW; TTTOOLINFOA ti; int ret, size; @@ -1153,7 +1152,7 @@ static void test_TTM_ADDTOOL(BOOL is_v6) tiW.hinst = GetModuleHandleA(NULL); tiW.uFlags = 0; tiW.uId = 0x1234abce; - tiW.lpszText = (LPWSTR)testW; + tiW.lpszText = (LPWSTR)L"Test"; tiW.lParam = 0xdeadbeef; GetClientRect(hwnd, &tiW.rect); diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index fac8e8b6b82..02d914c249c 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -1285,15 +1285,16 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, break; case TVN_GETDISPINFOA: { NMTVDISPINFOA *disp = (NMTVDISPINFOA *)lParam; + NMTVDISPINFOW *dispW = (NMTVDISPINFOW *)lParam; + if (disp->item.mask & TVIF_TEXT) { lstrcpynA(disp->item.pszText, TEST_CALLBACK_TEXT, disp->item.cchTextMax); } - if (g_disp_A_to_W && (disp->item.mask & TVIF_TEXT)) { - static const WCHAR testW[] = {'T','E','S','T','2',0}; - - disp->hdr.code = TVN_GETDISPINFOW; - memcpy(disp->item.pszText, testW, sizeof(testW)); + if (g_disp_A_to_W && (dispW->item.mask & TVIF_TEXT)) + { + dispW->hdr.code = TVN_GETDISPINFOW; + lstrcpyW(dispW->item.pszText, L"TEST2"); } if (g_disp_set_stateimage)