From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/tests/misc.c | 6 ------ dlls/comctl32/tests/toolbar.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 4e33a4cc8dd..29ba90cffb2 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -1402,12 +1402,6 @@ static void test_CCM_SETVERSION(BOOL v6) ok(lr == (j == 0 ? 0 : (j - 1)), "Got unexpected %Id.\n", lr); }
- if (!strcmp(class_names[i], TOOLBARCLASSNAMEA)) - { - lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0); - ok(lr == 0, "Got unexpected %Id.\n", lr); - } - winetest_pop_context(); }
diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index ba2720ac0b4..81f54d7b633 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -2940,6 +2940,25 @@ static void test_WM_NOTIFY(void) DestroyWindow(toolbar); }
+static void test_unicode_format(void) +{ + HWND hwnd = NULL; + LRESULT lr; + + rebuild_toolbar(&hwnd); + + /* Test that CCM_SETVERSION shouldn't change the Unicode character format flag for the control */ + SendMessageA(hwnd, CCM_SETVERSION, 5, 0); + lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0); + ok(lr == 0, "Got unexpected %Id.\n", lr); + + SendMessageA(hwnd, CCM_SETVERSION, 6, 0); + lr = SendMessageA(hwnd, TB_GETUNICODEFORMAT, 0, 0); + ok(lr == 0, "Got unexpected %Id.\n", lr); + + DestroyWindow(hwnd); +} + START_TEST(toolbar) { ULONG_PTR ctx_cookie; @@ -2992,6 +3011,7 @@ START_TEST(toolbar) test_imagelist(); test_BTNS_SEP(); test_WM_NOTIFY(); + test_unicode_format();
if (!load_v6_module(&ctx_cookie, &ctx)) return; @@ -2999,6 +3019,7 @@ START_TEST(toolbar) test_create(TRUE); test_visual(); test_BTNS_SEP(); + test_unicode_format();
PostQuitMessage(0); while(GetMessageA(&msg,0,0,0)) {
From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/comctl32/comctl32.h | 1 + dlls/comctl32/commctrl.c | 17 +++++++++++++++++ dlls/comctl32/listview.c | 19 +++---------------- dlls/comctl32/rebar.c | 15 +-------------- dlls/comctl32/toolbar.c | 12 +----------- 5 files changed, 23 insertions(+), 41 deletions(-)
diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index 425a34f866b..5dadb9aae6e 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -191,6 +191,7 @@ void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground); void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm); BOOL COMCTL32_IsReflectedMessage(UINT uMsg); +LRESULT COMCTL32_SetVersion(INT *current_version, INT new_verison); INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); INT Str_GetPtrAtoW(LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen); BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc); diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c index f649e2c0a1b..cad1963586c 100644 --- a/dlls/comctl32/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -3104,3 +3104,20 @@ LRESULT COMCTL32_forward_notify_to_ansi_window(HWND hwnd_notify, NMHDR *hdr, WCH /* Other notifications, no need to convert */ return SendMessageW(hwnd_notify, WM_NOTIFY, hdr->idFrom, (LPARAM)hdr); } + +/* A helper to handle CCM_SETVERSION messages */ +LRESULT COMCTL32_SetVersion(INT *current_version, INT new_verison) +{ +#if __WINE_COMCTL32_VERSION == 6 + return *current_version; +#else + INT old_version; + + if (new_verison > 5) + return -1; + + old_version = *current_version; + *current_version = new_verison; + return old_version; +#endif +} diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index c954ac221ff..7f51838f000 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -327,7 +327,7 @@ typedef struct tagLISTVIEW_INFO BOOL redraw; /* WM_SETREDRAW switch */
/* misc */ - DWORD iVersion; /* CCM_[G,S]ETVERSION */ + INT iVersion; /* CCM_[G,S]ETVERSION */ } LISTVIEW_INFO;
/* @@ -11441,22 +11441,9 @@ static inline LRESULT LISTVIEW_GetVersion(const LISTVIEW_INFO *infoPtr) * -1 when requested version is greater than DLL version; * previous version otherwise */ -static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, DWORD iVersion) +static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, INT iVersion) { -#if __WINE_COMCTL32_VERSION == 6 - return infoPtr->iVersion; -#else - INT iOldVersion = infoPtr->iVersion; - - if (iVersion > 5) - return -1; - - infoPtr->iVersion = iVersion; - - TRACE("new version %ld\n", iVersion); - - return iOldVersion; -#endif + return COMCTL32_SetVersion(&infoPtr->iVersion, iVersion); }
/*** diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 51f13db3aa9..2ce19eb4f19 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -2862,20 +2862,7 @@ REBAR_SetUnicodeFormat (REBAR_INFO *infoPtr, BOOL unicode) static LRESULT REBAR_SetVersion (REBAR_INFO *infoPtr, INT iVersion) { -#if __WINE_COMCTL32_VERSION == 6 - return infoPtr->iVersion; -#else - INT iOldVersion = infoPtr->iVersion; - - if (iVersion > 5) - return -1; - - infoPtr->iVersion = iVersion; - - TRACE("new version %d\n", iVersion); - - return iOldVersion; -#endif + return COMCTL32_SetVersion(&infoPtr->iVersion, iVersion); }
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 2c5ce1a7840..05dcdd7e37b 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -5117,17 +5117,7 @@ TOOLBAR_SetColorScheme (TOOLBAR_INFO *infoPtr, const COLORSCHEME *lParam) static LRESULT TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion) { -#if __WINE_COMCTL32_VERSION == 6 - return infoPtr->iVersion; -#else - INT iOldVersion = infoPtr->iVersion; - - if (iVersion > 5) - return -1; - - infoPtr->iVersion = iVersion; - return iOldVersion; -#endif + return COMCTL32_SetVersion(&infoPtr->iVersion, iVersion); }
From: Zhiyi Zhang zzhang@codeweavers.com
They could be hiding test failures. --- dlls/user32/tests/class.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index fd4ea848deb..05424e7e17a 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -1290,7 +1290,7 @@ static void test_comctl32_class( const char *name )
/* Some systems load modules during context activation. In this case skip the rest of the test. */ module = GetModuleHandleA( "comctl32" ); - ok( !module || broken(module != NULL) /* Vista/Win7 */, "comctl32 already loaded\n" ); + ok( !module, "comctl32 already loaded\n" ); if (module) { win_skip("Module loaded during context activation. Skipping tests.\n"); @@ -1298,7 +1298,7 @@ static void test_comctl32_class( const char *name ) }
ret = GetClassInfoA( 0, name, &wcA ); - ok( ret || broken(!ret) /* WinXP */, "GetClassInfoA failed for %s\n", name ); + ok( ret, "GetClassInfoA failed for %s\n", name ); if (!ret) goto skiptest;
@@ -1309,7 +1309,7 @@ static void test_comctl32_class( const char *name ) ok( module != 0, "comctl32 not loaded\n" ); FreeLibrary( module ); module = GetModuleHandleA( "comctl32" ); - ok( !module || broken(module != NULL) /* Vista */, "comctl32 still loaded\n" ); + ok( !module, "comctl32 still loaded\n" ); hwnd = CreateWindowA( name, "test", WS_OVERLAPPEDWINDOW, 0, 0, 10, 10, NULL, NULL, NULL, 0 ); ok( hwnd != 0, "failed to create window for %s\n", name ); module = GetModuleHandleA( "comctl32" ); @@ -1326,7 +1326,7 @@ static void test_comctl32_class( const char *name ) module = GetModuleHandleA( "comctl32" ); ok( !module, "comctl32 already loaded\n" ); ret = GetClassInfoA( 0, name, &wcA ); - ok( ret || broken(!ret) /* <= winxp */, "GetClassInfoA failed for %s\n", name ); + ok( ret, "GetClassInfoA failed for %s\n", name ); if (!ret) return; MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW)); ret = GetClassInfoW( 0, nameW, &wcW );
This merge request was approved by Nikolay Sivov.
There are some CI failures in win.c but those look unrelated.