[PATCH 2/2] oledlg/tests: Handle localized menu strings

Nikolay Sivov nsivov at codeweavers.com
Tue Sep 8 08:45:43 CDT 2015


For https://bugs.winehq.org/show_bug.cgi?id=39243

-------------- next part --------------
>From 0eceb2cc6fb4038fdc9491852fbbbb41835631d2 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue, 8 Sep 2015 16:32:17 +0300
Subject: [PATCH 2/2] oledlg/tests: Handle localized menu strings

---
 dlls/oledlg/tests/main.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/oledlg/tests/main.c b/dlls/oledlg/tests/main.c
index d7f696a..9c5e4bd 100644
--- a/dlls/oledlg/tests/main.c
+++ b/dlls/oledlg/tests/main.c
@@ -26,6 +26,18 @@
 #include "initguid.h"
 #include "oledlg.h"
 
+static const WCHAR *strstrW( const WCHAR *str, const WCHAR *sub )
+{
+    while (*str)
+    {
+        const WCHAR *p1 = str, *p2 = sub;
+        while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; }
+        if (!*p2) return str;
+        str++;
+    }
+    return NULL;
+}
+
 static HRESULT WINAPI enumverbs_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
 {
     if (IsEqualIID(riid, &IID_IEnumOLEVERB) || IsEqualIID(riid, &IID_IUnknown)) {
@@ -396,8 +408,9 @@ static void test_OleUIAddVerbMenu(void)
     info.cch = sizeof(buffW)/sizeof(WCHAR);
     ret = GetMenuItemInfoW(hMenu, 4, TRUE, &info);
     ok(ret, "got %d\n", ret);
-    /* item string has a form of '<verb> <usertype> <Object>', where Object is localized */
-    ok(!memcmp(buffW, verbW, sizeof(verbW) - sizeof(WCHAR)), "str %s\n", wine_dbgstr_w(buffW));
+    /* Item string contains verb, usertype and localized string for 'Object' word,
+       exact format depends on localization. */
+    ok(strstrW(buffW, verbW) != NULL, "str %s\n", wine_dbgstr_w(buffW));
     ok(info.fState == 0, "got state 0x%08x\n", info.fState);
     ok(info.hSubMenu == NULL, "got submenu %p\n", info.hSubMenu);
 
-- 
2.1.4



More information about the wine-patches mailing list