ReactOS 0.4.17-dev-116-ga4b6fe9
mlang.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "initguid.h"
#include "mlang.h"
#include "wine/test.h"
Include dependency graph for mlang.c:

Go to the source code of this file.

Classes

struct  lcid_tag_table
 
struct  info_table_tag
 
struct  cpinfo_test_data
 

Macros

#define COBJMACROS
 
#define CP_UNICODE   1200
 
#define TODO_NAME   1
 
#define ok_w2(format, szString1, szString2)
 

Typedefs

typedef struct lcid_tag_table lcid_table_entry
 
typedef struct info_table_tag info_table_entry
 

Functions

static BOOL (WINAPI *pGetCPInfoExA)(UINT
 
static HRESULT (WINAPI *pConvertINetMultiByteToUnicode)(LPDWORD
 
static BOOL init_function_ptrs (void)
 
static void test_multibyte_to_unicode_translations (IMultiLanguage2 *iML2)
 
static void cpinfo_cmp (MIMECPINFO *cpinfo1, MIMECPINFO *cpinfo2)
 
static HRESULT check_convertible (IMultiLanguage2 *iML2, UINT from, UINT to)
 
static void test_EnumCodePages (IMultiLanguage2 *iML2, DWORD flags)
 
static void test_GetCharsetInfo_other (IMultiLanguage *ml)
 
static void scriptinfo_cmp (SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
 
static void test_EnumScripts (IMultiLanguage2 *iML2, DWORD flags)
 
static void IMLangFontLink_Test (IMLangFontLink *iMLFL)
 
static void test_rfc1766 (IMultiLanguage2 *iML2)
 
static void test_GetLcidFromRfc1766 (IMultiLanguage2 *iML2)
 
static void test_Rfc1766ToLcid (void)
 
static void test_GetNumberOfCodePageInfo (IMultiLanguage2 *iML2)
 
static void test_GetRfc1766FromLcid (IMultiLanguage2 *iML2)
 
static void test_LcidToRfc1766 (void)
 
static void test_GetRfc1766Info (IMultiLanguage2 *iML2)
 
static void test_IMultiLanguage2_ConvertStringFromUnicode (IMultiLanguage2 *iML2)
 
static void test_ConvertINetUnicodeToMultiByte (void)
 
static void test_JapaneseConversion (void)
 
static void test_GetScriptFontInfo (IMLangFontLink2 *font_link)
 
static void test_CodePageToScriptID (IMLangFontLink2 *font_link)
 
static void test_GetFontUnicodeRanges (IMLangFontLink2 *font_link)
 
static void test_IsCodePageInstallable (IMultiLanguage2 *ml2)
 
static void test_GetGlobalFontLinkObject (void)
 
static void test_IMLangConvertCharset (IMultiLanguage *ml)
 
static HRESULT WINAPI stream_QueryInterface (IStream *iface, REFIID riid, void **obj)
 
static ULONG WINAPI stream_AddRef (IStream *iface)
 
static ULONG WINAPI stream_Release (IStream *iface)
 
static HRESULT WINAPI stream_Read (IStream *iface, void *buf, ULONG len, ULONG *read)
 
static HRESULT WINAPI stream_Write (IStream *iface, const void *buf, ULONG len, ULONG *written)
 
static HRESULT WINAPI stream_Seek (IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *newpos)
 
static HRESULT WINAPI stream_SetSize (IStream *iface, ULARGE_INTEGER newsize)
 
static HRESULT WINAPI stream_CopyTo (IStream *iface, IStream *stream, ULARGE_INTEGER len, ULARGE_INTEGER *read, ULARGE_INTEGER *written)
 
static HRESULT WINAPI stream_Commit (IStream *iface, DWORD flags)
 
static HRESULT WINAPI stream_Revert (IStream *iface)
 
static HRESULT WINAPI stream_LockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
 
static HRESULT WINAPI stream_UnlockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
 
static HRESULT WINAPI stream_Stat (IStream *iface, STATSTG *stg, DWORD flag)
 
static HRESULT WINAPI stream_Clone (IStream *iface, IStream **stream)
 
static void test_DetectOutboundCodePageInIStream (IMultiLanguage3 *ml)
 
static BOOL is_lang_english (void)
 
static void test_GetCodePageInfo (IMultiLanguage2 *iML2)
 
static void test_MapFont (IMLangFontLink *font_link, IMLangFontLink2 *font_link2)
 
 START_TEST (mlang)
 

Variables

static DWORD
 
static LPCPINFOEXA
 
static LPCSTR
 
static LPINT
 
static LPWSTR
 
static LPCWSTR
 
static LPSTR
 
static INT
 
static const lcid_table_entry lcid_table []
 
static const WCHAR de_en [] = {'E','n','g','l','i','s','c','h',0}
 
static const WCHAR de_enca []
 
static const WCHAR de_engb []
 
static const WCHAR de_engb2 []
 
static const WCHAR de_enus []
 
static const WCHAR de_enus2 []
 
static const WCHAR de_de []
 
static const WCHAR de_deat []
 
static const WCHAR de_dech []
 
static const WCHAR en_en [] = {'E','n','g','l','i','s','h',0}
 
static const WCHAR en_enca []
 
static const WCHAR en_engb []
 
static const WCHAR en_enus []
 
static const WCHAR en_de []
 
static const WCHAR en_deat []
 
static const WCHAR en_dech []
 
static const WCHAR fr_en [] = {'A','n','g','l','a','i','s',0}
 
static const WCHAR fr_enca []
 
static const WCHAR fr_engb []
 
static const WCHAR fr_enus []
 
static const WCHAR fr_enus2 []
 
static const WCHAR fr_de []
 
static const WCHAR fr_de2 []
 
static const WCHAR fr_deat []
 
static const WCHAR fr_dech []
 
static const info_table_entry info_table []
 
static const struct cpinfo_test_data iml2_cpinfo_data []
 
static const char stream_data [] = "VCARD2.1test;test"
 
static ULONG stream_pos
 
static const IStreamVtbl stream_vtbl
 
static IStream test_stream = { &stream_vtbl }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file mlang.c.

◆ CP_UNICODE

#define CP_UNICODE   1200

Definition at line 36 of file mlang.c.

◆ ok_w2

#define ok_w2 (   format,
  szString1,
  szString2 
)
Value:
\
if (lstrcmpW((szString1), (szString2)) != 0) \
{ \
CHAR string1[256], string2[256]; \
WideCharToMultiByte(CP_ACP, 0, (szString1), -1, string1, 256, NULL, NULL); \
WideCharToMultiByte(CP_ACP, 0, (szString2), -1, string2, 256, NULL, NULL); \
ok(0, (format), string1, string2); \
}
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static CHAR string1[MAX_PATH]
Definition: asmname.c:32
static CHAR string2[MAX_PATH]
Definition: automation.c:345
char CHAR
Definition: pedump.c:57
Definition: format.c:58

Definition at line 556 of file mlang.c.

◆ TODO_NAME

#define TODO_NAME   1

Definition at line 103 of file mlang.c.

Typedef Documentation

◆ info_table_entry

◆ lcid_table_entry

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pGetCPInfoExA)
static

◆ check_convertible()

static HRESULT check_convertible ( IMultiLanguage2 *  iML2,
UINT  from,
UINT  to 
)
static

Definition at line 738 of file mlang.c.

739{
742 HRESULT hr;
743 UINT srcsz, destsz;
744
745 static WCHAR strW[] = {'a','b','c',0};
746
747 /* Check to see if the target codepage has these characters or not */
748 if (from != CP_UTF8)
749 {
750 BOOL fDefaultChar;
751 char ch[10];
752 int cb;
754 strW, 3, ch, sizeof(ch), NULL, &fDefaultChar);
755
756 if(cb == 0 || fDefaultChar)
757 {
758 trace("target codepage %i does not contain 'abc'\n",from);
759 return E_FAIL;
760 }
761 }
762
763 srcsz = lstrlenW(strW) + 1;
764 destsz = MAX_PATH;
765 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, from, strW,
766 &srcsz, convert, &destsz);
767 if (hr != S_OK)
768 return S_FALSE;
769
770 srcsz = -1;
771 destsz = MAX_PATH;
772 hr = IMultiLanguage2_ConvertString(iML2, NULL, from, to, (BYTE *)convert,
773 &srcsz, dest, &destsz);
774 if (hr != S_OK)
775 return S_FALSE;
776
777 return S_OK;
778}
#define trace
Definition: atltest.h:70
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:573
#define MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
unsigned char ch[4][2]
Definition: console.c:118
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_COMPOSITECHECK
Definition: unicode.h:43
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
#define S_OK
Definition: intsafe.h:52
static char * dest
Definition: rtl.c:149
WCHAR strW[12]
Definition: clipboard.c:2216
int convert
Definition: msacm.c:1374
unsigned int UINT
Definition: ndis.h:50
short WCHAR
Definition: pedump.c:58
#define CP_UTF8
Definition: nls.h:20
CardRegion * from
Definition: spigame.cpp:19
#define S_FALSE
Definition: winerror.h:3451
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_EnumCodePages().

◆ cpinfo_cmp()

static void cpinfo_cmp ( MIMECPINFO *  cpinfo1,
MIMECPINFO *  cpinfo2 
)
static

Definition at line 699 of file mlang.c.

700{
701 ok(cpinfo1->dwFlags == cpinfo2->dwFlags, "dwFlags mismatch: %08lx != %08lx\n", cpinfo1->dwFlags, cpinfo2->dwFlags);
702 ok(cpinfo1->uiCodePage == cpinfo2->uiCodePage, "uiCodePage mismatch: %u != %u\n", cpinfo1->uiCodePage, cpinfo2->uiCodePage);
703 ok(cpinfo1->uiFamilyCodePage == cpinfo2->uiFamilyCodePage, "uiFamilyCodePage mismatch: %u != %u\n", cpinfo1->uiFamilyCodePage, cpinfo2->uiFamilyCodePage);
704 ok(!lstrcmpW(cpinfo1->wszDescription, cpinfo2->wszDescription), "wszDescription mismatch\n");
705 ok(!lstrcmpW(cpinfo1->wszWebCharset, cpinfo2->wszWebCharset), "wszWebCharset mismatch\n");
706 ok(!lstrcmpW(cpinfo1->wszHeaderCharset, cpinfo2->wszHeaderCharset), "wszHeaderCharset mismatch\n");
707 ok(!lstrcmpW(cpinfo1->wszBodyCharset, cpinfo2->wszBodyCharset), "wszBodyCharset mismatch\n");
708 ok(!lstrcmpW(cpinfo1->wszFixedWidthFont, cpinfo2->wszFixedWidthFont), "wszFixedWidthFont mismatch\n");
709 ok(!lstrcmpW(cpinfo1->wszProportionalFont, cpinfo2->wszProportionalFont), "wszProportionalFont mismatch\n");
710 ok(cpinfo1->bGDICharset == cpinfo2->bGDICharset, "bGDICharset mismatch: %d != %d\n", cpinfo1->bGDICharset, cpinfo2->bGDICharset);
711}
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_EnumCodePages(), and test_GetCodePageInfo().

◆ HRESULT()

static HRESULT ( WINAPI pConvertINetMultiByteToUnicode)
static

◆ IMLangFontLink_Test()

static void IMLangFontLink_Test ( IMLangFontLink *  iMLFL)
static

Definition at line 1158 of file mlang.c.

1159{
1160 DWORD dwCodePages, dwManyCodePages;
1161 DWORD dwCmpCodePages;
1162 UINT CodePage;
1163 static const WCHAR str[] = { 'd', 0x0436, 0xff90, 0x0160 };
1165 HRESULT ret;
1166
1167 dwCodePages = ~0u;
1168 ret = IMLangFontLink_CodePageToCodePages(iMLFL, -1, &dwCodePages);
1169 ok(ret == E_FAIL, "IMLangFontLink_CodePageToCodePages should fail: %lx\n", ret);
1170 ok(dwCodePages == 0, "expected 0, got %lu\n", dwCodePages);
1171
1172 dwCodePages = 0;
1173 ret = IMLangFontLink_CodePageToCodePages(iMLFL, 932, &dwCodePages);
1174 ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %lx\n", ret);
1175 ok(dwCodePages == FS_JISJAPAN, "expected FS_JISJAPAN, got %08lx\n", dwCodePages);
1176 CodePage = 0;
1177 ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwCodePages, 1035, &CodePage);
1178 ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret);
1179 ok(CodePage == 932, "Incorrect CodePage Returned (%i)\n",CodePage);
1180
1181 dwManyCodePages = 0;
1182 ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1252, &dwManyCodePages);
1183 ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %lx\n", ret);
1184 ok(dwManyCodePages == FS_LATIN1, "expected FS_LATIN1, got %08lx\n", dwManyCodePages);
1185 dwCodePages = 0;
1186 ret = IMLangFontLink_CodePageToCodePages(iMLFL, 1256, &dwCodePages);
1187 ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %lx\n", ret);
1188 ok(dwCodePages == FS_ARABIC, "expected FS_ARABIC, got %08lx\n", dwCodePages);
1189 dwManyCodePages |= dwCodePages;
1190 ret = IMLangFontLink_CodePageToCodePages(iMLFL, 874, &dwCodePages);
1191 ok(ret == S_OK, "IMLangFontLink_CodePageToCodePages error %lx\n", ret);
1192 ok(dwCodePages == FS_THAI, "expected FS_THAI, got %08lx\n", dwCodePages);
1193 dwManyCodePages |= dwCodePages;
1194
1195 ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 1256, &CodePage);
1196 ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret);
1197 ok(CodePage == 1256, "Incorrect CodePage Returned (%i)\n",CodePage);
1198
1199 ret = IMLangFontLink_CodePagesToCodePage(iMLFL, dwManyCodePages, 936, &CodePage);
1200 ok(ret == S_OK, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret);
1201 ok(CodePage == 1252, "Incorrect CodePage Returned (%i)\n",CodePage);
1202
1203 /* Tests for GetCharCodePages */
1204
1205 /* Latin 1 */
1206 dwCmpCodePages = FS_LATIN1 | FS_LATIN2 | FS_CYRILLIC | FS_GREEK | FS_TURKISH
1209 ret = IMLangFontLink_GetCharCodePages(iMLFL, 'd', &dwCodePages);
1210 ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %lx\n", ret);
1211 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1212
1213 dwCodePages = 0;
1214 processed = 0;
1215 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 1, 0, &dwCodePages, &processed);
1216 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1217 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1218 ok(processed == 1, "expected 1, got %ld\n", processed);
1219
1220 /* Latin 2 */
1221 dwCmpCodePages = FS_LATIN1 | FS_LATIN2 | FS_TURKISH | FS_BALTIC;
1222 ret = IMLangFontLink_GetCharCodePages(iMLFL, 0x0160, &dwCodePages);
1223 ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %lx\n", ret);
1224 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1225
1226 dwCodePages = 0;
1227 processed = 0;
1228 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[3], 1, 0, &dwCodePages, &processed);
1229 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1230 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1231 ok(processed == 1, "expected 1, got %ld\n", processed);
1232
1233 /* Cyrillic */
1234 dwCmpCodePages = FS_CYRILLIC | FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG;
1235 ret = IMLangFontLink_GetCharCodePages(iMLFL, 0x0436, &dwCodePages);
1236 ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %lx\n", ret);
1237 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1238
1239 dwCodePages = 0;
1240 processed = 0;
1241 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[1], 1, 0, &dwCodePages, &processed);
1242 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1243 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1244 ok(processed == 1, "expected 1, got %ld\n", processed);
1245
1246 /* Japanese */
1247 dwCmpCodePages = FS_JISJAPAN;
1248 ret = IMLangFontLink_GetCharCodePages(iMLFL, 0xff90, &dwCodePages);
1249 ok(ret == S_OK, "IMLangFontLink_GetCharCodePages error %lx\n", ret);
1250 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1251
1252 dwCodePages = 0;
1253 processed = 0;
1254 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, &dwCodePages, &processed);
1255 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1256 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1257 ok(processed == 1, "expected 1, got %ld\n", processed);
1258
1259 dwCmpCodePages = FS_CYRILLIC | FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG;
1260 dwCodePages = 0;
1261 processed = 0;
1262 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 2, 0, &dwCodePages, &processed);
1263 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1264 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1265 ok(processed == 2, "expected 2, got %ld\n", processed);
1266
1267 dwCmpCodePages = FS_JISJAPAN;
1268 dwCodePages = 0;
1269 processed = 0;
1270 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 3, 0, &dwCodePages, &processed);
1271 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1272 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1273 ok(processed == 3, "expected 3, got %ld\n", processed);
1274
1275 dwCmpCodePages = FS_JISJAPAN;
1276 dwCodePages = 0;
1277 processed = 0;
1278 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 4, 0, &dwCodePages, &processed);
1279 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1280 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1281 ok(processed == 3, "expected 3, got %ld\n", processed);
1282
1283 dwCmpCodePages = FS_LATIN1 | FS_LATIN2 | FS_CYRILLIC | FS_GREEK | FS_TURKISH
1286 dwCodePages = 0;
1287 processed = 0;
1288 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 4, FS_LATIN1, &dwCodePages, &processed);
1289 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1290 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1291 ok(processed == 1, "expected 1, got %ld\n", processed);
1292
1293 dwCmpCodePages = FS_CYRILLIC | FS_JISJAPAN | FS_CHINESESIMP | FS_WANSUNG;
1294 dwCodePages = 0;
1295 processed = 0;
1296 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 4, FS_CYRILLIC, &dwCodePages, &processed);
1297 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1298 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1299 ok(processed == 2, "expected 2, got %ld\n", processed);
1300
1301 dwCmpCodePages = FS_JISJAPAN;
1302 dwCodePages = 0;
1303 processed = 0;
1304 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 4, FS_JISJAPAN, &dwCodePages, &processed);
1305 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1306 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1307 ok(processed == 3, "expected 3, got %ld\n", processed);
1308
1309 dwCmpCodePages = FS_LATIN1 | FS_LATIN2 | FS_CYRILLIC | FS_GREEK | FS_TURKISH
1312 dwCodePages = 0;
1313 processed = 0;
1314 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 4, FS_TURKISH, &dwCodePages, &processed);
1315 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1316 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1317 ok(processed == 1, "expected 1, got %ld\n", processed);
1318
1319 dwCmpCodePages = FS_JISJAPAN;
1320 dwCodePages = 0;
1321 processed = 0;
1322 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[1], 3, FS_TURKISH, &dwCodePages, &processed);
1323 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1324 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1325 ok(processed == 2, "expected 2, got %ld\n", processed);
1326
1327 dwCmpCodePages = FS_JISJAPAN;
1328 dwCodePages = 0;
1329 processed = 0;
1330 ret = IMLangFontLink_GetStrCodePages(iMLFL, L"\uff90a", 2, FS_LATIN1, &dwCodePages, &processed);
1331 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1332 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1333 ok(processed == 1, "expected 1, got %ld\n", processed);
1334
1335 dwCodePages = 0xffff;
1336 processed = -1;
1337 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, &dwCodePages, &processed);
1338 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1339 ok(dwCodePages == dwCmpCodePages, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1340 ok(processed == 1, "expected 0, got %ld\n", processed);
1341
1342 ret = IMLangFontLink_GetStrCodePages(iMLFL, &str[2], 1, 0, NULL, NULL);
1343 ok(ret == S_OK, "IMLangFontLink_GetStrCodePages error %lx\n", ret);
1344
1345 dwCodePages = 0xffff;
1346 processed = -1;
1347 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, -1, 0, &dwCodePages, &processed);
1348 ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret);
1349 ok(dwCodePages == 0, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1350 ok(processed == 0, "expected 0, got %ld\n", processed);
1351
1352 dwCodePages = 0xffff;
1353 processed = -1;
1354 ret = IMLangFontLink_GetStrCodePages(iMLFL, NULL, 1, 0, &dwCodePages, &processed);
1355 ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret);
1356 ok(dwCodePages == 0, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1357 ok(processed == 0, "expected 0, got %ld\n", processed);
1358
1359 dwCodePages = 0xffff;
1360 processed = -1;
1361 ret = IMLangFontLink_GetStrCodePages(iMLFL, str, 0, 0, &dwCodePages, &processed);
1362 ok(ret == E_INVALIDARG, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret);
1363 ok(dwCodePages == 0, "expected %lx, got %lx\n", dwCmpCodePages, dwCodePages);
1364 ok(processed == 0, "expected 0, got %ld\n", processed);
1365}
#define E_INVALIDARG
Definition: ddrawi.h:101
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
long LONG
Definition: pedump.c:60
const WCHAR * str
static int processed(const type_t *type)
Definition: typegen.c:2524
#define FS_TURKISH
Definition: wingdi.h:564
#define FS_THAI
Definition: wingdi.h:569
#define FS_ARABIC
Definition: wingdi.h:566
#define FS_WANSUNG
Definition: wingdi.h:572
#define FS_LATIN2
Definition: wingdi.h:561
#define FS_VIETNAMESE
Definition: wingdi.h:568
#define FS_GREEK
Definition: wingdi.h:563
#define FS_HEBREW
Definition: wingdi.h:565
#define FS_LATIN1
Definition: wingdi.h:560
#define FS_JISJAPAN
Definition: wingdi.h:570
#define FS_CHINESETRAD
Definition: wingdi.h:573
#define FS_CHINESESIMP
Definition: wingdi.h:571
#define FS_BALTIC
Definition: wingdi.h:567
#define FS_CYRILLIC
Definition: wingdi.h:562

Referenced by START_TEST().

◆ init_function_ptrs()

static BOOL init_function_ptrs ( void  )
static

Definition at line 541 of file mlang.c.

542{
543 HMODULE hMlang;
544
545 hMlang = GetModuleHandleA("mlang.dll");
546 pConvertINetMultiByteToUnicode = (void *)GetProcAddress(hMlang, "ConvertINetMultiByteToUnicode");
547 pConvertINetUnicodeToMultiByte = (void *)GetProcAddress(hMlang, "ConvertINetUnicodeToMultiByte");
548 pRfc1766ToLcidA = (void *)GetProcAddress(hMlang, "Rfc1766ToLcidA");
549 pLcidToRfc1766A = (void *)GetProcAddress(hMlang, "LcidToRfc1766A");
550
551 pGetCPInfoExA = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetCPInfoExA");
552
553 return TRUE;
554}
#define TRUE
Definition: types.h:120
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812

Referenced by START_TEST().

◆ is_lang_english()

static BOOL is_lang_english ( void  )
static

Definition at line 2618 of file mlang.c.

2619{
2620 static HMODULE hkernel32 = NULL;
2621 static LANGID (WINAPI *pGetThreadUILanguage)(void) = NULL;
2622 static LANGID (WINAPI *pGetUserDefaultUILanguage)(void) = NULL;
2623
2624 if (!hkernel32)
2625 {
2626 hkernel32 = GetModuleHandleA("kernel32.dll");
2627 pGetThreadUILanguage = (void*)GetProcAddress(hkernel32, "GetThreadUILanguage");
2628 pGetUserDefaultUILanguage = (void*)GetProcAddress(hkernel32, "GetUserDefaultUILanguage");
2629 }
2630 if (pGetThreadUILanguage)
2631 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH;
2632 if (pGetUserDefaultUILanguage)
2633 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH;
2634
2636}
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1182
USHORT LANGID
Definition: mui.h:9
static HINSTANCE hkernel32
Definition: process.c:68
#define LANG_ENGLISH
Definition: nls.h:52
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define WINAPI
Definition: msvc.h:6

Referenced by test_GetCodePageInfo().

◆ scriptinfo_cmp()

static void scriptinfo_cmp ( SCRIPTINFO *  sinfo1,
SCRIPTINFO *  sinfo2 
)
static

Definition at line 1053 of file mlang.c.

1054{
1055 ok(sinfo1->ScriptId == sinfo2->ScriptId, "ScriptId mismatch: %d != %d\n", sinfo1->ScriptId, sinfo2->ScriptId);
1056 ok(sinfo1->uiCodePage == sinfo2->uiCodePage, "uiCodePage mismatch: %u != %u\n", sinfo1->uiCodePage, sinfo2->uiCodePage);
1057 ok(!lstrcmpW(sinfo1->wszDescription, sinfo2->wszDescription), "wszDescription mismatch\n");
1058 ok(!lstrcmpW(sinfo1->wszFixedWidthFont, sinfo2->wszFixedWidthFont), "wszFixedWidthFont mismatch\n");
1059 ok(!lstrcmpW(sinfo1->wszProportionalFont, sinfo2->wszProportionalFont), "wszProportionalFont mismatch\n");
1060}

Referenced by test_EnumScripts().

◆ START_TEST()

START_TEST ( mlang  )

Definition at line 2842 of file mlang.c.

2843{
2844 IMultiLanguage *iML = NULL;
2845 IMultiLanguage2 *iML2 = NULL;
2846 IMultiLanguage3 *iML3 = NULL;
2847 IMLangFontLink *iMLFL = NULL;
2848 IMLangFontLink2 *iMLFL2 = NULL;
2849 HRESULT ret;
2850
2851 if (!init_function_ptrs())
2852 return;
2853
2855
2859
2862
2863 trace("IMultiLanguage\n");
2864 ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
2865 &IID_IMultiLanguage, (void **)&iML);
2866 if (ret != S_OK || !iML) return;
2867
2868 test_GetNumberOfCodePageInfo((IMultiLanguage2 *)iML);
2871 IMultiLanguage_Release(iML);
2872
2873
2874 /* IMultiLanguage2 (IE5.0 and above) */
2875 trace("IMultiLanguage2\n");
2876 ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
2877 &IID_IMultiLanguage2, (void **)&iML2);
2878 if (ret != S_OK || !iML2) return;
2879
2880 test_rfc1766(iML2);
2883 test_GetRfc1766Info(iML2);
2886
2887 test_EnumCodePages(iML2, 0);
2888 test_EnumCodePages(iML2, MIMECONTF_MIME_LATEST);
2889 test_EnumCodePages(iML2, MIMECONTF_BROWSER);
2890 test_EnumCodePages(iML2, MIMECONTF_MINIMAL);
2891 test_EnumCodePages(iML2, MIMECONTF_VALID);
2892 /* FIXME: why MIMECONTF_MIME_REGISTRY returns 0 of supported codepages? */
2893 /*test_EnumCodePages(iML2, MIMECONTF_MIME_REGISTRY);*/
2894
2895 test_EnumScripts(iML2, 0);
2896 test_EnumScripts(iML2, SCRIPTCONTF_SCRIPT_USER);
2897 test_EnumScripts(iML2, SCRIPTCONTF_SCRIPT_USER | SCRIPTCONTF_SCRIPT_HIDE | SCRIPTCONTF_SCRIPT_SYSTEM);
2898
2899 ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, CP_UNICODE);
2900 ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UTF8 -> CP_UNICODE) = %08lx\n", ret);
2901 ret = IMultiLanguage2_IsConvertible(iML2, CP_UNICODE, CP_UTF8);
2902 ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UNICODE -> CP_UTF8) = %08lx\n", ret);
2903
2906
2908
2909 IMultiLanguage2_Release(iML2);
2910
2911
2912 /* IMLangFontLink */
2913 ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
2914 &IID_IMLangFontLink, (void **)&iMLFL);
2915 if (ret != S_OK || !iMLFL) return;
2916
2917 IMLangFontLink_Test(iMLFL);
2918
2919 /* IMLangFontLink2 */
2920 ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
2921 &IID_IMLangFontLink2, (void **)&iMLFL2);
2922 if (ret != S_OK || !iMLFL2) return;
2923
2924 test_GetScriptFontInfo(iMLFL2);
2927 test_MapFont(iMLFL, iMLFL2);
2928
2929 IMLangFontLink_Release(iMLFL);
2930 IMLangFontLink2_Release(iMLFL2);
2931
2932 trace("IMultiLanguage3\n");
2933 ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
2934 &IID_IMultiLanguage3, (void **)&iML3);
2935 if (ret == S_OK)
2936 {
2938 IMultiLanguage3_Release(iML3);
2939 }
2940
2942}
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
#define CP_UNICODE
Definition: stg_prop.c:73
static void test_GetFontUnicodeRanges(void)
Definition: font.c:2803
static void test_LcidToRfc1766(void)
Definition: mlang.c:1541
static void test_GetLcidFromRfc1766(IMultiLanguage2 *iML2)
Definition: mlang.c:1404
static void test_MapFont(IMLangFontLink *font_link, IMLangFontLink2 *font_link2)
Definition: mlang.c:2711
static void test_CodePageToScriptID(IMLangFontLink2 *font_link)
Definition: mlang.c:2197
static void test_JapaneseConversion(void)
Definition: mlang.c:1976
static void test_GetGlobalFontLinkObject(void)
Definition: mlang.c:2302
static void IMLangFontLink_Test(IMLangFontLink *iMLFL)
Definition: mlang.c:1158
static void test_rfc1766(IMultiLanguage2 *iML2)
Definition: mlang.c:1367
static void test_GetRfc1766FromLcid(IMultiLanguage2 *iML2)
Definition: mlang.c:1506
static void test_IMultiLanguage2_ConvertStringFromUnicode(IMultiLanguage2 *iML2)
Definition: mlang.c:1647
static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
Definition: mlang.c:1062
static void test_GetScriptFontInfo(IMLangFontLink2 *font_link)
Definition: mlang.c:2159
static void test_GetCodePageInfo(IMultiLanguage2 *iML2)
Definition: mlang.c:2638
static void test_ConvertINetUnicodeToMultiByte(void)
Definition: mlang.c:1820
static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2)
Definition: mlang.c:566
static void test_IsCodePageInstallable(IMultiLanguage2 *ml2)
Definition: mlang.c:2282
static void test_Rfc1766ToLcid(void)
Definition: mlang.c:1464
static void test_GetRfc1766Info(IMultiLanguage2 *iML2)
Definition: mlang.c:1593
static void test_IMLangConvertCharset(IMultiLanguage *ml)
Definition: mlang.c:2350
static void test_GetCharsetInfo_other(IMultiLanguage *ml)
Definition: mlang.c:1011
static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
Definition: mlang.c:780
static BOOL init_function_ptrs(void)
Definition: mlang.c:541
static void test_DetectOutboundCodePageInIStream(IMultiLanguage3 *ml)
Definition: mlang.c:2540
static void test_GetNumberOfCodePageInfo(IMultiLanguage2 *iML2)
Definition: mlang.c:1491

◆ stream_AddRef()

static ULONG WINAPI stream_AddRef ( IStream iface)
static

Definition at line 2421 of file mlang.c.

2422{
2423 ok(FALSE, "unexpected call\n");
2424 return 2;
2425}
#define FALSE
Definition: types.h:117

◆ stream_Clone()

static HRESULT WINAPI stream_Clone ( IStream iface,
IStream **  stream 
)
static

Definition at line 2514 of file mlang.c.

2515{
2516 ok(FALSE, "unexpected call\n");
2517 return E_NOTIMPL;
2518}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ stream_Commit()

static HRESULT WINAPI stream_Commit ( IStream iface,
DWORD  flags 
)
static

Definition at line 2482 of file mlang.c.

2483{
2484 ok(FALSE, "unexpected call\n");
2485 return E_NOTIMPL;
2486}

◆ stream_CopyTo()

static HRESULT WINAPI stream_CopyTo ( IStream iface,
IStream stream,
ULARGE_INTEGER  len,
ULARGE_INTEGER read,
ULARGE_INTEGER written 
)
static

Definition at line 2475 of file mlang.c.

2477{
2478 ok(FALSE, "unexpected call\n");
2479 return E_NOTIMPL;
2480}

◆ stream_LockRegion()

static HRESULT WINAPI stream_LockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  len,
DWORD  locktype 
)
static

Definition at line 2494 of file mlang.c.

2496{
2497 ok(FALSE, "unexpected call\n");
2498 return E_NOTIMPL;
2499}

◆ stream_QueryInterface()

static HRESULT WINAPI stream_QueryInterface ( IStream iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 2415 of file mlang.c.

2416{
2417 ok(FALSE, "unexpected call\n");
2418 return E_NOINTERFACE;
2419}
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ stream_Read()

static HRESULT WINAPI stream_Read ( IStream iface,
void buf,
ULONG  len,
ULONG read 
)
static

Definition at line 2433 of file mlang.c.

2434{
2435 ULONG size;
2436
2437 if (stream_pos == sizeof(stream_data) - 1)
2438 {
2439 *read = 0;
2440 return S_FALSE;
2441 }
2442 size = min(sizeof(stream_data) - 1 - stream_pos, len);
2444 stream_pos += size;
2445 *read = size;
2446 return S_OK;
2447}
#define read
Definition: acwin.h:96
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static ULONG stream_pos
Definition: mlang.c:2413
static const char stream_data[]
Definition: mlang.c:2412
#define min(a, b)
Definition: monoChain.cc:55
uint32_t ULONG
Definition: typedefs.h:59

◆ stream_Release()

static ULONG WINAPI stream_Release ( IStream iface)
static

Definition at line 2427 of file mlang.c.

2428{
2429 ok(FALSE, "unexpected call\n");
2430 return 1;
2431}

◆ stream_Revert()

static HRESULT WINAPI stream_Revert ( IStream iface)
static

Definition at line 2488 of file mlang.c.

2489{
2490 ok(FALSE, "unexpected call\n");
2491 return E_NOTIMPL;
2492}

◆ stream_Seek()

static HRESULT WINAPI stream_Seek ( IStream iface,
LARGE_INTEGER  move,
DWORD  origin,
ULARGE_INTEGER newpos 
)
static

Definition at line 2455 of file mlang.c.

2457{
2458 if (origin == STREAM_SEEK_SET)
2459 stream_pos = move.QuadPart;
2460 else if (origin == STREAM_SEEK_CUR)
2461 stream_pos += move.QuadPart;
2462 else if (origin == STREAM_SEEK_END)
2463 stream_pos = sizeof(stream_data) - 1 - move.QuadPart;
2464
2465 if (newpos) newpos->QuadPart = stream_pos;
2466 return S_OK;
2467}
voidpf uLong int origin
Definition: ioapi.h:144
if(dx< 0)
Definition: linetemp.h:194
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
LONGLONG QuadPart
Definition: typedefs.h:114

◆ stream_SetSize()

static HRESULT WINAPI stream_SetSize ( IStream iface,
ULARGE_INTEGER  newsize 
)
static

Definition at line 2469 of file mlang.c.

2470{
2471 ok(FALSE, "unexpected call\n");
2472 return E_NOTIMPL;
2473}

◆ stream_Stat()

static HRESULT WINAPI stream_Stat ( IStream iface,
STATSTG *  stg,
DWORD  flag 
)
static

Definition at line 2508 of file mlang.c.

2509{
2510 ok(FALSE, "unexpected call\n");
2511 return E_NOTIMPL;
2512}

◆ stream_UnlockRegion()

static HRESULT WINAPI stream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  len,
DWORD  locktype 
)
static

Definition at line 2501 of file mlang.c.

2503{
2504 ok(FALSE, "unexpected call\n");
2505 return E_NOTIMPL;
2506}

◆ stream_Write()

static HRESULT WINAPI stream_Write ( IStream iface,
const void buf,
ULONG  len,
ULONG written 
)
static

Definition at line 2449 of file mlang.c.

2450{
2451 ok(FALSE, "unexpected call\n");
2452 return E_NOTIMPL;
2453}

◆ test_CodePageToScriptID()

static void test_CodePageToScriptID ( IMLangFontLink2 *  font_link)
static

Definition at line 2197 of file mlang.c.

2198{
2199 HRESULT hr;
2200 UINT i;
2201 SCRIPT_ID sid;
2202 static const struct
2203 {
2204 UINT cp;
2205 SCRIPT_ID sid;
2206 HRESULT hr;
2207 }
2208 cp_sid[] =
2209 {
2210 {874, sidThai},
2211 {932, sidKana},
2212 {936, sidHan},
2213 {949, sidHangul},
2214 {950, sidBopomofo},
2215 {1250, sidAsciiLatin},
2216 {1251, sidCyrillic},
2217 {1252, sidAsciiLatin},
2218 {1253, sidGreek},
2219 {1254, sidAsciiLatin},
2220 {1255, sidHebrew},
2221 {1256, sidArabic},
2222 {1257, sidAsciiLatin},
2223 {1258, sidAsciiLatin},
2224 {CP_UNICODE, 0, E_FAIL}
2225 };
2226
2227 for (i = 0; i < ARRAY_SIZE(cp_sid); i++)
2228 {
2229 hr = IMLangFontLink2_CodePageToScriptID(font_link, cp_sid[i].cp, &sid);
2230 ok(hr == cp_sid[i].hr, "%u CodePageToScriptID failed 0x%08lx %lu\n", i, hr, GetLastError());
2231 if (SUCCEEDED(hr))
2232 {
2233 ok(sid == cp_sid[i].sid,
2234 "%u got sid %u for codepage %u, expected %u\n", i, sid, cp_sid[i].cp, cp_sid[i].sid);
2235 }
2236 }
2237}
#define ARRAY_SIZE(A)
Definition: main.h:20
FT_UInt sid
Definition: cffcmap.c:138
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SUCCEEDED(hr)
Definition: intsafe.h:50
POINT cp
Definition: magnifier.c:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_ConvertINetUnicodeToMultiByte()

static void test_ConvertINetUnicodeToMultiByte ( void  )
static

Definition at line 1820 of file mlang.c.

1821{
1823 CHAR invariate[MAX_PATH];
1824 INT srcsz, destsz;
1825 HRESULT hr;
1826
1827 static WCHAR src[] = {'a','b','c',0};
1828
1829 memset(invariate, 'x', sizeof(invariate));
1830
1831 /* lpSrcStr NULL */
1832 memset(dest, 'x', sizeof(dest));
1833 srcsz = lstrlenW(src) + 1;
1834 destsz = sizeof(dest);
1835 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, NULL, &srcsz, dest, &destsz);
1836 ok(hr == S_OK || hr == E_FAIL, "Expected S_OK or E_FAIL, got %08lx\n", hr);
1837 if (hr == S_OK)
1838 ok(srcsz == lstrlenW(src) + 1,
1839 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1840 else if (hr == E_FAIL)
1841 ok(srcsz == 0,
1842 "Expected %u, got %u\n", 0, srcsz);
1843 ok(!memcmp(dest, invariate, sizeof(dest)),
1844 "Expected dest to be unchanged, got %s\n", dest);
1845 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1846
1847 /* lpnWideCharCount NULL */
1848 memset(dest, 'x', sizeof(dest));
1849 destsz = sizeof(dest);
1850 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, NULL, dest, &destsz);
1851 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1852 ok(!strncmp(dest, "abc", 3),
1853 "Expected first three chars to be \"abc\"\n");
1854 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1855 "Expected rest of dest to be unchanged, got %s\n", dest);
1856 ok(destsz == lstrlenW(src),
1857 "Expected %u, got %u\n", lstrlenW(src), destsz);
1858
1859 /* both lpSrcStr and lpnWideCharCount NULL */
1860 memset(dest, 'x', sizeof(dest));
1861 destsz = sizeof(dest);
1862 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, NULL, NULL, dest, &destsz);
1863 ok(hr == S_OK || hr == E_FAIL, "Expected S_OK or E_FAIL, got %08lx\n", hr);
1864 ok(!memcmp(dest, invariate, sizeof(dest)),
1865 "Expected dest to be unchanged, got %s\n", dest);
1866 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1867
1868 /* lpDstStr NULL */
1869 memset(dest, 'x', sizeof(dest));
1870 srcsz = lstrlenW(src) + 1;
1871 destsz = sizeof(dest);
1872 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, NULL, &destsz);
1873 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1874 ok(srcsz == lstrlenW(src) + 1,
1875 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1876 ok(destsz == lstrlenW(src) + 1,
1877 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1878
1879 /* lpnMultiCharCount NULL */
1880 memset(dest, 'x', sizeof(dest));
1881 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, NULL);
1882 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1883 ok(srcsz == lstrlenW(src) + 1,
1884 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1885 ok(!memcmp(dest, invariate, sizeof(dest)),
1886 "Expected dest to be unchanged, got %s\n", dest);
1887
1888 /* lpnWideCharCount is 0 */
1889 memset(dest, 'x', sizeof(dest));
1890 srcsz = 0;
1891 destsz = sizeof(dest);
1892 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1893 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1894 ok(srcsz == 0, "Expected 0, got %u\n", srcsz);
1895 ok(!memcmp(dest, invariate, sizeof(dest)),
1896 "Expected dest to be unchanged, got %s\n", dest);
1897 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1898
1899 /* lpnWideCharCount does not include NULL terminator */
1900 memset(dest, 'x', sizeof(dest));
1901 srcsz = lstrlenW(src);
1902 destsz = sizeof(dest);
1903 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1904 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1905 ok(srcsz == lstrlenW(src),
1906 "Expected %u, got %u\n", lstrlenW(src), srcsz);
1907 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1908 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1909 "Expected rest of dest to be unchanged, got %s\n", dest);
1910 ok(destsz == lstrlenW(src),
1911 "Expected %u, got %u\n", lstrlenW(src), destsz);
1912
1913 /* lpnWideCharCount includes NULL terminator */
1914 memset(dest, 'x', sizeof(dest));
1915 srcsz = lstrlenW(src) + 1;
1916 destsz = sizeof(dest);
1917 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1918 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1919 ok(srcsz == lstrlenW(src) + 1, "Expected 3, got %u\n", srcsz);
1920 ok(!lstrcmpA(dest, "abc"), "Expected \"abc\", got \"%s\"\n", dest);
1921 ok(destsz == lstrlenW(src) + 1,
1922 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1923
1924 /* lpnWideCharCount is -1 */
1925 memset(dest, 'x', sizeof(dest));
1926 srcsz = -1;
1927 destsz = sizeof(dest);
1928 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1929 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1930 ok(srcsz == lstrlenW(src),
1931 "Expected %u, got %u\n", lstrlenW(src), srcsz);
1932 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1933 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1934 "Expected rest of dest to be unchanged, got %s\n", dest);
1935 ok(destsz == lstrlenW(src),
1936 "Expected %u, got %u\n", lstrlenW(src), destsz);
1937
1938 /* lpnMultiCharCount is 0 */
1939 memset(dest, 'x', sizeof(dest));
1940 srcsz = lstrlenW(src) + 1;
1941 destsz = 0;
1942 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1943 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1944 ok(srcsz == lstrlenW(src) + 1,
1945 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1946 ok(!memcmp(dest, invariate, sizeof(dest)),
1947 "Expected dest to be unchanged, got %s\n", dest);
1948 ok(destsz == lstrlenW(src) + 1,
1949 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1950
1951 /* lpnMultiCharCount is not large enough */
1952 memset(dest, 'x', sizeof(dest));
1953 srcsz = lstrlenW(src) + 1;
1954 destsz = lstrlenW(src);
1955 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1956 ok(hr == E_FAIL, "Expected E_FAIL, got %08lx\n", hr);
1957 ok(srcsz == 0, "Expected 0, got %u\n", srcsz);
1958 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1959 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1960 "Expected rest of dest to be unchanged, got %s\n", dest);
1961 ok(destsz == 0, "Expected 0, got %u\n", srcsz);
1962
1963 /* lpnMultiCharCount (bytes) does not leave room for NULL terminator */
1964 memset(dest, 'x', sizeof(dest));
1965 srcsz = lstrlenW(src) + 1;
1966 destsz = lstrlenW(src) * sizeof(WCHAR);
1967 hr = pConvertINetUnicodeToMultiByte(NULL, 1252, src, &srcsz, dest, &destsz);
1968 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1969 ok(srcsz == lstrlenW(src) + 1,
1970 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1971 ok(!lstrcmpA(dest, "abc"), "Expected \"abc\", got \"%s\"\n", dest);
1972 ok(destsz == lstrlenW(src) + 1,
1973 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1974}
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
GLenum src
Definition: glext.h:6340
#define memset(x, y, z)
Definition: compat.h:39
int32_t INT
Definition: typedefs.h:58

Referenced by START_TEST().

◆ test_DetectOutboundCodePageInIStream()

static void test_DetectOutboundCodePageInIStream ( IMultiLanguage3 *  ml)
static

Definition at line 2540 of file mlang.c.

2541{
2542 HRESULT hr;
2543 UINT nb_detected, detected[4];
2544 UINT preferred[] = {1250,1251,1252,65001};
2545 UINT preferred2[] = {1250,1251,1252};
2546
2547 nb_detected = 0;
2548 memset(detected, 0, sizeof(detected));
2549 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2550 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2551 ARRAY_SIZE(preferred), detected, &nb_detected, NULL);
2552 ok(hr == E_INVALIDARG, "got %08lx\n", hr);
2553
2554 nb_detected = 1;
2555 memset(detected, 0, sizeof(detected));
2556 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2557 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2558 ARRAY_SIZE(preferred), NULL, &nb_detected, NULL);
2559 ok(hr == E_INVALIDARG, "got %08lx\n", hr);
2560
2561 nb_detected = 1;
2562 memset(detected, 0, sizeof(detected));
2563 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2564 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2565 ARRAY_SIZE(preferred), detected, &nb_detected, NULL);
2566 ok(hr == S_OK, "got %08lx\n", hr);
2567 ok(nb_detected == 1, "got %u\n", nb_detected);
2568 ok(detected[0] == 65001, "got %u\n", detected[0]);
2569
2570 nb_detected = 2;
2571 memset(detected, 0, sizeof(detected));
2572 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2573 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2574 ARRAY_SIZE(preferred), detected, &nb_detected, NULL);
2575 ok(hr == S_OK, "got %08lx\n", hr);
2576 todo_wine ok(nb_detected == 2, "got %u\n", nb_detected);
2577 ok(detected[0] == 65001, "got %u\n", detected[0]);
2578 todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
2579
2580 nb_detected = 3;
2581 memset(detected, 0, sizeof(detected));
2582 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2583 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2584 ARRAY_SIZE(preferred), detected, &nb_detected, NULL);
2585 ok(hr == S_OK, "got %08lx\n", hr);
2586 todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
2587 ok(detected[0] == 65001, "got %u\n", detected[0]);
2588 todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
2589 todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
2590
2591 nb_detected = 4;
2592 memset(detected, 0, sizeof(detected));
2593 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2594 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
2595 ARRAY_SIZE(preferred), detected, &nb_detected, NULL);
2596 ok(hr == S_OK, "got %08lx\n", hr);
2597 todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
2598 ok(detected[0] == 65001, "got %u\n", detected[0]);
2599 todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
2600 todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
2601 ok(detected[3] == 0, "got %u\n", detected[3]);
2602
2603 nb_detected = 3;
2604 memset(detected, 0, sizeof(detected));
2605 hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
2606 MLDETECTF_PRESERVE_ORDER, &test_stream, preferred2,
2607 ARRAY_SIZE(preferred2), detected, &nb_detected, NULL);
2608 ok(hr == S_OK, "got %08lx\n", hr);
2609 todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
2610 ok(detected[0] == 65001, "got %u\n", detected[0]);
2611 todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
2612 todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
2613}
#define todo_wine
Definition: minitest.h:80

Referenced by START_TEST().

◆ test_EnumCodePages()

static void test_EnumCodePages ( IMultiLanguage2 *  iML2,
DWORD  flags 
)
static

Definition at line 780 of file mlang.c.

781{
782 IEnumCodePage *iEnumCP = NULL;
783 MIMECPINFO *cpinfo;
784 MIMECPINFO cpinfo2;
785 HRESULT ret;
786 ULONG i, n;
787 UINT total;
788
789 total = 0;
790 ret = IMultiLanguage2_GetNumberOfCodePageInfo(iML2, &total);
791 ok(ret == S_OK && total != 0, "IMultiLanguage2_GetNumberOfCodePageInfo: expected S_OK/!0, got %08lx/%u\n", ret, total);
792
793 trace("total mlang supported codepages %u\n", total);
794
795 ret = IMultiLanguage2_EnumCodePages(iML2, flags, LANG_NEUTRAL, &iEnumCP);
796 ok(ret == S_OK && iEnumCP, "IMultiLanguage2_EnumCodePages: expected S_OK/!NULL, got %08lx/%p\n", ret, iEnumCP);
797
798 ret = IEnumCodePage_Reset(iEnumCP);
799 ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret);
800 n = 65536;
801 ret = IEnumCodePage_Next(iEnumCP, 0, NULL, &n);
802 ok(ret == S_FALSE || ret == E_FAIL,
803 "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08lx\n", ret);
804 if (ret == S_FALSE)
805 ok(n == 0, "IEnumCodePage_Next: expected 0/S_FALSE, got %lu/%08lx\n", n, ret);
806 else if (ret == E_FAIL)
807 ok(n == 65536, "IEnumCodePage_Next: expected 65536/E_FAIL, got %lu/%08lx\n", n, ret);
808 ret = IEnumCodePage_Next(iEnumCP, 0, NULL, NULL);
809 ok(ret == S_FALSE || ret == E_FAIL,
810 "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08lx\n", ret);
811
812 cpinfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*cpinfo) * total * 2);
813
814 n = total * 2;
815 ret = IEnumCodePage_Next(iEnumCP, 0, cpinfo, &n);
816 ok(ret == S_FALSE && n == 0, "IEnumCodePage_Next: expected S_FALSE/0, got %08lx/%lu\n", ret, n);
817
818 n = total * 2;
819 ret = IEnumCodePage_Next(iEnumCP, n, cpinfo, &n);
820 ok(ret == S_OK && n != 0, "IEnumCodePage_Next: expected S_OK/!0, got %08lx/%lu\n", ret, n);
821
822 trace("flags %08lx, enumerated codepages %lu\n", flags, n);
823
824 if (!flags)
825 {
826 ok(n == total, "IEnumCodePage_Next: expected %u, got %lu\n", total, n);
827
828 flags = MIMECONTF_MIME_LATEST;
829 }
830
831 total = n;
832
833 for (i = 0; i < n; i++)
834 {
835 CHARSETINFO csi;
836 MIMECSETINFO mcsi;
837 HRESULT convertible = S_OK;
838 static const WCHAR autoW[] = {'_','a','u','t','o',0};
839 static const WCHAR feffW[] = {'u','n','i','c','o','d','e','F','E','F','F',0};
840
841#ifdef DUMP_CP_INFO
842 trace("MIMECPINFO #%u:\n"
843 "dwFlags %08x %s\n"
844 "uiCodePage %u\n"
845 "uiFamilyCodePage %u\n"
846 "wszDescription %s\n"
847 "wszWebCharset %s\n"
848 "wszHeaderCharset %s\n"
849 "wszBodyCharset %s\n"
850 "wszFixedWidthFont %s\n"
851 "wszProportionalFont %s\n"
852 "bGDICharset %d\n\n",
853 i,
854 cpinfo[i].dwFlags, dump_mime_flags(cpinfo[i].dwFlags),
855 cpinfo[i].uiCodePage,
856 cpinfo[i].uiFamilyCodePage,
857 wine_dbgstr_w(cpinfo[i].wszDescription),
858 wine_dbgstr_w(cpinfo[i].wszWebCharset),
859 wine_dbgstr_w(cpinfo[i].wszHeaderCharset),
860 wine_dbgstr_w(cpinfo[i].wszBodyCharset),
861 wine_dbgstr_w(cpinfo[i].wszFixedWidthFont),
862 wine_dbgstr_w(cpinfo[i].wszProportionalFont),
863 cpinfo[i].bGDICharset);
864#endif
865 ok(cpinfo[i].dwFlags & flags, "enumerated flags %08lx do not include requested %08lx\n", cpinfo[i].dwFlags, flags);
866
867 if (TranslateCharsetInfo((DWORD *)(INT_PTR)cpinfo[i].uiFamilyCodePage, &csi, TCI_SRCCODEPAGE))
868 ok(cpinfo[i].bGDICharset == csi.ciCharset, "%d != %d\n", cpinfo[i].bGDICharset, csi.ciCharset);
869 else
870 if (winetest_debug > 1)
871 trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
872
873#ifdef DUMP_CP_INFO
874 trace("%u: codepage %u family %u\n", i, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
875#endif
876
877 /* support files for some codepages might be not installed, or
878 * the codepage is just an alias.
879 */
880 if (IsValidCodePage(cpinfo[i].uiCodePage))
881 {
882 ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UNICODE);
883 ok(ret == S_OK, "IMultiLanguage2_IsConvertible(%u -> CP_UNICODE) = %08lx\n", cpinfo[i].uiCodePage, ret);
884 ret = IMultiLanguage2_IsConvertible(iML2, CP_UNICODE, cpinfo[i].uiCodePage);
885 ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UNICODE -> %u) = %08lx\n", cpinfo[i].uiCodePage, ret);
886
887 convertible = check_convertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
888 if (convertible != E_FAIL)
889 {
890 ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
891 ok(ret == convertible, "IMultiLanguage2_IsConvertible(%u -> CP_UTF8) = %08lx\n", cpinfo[i].uiCodePage, ret);
892 ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, cpinfo[i].uiCodePage);
893 ok(ret == convertible, "IMultiLanguage2_IsConvertible(CP_UTF8 -> %u) = %08lx\n", cpinfo[i].uiCodePage, ret);
894 }
895 }
896 else
897 if (winetest_debug > 1)
898 trace("IsValidCodePage failed for cp %u\n", cpinfo[i].uiCodePage);
899
900 if (memcmp(cpinfo[i].wszWebCharset,feffW,sizeof(WCHAR)*11)==0)
901 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
902 else
903 {
904 ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszWebCharset, &mcsi);
905 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
906 if (memcmp(cpinfo[i].wszWebCharset, autoW, 5 * sizeof(WCHAR)))
907 {
908 ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret);
909#ifdef DUMP_CP_INFO
910 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszWebCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
911#endif
912 ok(!lstrcmpiW(cpinfo[i].wszWebCharset, mcsi.wszCharset), "%s != %s\n",
913 wine_dbgstr_w(cpinfo[i].wszWebCharset), wine_dbgstr_w(mcsi.wszCharset));
914
915 if (0)
916 {
917 /* native mlang returns completely messed up encodings in some cases */
918 ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
919 "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
920 ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
921 "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
922 }
923 }
924 }
925
926 if (memcmp(cpinfo[i].wszHeaderCharset,feffW,sizeof(WCHAR)*11)==0)
927 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
928 else
929 {
930 ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszHeaderCharset, &mcsi);
931 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
932 if (memcmp(cpinfo[i].wszHeaderCharset, autoW, 5 * sizeof(WCHAR)))
933 {
934 ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret);
935#ifdef DUMP_CP_INFO
936 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszHeaderCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
937#endif
938 ok(!lstrcmpiW(cpinfo[i].wszHeaderCharset, mcsi.wszCharset), "%s != %s\n",
939 wine_dbgstr_w(cpinfo[i].wszHeaderCharset), wine_dbgstr_w(mcsi.wszCharset));
940
941 if (0)
942 {
943 /* native mlang returns completely messed up encodings in some cases */
944 ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
945 "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
946 ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
947 "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
948 }
949 }
950 }
951
952 if (memcmp(cpinfo[i].wszBodyCharset,feffW,sizeof(WCHAR)*11)==0)
953 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
954 else
955 {
956 ret = IMultiLanguage2_GetCharsetInfo(iML2, cpinfo[i].wszBodyCharset, &mcsi);
957 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
958 if (memcmp(cpinfo[i].wszBodyCharset, autoW, 5 * sizeof(WCHAR)))
959 {
960 ok (ret == S_OK, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret);
961#ifdef DUMP_CP_INFO
962 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo[i].wszBodyCharset), mcsi.uiCodePage, mcsi.uiInternetEncoding, wine_dbgstr_w(mcsi.wszCharset));
963#endif
964 ok(!lstrcmpiW(cpinfo[i].wszBodyCharset, mcsi.wszCharset), "%s != %s\n",
965 wine_dbgstr_w(cpinfo[i].wszBodyCharset), wine_dbgstr_w(mcsi.wszCharset));
966
967 if (0)
968 {
969 /* native mlang returns completely messed up encodings in some cases */
970 ok(mcsi.uiInternetEncoding == cpinfo[i].uiCodePage || mcsi.uiInternetEncoding == cpinfo[i].uiFamilyCodePage,
971 "%u != %u || %u\n", mcsi.uiInternetEncoding, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
972 ok(mcsi.uiCodePage == cpinfo[i].uiCodePage || mcsi.uiCodePage == cpinfo[i].uiFamilyCodePage,
973 "%u != %u || %u\n", mcsi.uiCodePage, cpinfo[i].uiCodePage, cpinfo[i].uiFamilyCodePage);
974 }
975 }
976 }
977 }
978
979 /* now IEnumCodePage_Next should fail, since pointer is at the end */
980 n = 1;
981 ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
982 ok(ret == S_FALSE && n == 0, "IEnumCodePage_Next: expected S_FALSE/0, got %08lx/%lu\n", ret, n);
983
984 ret = IEnumCodePage_Reset(iEnumCP);
985 ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret);
986 n = 0;
987 ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
988 ok(n == 1 && ret == S_OK, "IEnumCodePage_Next: expected 1/S_OK, got %lu/%08lx\n", n, ret);
989 cpinfo_cmp(cpinfo, &cpinfo2);
990
991 if (0)
992 {
993 /* Due to a bug in MS' implementation of IEnumCodePage_Skip
994 * it's not used here.
995 */
996 ret = IEnumCodePage_Skip(iEnumCP, 1);
997 ok(ret == S_OK, "IEnumCodePage_Skip: expected S_OK, got %08lx\n", ret);
998 }
999 for (i = 0; i < total - 1; i++)
1000 {
1001 n = 0;
1002 ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
1003 ok(n == 1 && ret == S_OK, "IEnumCodePage_Next: expected 1/S_OK, got %lu/%08lx\n", n, ret);
1004 cpinfo_cmp(&cpinfo[i + 1], &cpinfo2);
1005 }
1006
1007 HeapFree(GetProcessHeap(), 0, cpinfo);
1008 IEnumCodePage_Release(iEnumCP);
1009}
#define skip(...)
Definition: atltest.h:64
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI IsValidCodePage(UINT codepage)
Definition: locale.c:2081
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
size_t total
GLdouble n
Definition: glext.h:7729
GLbitfield flags
Definition: glext.h:7161
static const WCHAR autoW[]
Definition: htmlbody.c:590
#define wine_dbgstr_w
Definition: kernel32.h:34
int winetest_debug
static HRESULT check_convertible(IMultiLanguage2 *iML2, UINT from, UINT to)
Definition: mlang.c:738
static void cpinfo_cmp(MIMECPINFO *cpinfo1, MIMECPINFO *cpinfo2)
Definition: mlang.c:699
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define LANG_NEUTRAL
Definition: nls.h:22
UINT ciCharset
Definition: wingdi.h:1992
int32_t INT_PTR
Definition: typedefs.h:64
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)
#define TCI_SRCCODEPAGE
Definition: wingdi.h:962

Referenced by START_TEST().

◆ test_EnumScripts()

static void test_EnumScripts ( IMultiLanguage2 *  iML2,
DWORD  flags 
)
static

Definition at line 1062 of file mlang.c.

1063{
1064 IEnumScript *iEnumScript = NULL;
1065 SCRIPTINFO *sinfo;
1066 SCRIPTINFO sinfo2;
1067 HRESULT ret;
1068 ULONG i, n;
1069 UINT total;
1070
1071 total = 0;
1072 ret = IMultiLanguage2_GetNumberOfScripts(iML2, &total);
1073 ok(ret == S_OK && total != 0, "IMultiLanguage2_GetNumberOfScripts: expected S_OK/!0, got %08lx/%u\n", ret, total);
1074
1075 trace("total mlang supported scripts %u\n", total);
1076
1077 ret = IMultiLanguage2_EnumScripts(iML2, flags, LANG_NEUTRAL, &iEnumScript);
1078 ok(ret == S_OK && iEnumScript, "IMultiLanguage2_EnumScripts: expected S_OK/!NULL, got %08lx/%p\n", ret, iEnumScript);
1079
1080 ret = IEnumScript_Reset(iEnumScript);
1081 ok(ret == S_OK, "IEnumScript_Reset: expected S_OK, got %08lx\n", ret);
1082 n = 65536;
1083 ret = IEnumScript_Next(iEnumScript, 0, NULL, &n);
1084 ok(n == 65536 && ret == E_FAIL, "IEnumScript_Next: expected 65536/E_FAIL, got %lu/%08lx\n", n, ret);
1085 ret = IEnumScript_Next(iEnumScript, 0, NULL, NULL);
1086 ok(ret == E_FAIL, "IEnumScript_Next: expected E_FAIL, got %08lx\n", ret);
1087
1088 sinfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*sinfo) * total * 2);
1089
1090 n = total * 2;
1091 ret = IEnumScript_Next(iEnumScript, 0, sinfo, &n);
1092 ok(ret == S_FALSE && n == 0, "IEnumScript_Next: expected S_FALSE/0, got %08lx/%lu\n", ret, n);
1093
1094 n = total * 2;
1095 ret = IEnumScript_Next(iEnumScript, n, sinfo, &n);
1096 ok(ret == S_OK && n != 0, "IEnumScript_Next: expected S_OK, got %08lx/%lu\n", ret, n);
1097
1098 trace("flags %08lx, enumerated scripts %lu\n", flags, n);
1099
1100 if (!flags)
1101 {
1102 ok(n == total, "IEnumScript_Next: expected %u, got %lu\n", total, n);
1103 }
1104
1105 total = n;
1106
1107 for (i = 0; pGetCPInfoExA && i < n; i++)
1108 {
1109#ifdef DUMP_SCRIPT_INFO
1110 trace("SCRIPTINFO #%u:\n"
1111 "ScriptId %08x\n"
1112 "uiCodePage %u\n"
1113 "wszDescription %s\n"
1114 "wszFixedWidthFont %s\n"
1115 "wszProportionalFont %s\n\n",
1116 i,
1117 sinfo[i].ScriptId,
1118 sinfo[i].uiCodePage,
1119 wine_dbgstr_w(sinfo[i].wszDescription),
1120 wine_dbgstr_w(sinfo[i].wszFixedWidthFont),
1121 wine_dbgstr_w(sinfo[i].wszProportionalFont));
1122 trace("%u codepage %u\n", i, sinfo[i].uiCodePage);
1123#endif
1124 }
1125
1126 /* now IEnumScript_Next should fail, since pointer is at the end */
1127 n = 1;
1128 ret = IEnumScript_Next(iEnumScript, 1, &sinfo2, &n);
1129 ok(ret == S_FALSE && n == 0, "IEnumScript_Next: expected S_FALSE/0, got %08lx/%lu\n", ret, n);
1130
1131 ret = IEnumScript_Reset(iEnumScript);
1132 ok(ret == S_OK, "IEnumScript_Reset: expected S_OK, got %08lx\n", ret);
1133 n = 0;
1134 ret = IEnumScript_Next(iEnumScript, 1, &sinfo2, &n);
1135 ok(n == 1 && ret == S_OK, "IEnumScript_Next: expected 1/S_OK, got %lu/%08lx\n", n, ret);
1136 scriptinfo_cmp(sinfo, &sinfo2);
1137
1138 if (0)
1139 {
1140 /* Due to a bug in MS' implementation of IEnumScript_Skip
1141 * it's not used here.
1142 */
1143 ret = IEnumScript_Skip(iEnumScript, 1);
1144 ok(ret == S_OK, "IEnumScript_Skip: expected S_OK, got %08lx\n", ret);
1145 }
1146 for (i = 0; i < total - 1; i++)
1147 {
1148 n = 0;
1149 ret = IEnumScript_Next(iEnumScript, 1, &sinfo2, &n);
1150 ok(n == 1 && ret == S_OK, "IEnumScript_Next: expected 1/S_OK, got %lu/%08lx\n", n, ret);
1151 scriptinfo_cmp(&sinfo[i + 1], &sinfo2);
1152 }
1153
1155 IEnumScript_Release(iEnumScript);
1156}
static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
Definition: mlang.c:1053
Definition: general.c:220

Referenced by START_TEST().

◆ test_GetCharsetInfo_other()

static void test_GetCharsetInfo_other ( IMultiLanguage *  ml)
static

Definition at line 1011 of file mlang.c.

1012{
1013 WCHAR asciiW[] = {'a','s','c','i','i',0};
1014 WCHAR iso88591_1W[] = {'I','S','O','-','8','8','5','9','-','1',0};
1015 WCHAR iso88591_1retW[] = {'i','s','o','-','8','8','5','9','-','1',0};
1016 WCHAR iso88591_2W[] = {'I','S','O','8','8','5','9','-','1',0};
1017 WCHAR iso88591_2retW[] = {'i','s','o','8','8','5','9','-','1',0};
1018 WCHAR iso88591_3W[] = {'I','S','O','8','8','5','9','1',0};
1019 WCHAR iso88591_4W[] = {'I','S','O','-','8','8','5','9','1',0};
1020 WCHAR iso88591_5W[] = {'I','S','O','8','8','-','5','9','1',0};
1021 WCHAR iso88591_6W[] = {'-','I','S','O','8','8','5','9','1',0};
1022 WCHAR iso88591_7W[] = {' ','I','S','O','-','8','8','5','9','-','1',0};
1023 struct other {
1024 HRESULT hr;
1025 WCHAR* charset;
1026 WCHAR* ret_charset;
1027 } other[] = {
1028 { S_OK, asciiW, asciiW },
1029 { S_OK, iso88591_1W, iso88591_1retW },
1030 { S_OK, iso88591_2W, iso88591_2retW },
1031 { E_FAIL, iso88591_3W, 0 },
1032 { E_FAIL, iso88591_4W, 0 },
1033 { E_FAIL, iso88591_5W, 0 },
1034 { E_FAIL, iso88591_6W, 0 },
1035 { E_FAIL, iso88591_7W, 0 },
1036 };
1037 MIMECSETINFO info;
1038 HRESULT hr;
1039 int i;
1040
1041 for (i = 0; i < ARRAY_SIZE(other); i++)
1042 {
1043 hr = IMultiLanguage_GetCharsetInfo(ml, other[i].charset, &info);
1044
1045 ok(hr == other[i].hr, "#%d: got %08lx, expected %08lx\n", i, hr, other[i].hr);
1046
1047 if (hr == S_OK)
1048 ok(!lstrcmpW(info.wszCharset, other[i].ret_charset), "#%d: got %s, expected %s\n",
1049 i, wine_dbgstr_w(info.wszCharset), wine_dbgstr_w(other[i].ret_charset));
1050 }
1051}
CFF_Charset charset
Definition: cffcmap.c:137
int other
Definition: msacm.c:1376

Referenced by START_TEST().

◆ test_GetCodePageInfo()

static void test_GetCodePageInfo ( IMultiLanguage2 *  iML2)
static

Definition at line 2638 of file mlang.c.

2639{
2640 static const DWORD VALID_MASK = (DWORD)(~(MIMECONTF_VALID_NLS | MIMECONTF_VALID));
2641
2642 const struct cpinfo_test_data *test_data = NULL;
2643 UINT test_data_num;
2644 MIMECPINFO cpinfo_cmp;
2645 MIMECPINFO cpinfo;
2646 UINT i;
2647 HRESULT ret;
2648
2650 test_data_num = ARRAY_SIZE(iml2_cpinfo_data);
2651 for (i = 0; i < test_data_num; i++)
2652 {
2653 ret = IMultiLanguage2_GetCodePageInfo(iML2, test_data[i].cpinfo.uiCodePage, LANG_NEUTRAL, &cpinfo);
2655 ok(ret == S_OK, "%d: IMultiLanguage2_GetCodePageInfo failed: 0x%08lx.\n", i, ret);
2656
2657 if (ret == S_OK)
2658 {
2659 cpinfo_cmp = test_data[i].cpinfo;
2661 ok((cpinfo.dwFlags == cpinfo_cmp.dwFlags ) ||
2662 /* some code pages are not installed on the Wine Test Bot */
2663 ((cpinfo.dwFlags & VALID_MASK) == (cpinfo_cmp.dwFlags & VALID_MASK)),
2664 "%d: got wrong dwFlags expected 0x%lx return 0x%lx.\n",
2665 i, cpinfo_cmp.dwFlags, cpinfo.dwFlags);
2666 ok(cpinfo.uiCodePage == cpinfo_cmp.uiCodePage,
2667 "%d: got wrong uiCodePage expected %u return %u.\n",
2668 i, cpinfo_cmp.uiCodePage, cpinfo.uiCodePage);
2670 ok(cpinfo.uiFamilyCodePage == cpinfo_cmp.uiFamilyCodePage,
2671 "%d: got wrong uiFamilyCodePage expected %u return %u.\n",
2672 i, cpinfo_cmp.uiFamilyCodePage, cpinfo.uiFamilyCodePage);
2673
2675 ok(!lstrcmpW(cpinfo.wszWebCharset, cpinfo_cmp.wszWebCharset),
2676 "%d: got wrong wszWebCharset expected %s return %s.\n",
2677 i, wine_dbgstr_w(cpinfo_cmp.wszWebCharset), wine_dbgstr_w(cpinfo.wszWebCharset));
2679 ok(!lstrcmpW(cpinfo.wszHeaderCharset, cpinfo_cmp.wszHeaderCharset),
2680 "%d: got wrong wszHeaderCharset expected %s return %s.\n",
2681 i, wine_dbgstr_w(cpinfo_cmp.wszHeaderCharset), wine_dbgstr_w(cpinfo.wszHeaderCharset));
2683 ok(!lstrcmpW(cpinfo.wszBodyCharset, cpinfo_cmp.wszBodyCharset),
2684 "%d: got wrong wszBodyCharset expected %s return %s.\n",
2685 i, wine_dbgstr_w(cpinfo_cmp.wszBodyCharset), wine_dbgstr_w(cpinfo.wszBodyCharset));
2686
2687 if (!is_lang_english())
2688 {
2689 /* FIXME: Cannot test non-English descriptions and font names */
2690 skip("Non-English locale\n");
2691 }
2692 else
2693 {
2695 ok(!lstrcmpW(cpinfo.wszDescription, cpinfo_cmp.wszDescription),
2696 "%d: got wrong wszDescription expected %s return %s.\n",
2697 i, wine_dbgstr_w(cpinfo_cmp.wszDescription), wine_dbgstr_w(cpinfo.wszDescription));
2699 ok(!lstrcmpW(cpinfo.wszFixedWidthFont, cpinfo_cmp.wszFixedWidthFont),
2700 "%d: got wrong wszFixedWidthFont expected %s return %s.\n",
2701 i, wine_dbgstr_w(cpinfo_cmp.wszFixedWidthFont), wine_dbgstr_w(cpinfo.wszFixedWidthFont));
2703 ok(!lstrcmpW(cpinfo.wszProportionalFont, cpinfo_cmp.wszProportionalFont),
2704 "%d: got wrong wszProportionalFont expected %s return %s.\n",
2705 i, wine_dbgstr_w(cpinfo_cmp.wszProportionalFont), wine_dbgstr_w(cpinfo.wszProportionalFont));
2706 }
2707 }
2708 }
2709}
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static const struct cpinfo_test_data iml2_cpinfo_data[]
Definition: mlang.c:244
static BOOL is_lang_english(void)
Definition: mlang.c:2618
#define DWORD
Definition: nt_native.h:44
BOOL todo_wszFixedWidthFont
Definition: mlang.c:240
BOOL todo_wszDescription
Definition: mlang.c:236
MIMECPINFO cpinfo
Definition: mlang.c:231
BOOL todo_uiFamilyCodePage
Definition: mlang.c:235
BOOL todo_wszBodyCharset
Definition: mlang.c:239
BOOL todo_wszProportionalFont
Definition: mlang.c:241
BOOL todo_wszHeaderCharset
Definition: mlang.c:238
BOOL todo_dwFlags
Definition: mlang.c:234
BOOL todo_GetCodePageInfo
Definition: mlang.c:233
BOOL todo_wszWebCharset
Definition: mlang.c:237

Referenced by START_TEST().

◆ test_GetFontUnicodeRanges()

static void test_GetFontUnicodeRanges ( IMLangFontLink2 *  font_link)
static

Definition at line 2239 of file mlang.c.

2240{
2241 HRESULT hr;
2242 UINT count;
2243 HFONT hfont, old_hfont;
2244 LOGFONTA lf;
2245 HDC hdc;
2246 UNICODERANGE *ur;
2247
2249 memset(&lf, 0, sizeof(lf));
2250 lstrcpyA(lf.lfFaceName, "Arial");
2252 old_hfont = SelectObject(hdc, hfont);
2253
2254 count = 0;
2255 hr = IMLangFontLink2_GetFontUnicodeRanges(font_link, NULL, &count, NULL);
2256 ok(hr == E_FAIL, "expected E_FAIL, got 0x%08lx\n", hr);
2257
2258 hr = IMLangFontLink2_GetFontUnicodeRanges(font_link, hdc, NULL, NULL);
2259 ok(hr == E_INVALIDARG, "expected E_FAIL, got 0x%08lx\n", hr);
2260
2261 count = 0;
2262 hr = IMLangFontLink2_GetFontUnicodeRanges(font_link, hdc, &count, NULL);
2263 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2264 ok(count, "expected count > 0\n");
2265
2266 ur = HeapAlloc(GetProcessHeap(), 0, sizeof(*ur) * count);
2267
2268 hr = IMLangFontLink2_GetFontUnicodeRanges(font_link, hdc, &count, ur);
2269 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2270
2271 count--;
2272 hr = IMLangFontLink2_GetFontUnicodeRanges(font_link, hdc, &count, ur);
2273 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2274
2275 HeapFree(GetProcessHeap(), 0, ur);
2276
2277 SelectObject(hdc, old_hfont);
2279 DeleteDC(hdc);
2280}
static HFONT hfont
pKey DeleteObject()
GLuint GLuint GLsizei count
Definition: gl.h:1545
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
HFONT WINAPI CreateFontIndirectA(_In_ const LOGFONTA *)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

◆ test_GetGlobalFontLinkObject()

static void test_GetGlobalFontLinkObject ( void  )
static

Definition at line 2302 of file mlang.c.

2303{
2304 HRESULT ret;
2305 void *unknown;
2306 LONG refcount;
2307 IMLangFontLink2 *IMLFL2;
2308 IMLangFontLink *IMLFL;
2309 IMLangCodePages *IMLCP;
2310 IMultiLanguage *IML;
2311 IMultiLanguage2 *IML2;
2312
2314 ok(ret == E_INVALIDARG, "expected E_INVALIDARG got %#lx\n", ret);
2315
2316 unknown = (void *)0xdeadbeef;
2317 ret = GetGlobalFontLinkObject((IMLangFontLink**)&unknown);
2318 ok(ret == S_OK, "expected S_OK got %#lx\n", ret);
2319 ok(unknown != NULL && unknown != (void *)0xdeadbeef,
2320 "GetGlobalFontLinkObject() returned %p\n", unknown);
2321 if (unknown == (void *)0xdeadbeef || !unknown) return;
2322
2323 ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink2, (void**)&IMLFL2);
2324 todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
2325 if (ret == S_OK) IMLangFontLink2_Release(IMLFL2);
2326
2327 ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMultiLanguage, (void**)&IML);
2328 todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
2329 if (ret == S_OK) IMultiLanguage_Release(IML);
2330
2331 ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMultiLanguage2, (void**)&IML2);
2332 todo_wine ok(ret == E_NOINTERFACE, "expected E_NOINTERFACE got %#lx\n", ret);
2333 if (ret == S_OK) IMultiLanguage2_Release(IML2);
2334
2335 ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangFontLink, (void**)&IMLFL);
2336 ok(ret == S_OK, "expected S_OK got %#lx\n", ret);
2337 IMLangFontLink_Release(IMLFL);
2338
2339 ret = IUnknown_QueryInterface((IUnknown*)unknown, &IID_IMLangCodePages, (void**)&IMLCP);
2340 ok(ret == S_OK, "expected S_OK got %#lx\n", ret);
2341 IMLangCodePages_Release(IMLCP);
2342
2343 ok(unknown == IMLFL, "IUnknown from GetGlobalFontLinkObject isn't IMLangFontLink\n");
2344 ok(unknown == IMLCP, "IUnknown from GetGlobalFontLinkObject isn't IMLangCodePages\n");
2345
2346 refcount = IUnknown_Release((IUnknown*)unknown);
2347 ok(refcount == 1, "Got refcount %ld\n", refcount);
2348}
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
HRESULT WINAPI GetGlobalFontLinkObject(IMLangFontLink **obj)
Definition: mlang.c:3931

Referenced by START_TEST().

◆ test_GetLcidFromRfc1766()

static void test_GetLcidFromRfc1766 ( IMultiLanguage2 *  iML2)
static

Definition at line 1404 of file mlang.c.

1405{
1406 WCHAR rfc1766W[MAX_RFC1766_NAME + 1];
1407 LCID lcid;
1408 HRESULT ret;
1409 DWORD i;
1410
1411 static WCHAR en[] = { 'e','n',0 };
1412 static WCHAR en_them[] = { 'e','n','-','t','h','e','m',0 };
1413 static WCHAR english[] = { 'e','n','g','l','i','s','h',0 };
1414
1415
1416 for(i = 0; i < ARRAY_SIZE(lcid_table); i++) {
1417 lcid = -1;
1418 MultiByteToWideChar(CP_ACP, 0, lcid_table[i].rfc1766, -1, rfc1766W, MAX_RFC1766_NAME);
1419 ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, &lcid, rfc1766W);
1420
1421 /* IE <6.0 guess 0x412 (ko) from "kok" */
1422 ok((ret == lcid_table[i].hr) ||
1423 broken(lcid_table[i].broken_lcid && (ret == S_FALSE)),
1424 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i, ret, lcid_table[i].hr);
1425
1426 ok((lcid == lcid_table[i].lcid) ||
1427 broken(lcid == lcid_table[i].broken_lcid), /* IE <6.0 */
1428 "#%02ld: got LCID 0x%lx (expected 0x%lx)\n", i, lcid, lcid_table[i].lcid);
1429 }
1430
1431
1432 ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, NULL, en);
1433 ok(ret == E_INVALIDARG, "GetLcidFromRfc1766 returned: %08lx\n", ret);
1434
1435 ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, &lcid, NULL);
1436 ok(ret == E_INVALIDARG, "GetLcidFromRfc1766 returned: %08lx\n", ret);
1437
1438 ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, &lcid, en_them);
1439 ok((ret == E_FAIL || ret == S_FALSE), "GetLcidFromRfc1766 returned: %08lx\n", ret);
1440 if (ret == S_FALSE)
1441 {
1442 BSTR rfcstr;
1443 static WCHAR en[] = {'e','n',0};
1444
1445 ret = IMultiLanguage2_GetRfc1766FromLcid(iML2, lcid, &rfcstr);
1446 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
1447 ok_w2("Expected \"%s\", got \"%s\"n", en, rfcstr);
1448 }
1449
1450 ret = IMultiLanguage2_GetLcidFromRfc1766(iML2, &lcid, english);
1451 ok((ret == E_FAIL || ret == S_FALSE), "GetLcidFromRfc1766 returned: %08lx\n", ret);
1452 if (ret == S_FALSE)
1453 {
1454 BSTR rfcstr;
1455 static WCHAR en[] = {'e','n',0};
1456
1457 ret = IMultiLanguage2_GetRfc1766FromLcid(iML2, lcid, &rfcstr);
1458 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
1459 ok_w2("Expected \"%s\", got \"%s\"n", en, rfcstr);
1460 }
1461
1462}
#define broken(x)
Definition: atltest.h:178
OLECHAR * BSTR
Definition: compat.h:2293
#define MultiByteToWideChar
Definition: compat.h:110
LCID lcid
Definition: locale.c:5656
#define ok_w2(format, szString1, szString2)
Definition: mlang.c:556
static const lcid_table_entry lcid_table[]
Definition: mlang.c:62
DWORD LCID
Definition: nls.h:13
static const LCID english
Definition: wbemdisp.c:32

Referenced by START_TEST().

◆ test_GetNumberOfCodePageInfo()

static void test_GetNumberOfCodePageInfo ( IMultiLanguage2 *  iML2)
static

Definition at line 1491 of file mlang.c.

1492{
1493 HRESULT hr;
1494 UINT value;
1495
1496 value = 0xdeadbeef;
1497 hr = IMultiLanguage2_GetNumberOfCodePageInfo(iML2, &value);
1498 ok( (hr == S_OK) && value,
1499 "got 0x%lx with %d (expected S_OK with '!= 0')\n", hr, value);
1500
1501 hr = IMultiLanguage2_GetNumberOfCodePageInfo(iML2, NULL);
1502 ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
1503
1504}
Definition: pdh_main.c:96

Referenced by START_TEST().

◆ test_GetRfc1766FromLcid()

static void test_GetRfc1766FromLcid ( IMultiLanguage2 *  iML2)
static

Definition at line 1506 of file mlang.c.

1507{
1508 CHAR expected[MAX_RFC1766_NAME];
1509 CHAR buffer[MAX_RFC1766_NAME + 1];
1510 DWORD i;
1511 HRESULT hr;
1512 BSTR rfcstr;
1513
1514 for(i = 0; i < ARRAY_SIZE(lcid_table); i++) {
1515 buffer[0] = '\0';
1516
1517 rfcstr = NULL;
1518 hr = IMultiLanguage2_GetRfc1766FromLcid(iML2, lcid_table[i].lcid, &rfcstr);
1519 ok(hr == lcid_table[i].hr,
1520 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i, hr, lcid_table[i].hr);
1521
1522 if (hr != S_OK)
1523 continue; /* no result-string created */
1524
1525 WideCharToMultiByte(CP_ACP, 0, rfcstr, -1, buffer, sizeof(buffer), NULL, NULL);
1527 lstrlenA(lcid_table[i].rfc1766) + 1, expected, MAX_RFC1766_NAME);
1528
1529 /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
1530 ok( (!lstrcmpA(buffer, expected)) ||
1531 broken(!lstrcmpA(buffer, lcid_table[i].broken_rfc)),
1532 "#%02ld: got '%s' (expected '%s')\n", i, buffer, expected);
1533
1534 SysFreeString(rfcstr);
1535 }
1536
1537 hr = IMultiLanguage2_GetRfc1766FromLcid(iML2, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NULL);
1538 ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
1539}
INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: locale.c:3834
GLuint buffer
Definition: glext.h:5915
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
BOOL expected
Definition: store.c:2000
#define LOCALE_USER_DEFAULT
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
#define LCMAP_LOWERCASE
Definition: winnls.h:197

Referenced by START_TEST().

◆ test_GetRfc1766Info()

static void test_GetRfc1766Info ( IMultiLanguage2 *  iML2)
static

Definition at line 1593 of file mlang.c.

1594{
1595 WCHAR short_broken_name[MAX_LOCALE_NAME];
1596 CHAR rfc1766A[MAX_RFC1766_NAME + 1];
1597 BYTE buffer[sizeof(RFC1766INFO) + 4];
1598 PRFC1766INFO prfc = (RFC1766INFO *) buffer;
1599 HRESULT ret;
1600 DWORD i;
1601
1602 for(i = 0; i < ARRAY_SIZE(info_table); i++) {
1603 memset(buffer, 'x', sizeof(RFC1766INFO) + 2);
1604 buffer[sizeof(buffer) -1] = 0;
1605 buffer[sizeof(buffer) -2] = 0;
1606
1607 ret = IMultiLanguage2_GetRfc1766Info(iML2, info_table[i].lcid, info_table[i].lang, prfc);
1608 WideCharToMultiByte(CP_ACP, 0, prfc->wszRfc1766, -1, rfc1766A, MAX_RFC1766_NAME, NULL, NULL);
1609 ok(ret == S_OK, "#%02ld: got 0x%lx (expected S_OK)\n", i, ret);
1610 ok(prfc->lcid == info_table[i].lcid,
1611 "#%02ld: got 0x%04lx (expected 0x%04lx)\n", i, prfc->lcid, info_table[i].lcid);
1612
1613 ok(!lstrcmpA(rfc1766A, info_table[i].rfc1766),
1614 "#%02ld: got '%s' (expected '%s')\n", i, rfc1766A, info_table[i].rfc1766);
1615
1616 /* Some IE versions truncate an oversized name one character too short */
1617 if (info_table[i].broken_name) {
1618 lstrcpyW(short_broken_name, info_table[i].broken_name);
1619 short_broken_name[MAX_LOCALE_NAME - 2] = 0;
1620 }
1621
1623 ok( (!lstrcmpW(prfc->wszLocaleName, info_table[i].localename)) ||
1624 (info_table[i].broken_name && (
1625 broken(!lstrcmpW(prfc->wszLocaleName, info_table[i].broken_name)) || /* IE < 6.0 */
1626 broken(!lstrcmpW(prfc->wszLocaleName, short_broken_name)))),
1627 "#%02ld: got %s (expected %s)\n", i,
1628 wine_dbgstr_w(prfc->wszLocaleName), wine_dbgstr_w(info_table[i].localename));
1629 }
1630 }
1631
1632 /* SUBLANG_NEUTRAL only allowed for English, Arabic, Chinese */
1633 ret = IMultiLanguage2_GetRfc1766Info(iML2, MAKELANGID(LANG_GERMAN, SUBLANG_NEUTRAL), LANG_ENGLISH, prfc);
1634 ok(ret == E_FAIL, "got 0x%lx (expected E_FAIL)\n", ret);
1635
1636 ret = IMultiLanguage2_GetRfc1766Info(iML2, MAKELANGID(LANG_ITALIAN, SUBLANG_NEUTRAL), LANG_ENGLISH, prfc);
1637 ok(ret == E_FAIL, "got 0x%lx (expected E_FAIL)\n", ret);
1638
1639 /* NULL not allowed */
1640 ret = IMultiLanguage2_GetRfc1766Info(iML2, 0, LANG_ENGLISH, prfc);
1641 ok(ret == E_FAIL, "got 0x%lx (expected E_FAIL)\n", ret);
1642
1643 ret = IMultiLanguage2_GetRfc1766Info(iML2, LANG_ENGLISH, LANG_ENGLISH, NULL);
1644 ok(ret == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", ret);
1645}
#define lstrcpyW
Definition: compat.h:749
BOOL todo
Definition: filedlg.c:313
static const info_table_entry info_table[]
Definition: mlang.c:166
#define TODO_NAME
Definition: mlang.c:103
#define LANG_GERMAN
Definition: nls.h:62
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define LANG_ITALIAN
Definition: nls.h:75
LPCWSTR localename
Definition: mlang.c:110
LPCWSTR broken_name
Definition: mlang.c:111
LCID lcid
Definition: mlang.c:106
static const WCHAR lang[]
Definition: wbemdisp.c:287

Referenced by START_TEST().

◆ test_GetScriptFontInfo()

static void test_GetScriptFontInfo ( IMLangFontLink2 *  font_link)
static

Definition at line 2159 of file mlang.c.

2160{
2161 HRESULT hr;
2162 UINT nfonts;
2163 SCRIPTFONTINFO sfi[1];
2164
2165 nfonts = 0;
2166 hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidAsciiLatin, 0, &nfonts, NULL);
2167 ok(hr == S_OK, "GetScriptFontInfo failed %lu\n", GetLastError());
2168 ok(nfonts, "unexpected result\n");
2169
2170 nfonts = 0;
2171 hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidAsciiLatin, SCRIPTCONTF_FIXED_FONT, &nfonts, NULL);
2172 ok(hr == S_OK, "GetScriptFontInfo failed %lu\n", GetLastError());
2173 ok(nfonts, "unexpected result\n");
2174
2175 nfonts = 0;
2176 hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidAsciiLatin, SCRIPTCONTF_PROPORTIONAL_FONT, &nfonts, NULL);
2177 ok(hr == S_OK, "GetScriptFontInfo failed %lu\n", GetLastError());
2178 ok(nfonts, "unexpected result\n");
2179
2180 nfonts = 1;
2181 memset(sfi, 0, sizeof(sfi));
2182 hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidAsciiLatin, SCRIPTCONTF_FIXED_FONT, &nfonts, sfi);
2183 ok(hr == S_OK, "GetScriptFontInfo failed %lu\n", GetLastError());
2184 ok(nfonts == 1, "got %u, expected 1\n", nfonts);
2185 ok(sfi[0].scripts != 0, "unexpected result\n");
2186 ok(sfi[0].wszFont[0], "unexpected result\n");
2187
2188 nfonts = 1;
2189 memset(sfi, 0, sizeof(sfi));
2190 hr = IMLangFontLink2_GetScriptFontInfo(font_link, sidAsciiLatin, SCRIPTCONTF_PROPORTIONAL_FONT, &nfonts, sfi);
2191 ok(hr == S_OK, "GetScriptFontInfo failed %lu\n", GetLastError());
2192 ok(nfonts == 1, "got %u, expected 1\n", nfonts);
2193 ok(sfi[0].scripts != 0, "unexpected result\n");
2194 ok(sfi[0].wszFont[0], "unexpected result\n");
2195}

Referenced by START_TEST().

◆ test_IMLangConvertCharset()

static void test_IMLangConvertCharset ( IMultiLanguage *  ml)
static

Definition at line 2350 of file mlang.c.

2351{
2352 IMLangConvertCharset *convert;
2353 WCHAR strW[] = {'a','b','c','d',0};
2354 UINT cp, src_size, dst_size;
2355 char strA[] = "abcd";
2356 WCHAR buffW[20];
2357 HRESULT hr;
2358
2359 hr = IMultiLanguage_CreateConvertCharset(ml, CP_ACP, CP_UTF8, 0, &convert);
2360 todo_wine
2361 ok(hr == S_FALSE, "expected S_FALSE got 0x%08lx\n", hr);
2362
2363 hr = IMLangConvertCharset_GetSourceCodePage(convert, NULL);
2364 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2365
2366 cp = CP_UTF8;
2367 hr = IMLangConvertCharset_GetSourceCodePage(convert, &cp);
2368 ok(hr == S_OK, "expected S_OK got 0x%08lx\n", hr);
2369 ok(cp == CP_ACP, "got %d\n", cp);
2370
2371 hr = IMLangConvertCharset_GetDestinationCodePage(convert, NULL);
2372 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2373
2374 cp = CP_ACP;
2375 hr = IMLangConvertCharset_GetDestinationCodePage(convert, &cp);
2376 ok(hr == S_OK, "expected S_OK got 0x%08lx\n", hr);
2377 ok(cp == CP_UTF8, "got %d\n", cp);
2378
2379 /* DoConversionToUnicode */
2380 hr = IMLangConvertCharset_Initialize(convert, CP_UTF8, CP_UNICODE, 0);
2381 ok(hr == S_OK, "expected S_OK got 0x%08lx\n", hr);
2382
2383 hr = IMLangConvertCharset_DoConversionToUnicode(convert, NULL, NULL, NULL, NULL);
2384 ok(hr == E_FAIL || broken(hr == S_OK) /* win2k */, "got 0x%08lx\n", hr);
2385
2386 src_size = -1;
2387 dst_size = 20;
2388 buffW[0] = 0;
2389 buffW[4] = 4;
2390 hr = IMLangConvertCharset_DoConversionToUnicode(convert, strA, &src_size, buffW, &dst_size);
2391 ok(hr == S_OK, "got 0x%08lx\n", hr);
2392 ok(!memcmp(buffW, strW, 4*sizeof(WCHAR)), "got converted string %s\n", wine_dbgstr_wn(buffW, dst_size));
2393 ok(dst_size == 4, "got %d\n", dst_size);
2394 ok(buffW[4] == 4, "got %d\n", buffW[4]);
2395 ok(src_size == 4, "got %d\n", src_size);
2396
2397 src_size = -1;
2398 dst_size = 0;
2399 buffW[0] = 1;
2400 hr = IMLangConvertCharset_DoConversionToUnicode(convert, strA, &src_size, buffW, &dst_size);
2401 ok(hr == S_OK, "got 0x%08lx\n", hr);
2402 ok(buffW[0] == 1, "got %d\n", buffW[0]);
2403 ok(dst_size == 4, "got %d\n", dst_size);
2404 ok(src_size == 4, "got %d\n", src_size);
2405
2406 hr = IMLangConvertCharset_Initialize(convert, CP_UNICODE, CP_UNICODE, 0);
2407 ok(hr == S_OK, "expected S_OK got 0x%08lx\n", hr);
2408
2409 IMLangConvertCharset_Release(convert);
2410}
char strA[12]
Definition: clipboard.c:2215
#define wine_dbgstr_wn
Definition: testlist.c:2

Referenced by START_TEST().

◆ test_IMultiLanguage2_ConvertStringFromUnicode()

static void test_IMultiLanguage2_ConvertStringFromUnicode ( IMultiLanguage2 *  iML2)
static

Definition at line 1647 of file mlang.c.

1648{
1650 CHAR invariate[MAX_PATH];
1651 UINT srcsz, destsz;
1652 HRESULT hr;
1653
1654 static WCHAR src[] = {'a','b','c',0};
1655
1656 memset(invariate, 'x', sizeof(invariate));
1657
1658 /* pSrcStr NULL */
1659 memset(dest, 'x', sizeof(dest));
1660 srcsz = lstrlenW(src) + 1;
1661 destsz = sizeof(dest);
1662 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, NULL,
1663 &srcsz, dest, &destsz);
1664 ok(hr == S_OK || hr == E_FAIL,"expected S_OK or E_FAIL, got %08lx\n",hr);
1665 if (hr == S_OK)
1666 {
1667 ok(srcsz == lstrlenW(src) + 1,
1668 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1669 }
1670 else if (hr == E_FAIL)
1671 {
1672 ok(srcsz == 0,
1673 "Expected %u, got %u\n", 0, srcsz);
1674 }
1675
1676 ok(!memcmp(dest, invariate, sizeof(dest)),
1677 "Expected dest to be unchanged, got %s\n", dest);
1678 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1679
1680 /* pcSrcSize NULL */
1681 memset(dest, 'x', sizeof(dest));
1682 destsz = sizeof(dest);
1683 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1684 NULL, dest, &destsz);
1685 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1686 ok(!strncmp(dest, "abc", 3),
1687 "Expected first three chars to be \"abc\"\n");
1688 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1689 "Expected rest of dest to be unchanged, got %s\n", dest);
1690 ok(destsz == lstrlenW(src),
1691 "Expected %u, got %u\n", lstrlenW(src), destsz);
1692
1693 /* both pSrcStr and pcSrcSize NULL */
1694 memset(dest, 'x', sizeof(dest));
1695 destsz = sizeof(dest);
1696 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, NULL,
1697 NULL, dest, &destsz);
1698 ok(hr == S_OK || hr == E_FAIL, "Expected S_OK or E_FAIL, got %08lx\n", hr);
1699 ok(!memcmp(dest, invariate, sizeof(dest)),
1700 "Expected dest to be unchanged, got %s\n", dest);
1701 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1702
1703 /* pDstStr NULL */
1704 memset(dest, 'x', sizeof(dest));
1705 srcsz = lstrlenW(src) + 1;
1706 destsz = sizeof(dest);
1707 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1708 &srcsz, NULL, &destsz);
1709 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1710 ok(srcsz == lstrlenW(src) + 1,
1711 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1712 ok(destsz == lstrlenW(src) + 1,
1713 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1714
1715 /* pcDstSize NULL */
1716 memset(dest, 'x', sizeof(dest));
1717 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1718 &srcsz, dest, NULL);
1719 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1720 ok(srcsz == lstrlenW(src) + 1,
1721 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1722 ok(!memcmp(dest, invariate, sizeof(dest)),
1723 "Expected dest to be unchanged, got %s\n", dest);
1724
1725 /* pcSrcSize is 0 */
1726 memset(dest, 'x', sizeof(dest));
1727 srcsz = 0;
1728 destsz = sizeof(dest);
1729 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1730 &srcsz, dest, &destsz);
1731 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1732 ok(srcsz == 0, "Expected 0, got %u\n", srcsz);
1733 ok(!memcmp(dest, invariate, sizeof(dest)),
1734 "Expected dest to be unchanged, got %s\n", dest);
1735 ok(destsz == 0, "Expected 0, got %u\n", destsz);
1736
1737 /* pcSrcSize does not include NULL terminator */
1738 memset(dest, 'x', sizeof(dest));
1739 srcsz = lstrlenW(src);
1740 destsz = sizeof(dest);
1741 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1742 &srcsz, dest, &destsz);
1743 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1744 ok(srcsz == lstrlenW(src),
1745 "Expected %u, got %u\n", lstrlenW(src), srcsz);
1746 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1747 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1748 "Expected rest of dest to be unchanged, got %s\n", dest);
1749 ok(destsz == lstrlenW(src),
1750 "Expected %u, got %u\n", lstrlenW(src), destsz);
1751
1752 /* pcSrcSize includes NULL terminator */
1753 memset(dest, 'x', sizeof(dest));
1754 srcsz = lstrlenW(src) + 1;
1755 destsz = sizeof(dest);
1756 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1757 &srcsz, dest, &destsz);
1758 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1759 ok(srcsz == lstrlenW(src) + 1, "Expected 3, got %u\n", srcsz);
1760 ok(!lstrcmpA(dest, "abc"), "Expected \"abc\", got \"%s\"\n", dest);
1761 ok(destsz == lstrlenW(src) + 1,
1762 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1763
1764 /* pcSrcSize is -1 */
1765 memset(dest, 'x', sizeof(dest));
1766 srcsz = -1;
1767 destsz = sizeof(dest);
1768 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1769 &srcsz, dest, &destsz);
1770 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1771 ok(srcsz == lstrlenW(src),
1772 "Expected %u, got %u\n", lstrlenW(src), srcsz);
1773 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1774 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1775 "Expected rest of dest to be unchanged, got %s\n", dest);
1776 ok(destsz == lstrlenW(src),
1777 "Expected %u, got %u\n", lstrlenW(src), destsz);
1778
1779 /* pcDstSize is 0 */
1780 memset(dest, 'x', sizeof(dest));
1781 srcsz = lstrlenW(src) + 1;
1782 destsz = 0;
1783 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1784 &srcsz, dest, &destsz);
1785 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1786 ok(srcsz == lstrlenW(src) + 1,
1787 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1788 ok(!memcmp(dest, invariate, sizeof(dest)),
1789 "Expected dest to be unchanged, got %s\n", dest);
1790 ok(destsz == lstrlenW(src) + 1,
1791 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1792
1793 /* pcDstSize is not large enough */
1794 memset(dest, 'x', sizeof(dest));
1795 srcsz = lstrlenW(src) + 1;
1796 destsz = lstrlenW(src);
1797 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1798 &srcsz, dest, &destsz);
1799 ok(hr == E_FAIL, "Expected E_FAIL, got %08lx\n", hr);
1800 ok(srcsz == 0, "Expected 0, got %u\n", srcsz);
1801 ok(!strncmp(dest, "abc", 3), "Expected first three chars to be \"abc\"\n");
1802 ok(!memcmp(&dest[3], invariate, sizeof(dest) - 3),
1803 "Expected rest of dest to be unchanged, got %s\n", dest);
1804 ok(destsz == 0, "Expected 0, got %u\n", srcsz);
1805
1806 /* pcDstSize (bytes) does not leave room for NULL terminator */
1807 memset(dest, 'x', sizeof(dest));
1808 srcsz = lstrlenW(src) + 1;
1809 destsz = lstrlenW(src) * sizeof(WCHAR);
1810 hr = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, src,
1811 &srcsz, dest, &destsz);
1812 ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
1813 ok(srcsz == lstrlenW(src) + 1,
1814 "Expected %u, got %u\n", lstrlenW(src) + 1, srcsz);
1815 ok(!lstrcmpA(dest, "abc"), "Expected \"abc\", got \"%s\"\n", dest);
1816 ok(destsz == lstrlenW(src) + 1,
1817 "Expected %u, got %u\n", lstrlenW(src) + 1, destsz);
1818}

Referenced by START_TEST().

◆ test_IsCodePageInstallable()

static void test_IsCodePageInstallable ( IMultiLanguage2 *  ml2)
static

Definition at line 2282 of file mlang.c.

2283{
2284 UINT i;
2285 HRESULT hr;
2286
2287 for (i = 0; i < 1000; i++)
2288 {
2289 hr = IMultiLanguage2_IsCodePageInstallable(ml2, i);
2290
2291 /* it would be better to use IMultiLanguage2_ValidateCodePageEx here but that brings
2292 * up an installation dialog on some platforms, even when specifying CPIOD_PEEK.
2293 */
2294 if (IsValidCodePage(i))
2295 ok(hr == S_OK ||
2296 broken(hr == S_FALSE) || /* win2k */
2297 broken(hr == E_INVALIDARG), /* win2k */
2298 "code page %u is valid but not installable 0x%08lx\n", i, hr);
2299 }
2300}

Referenced by START_TEST().

◆ test_JapaneseConversion()

static void test_JapaneseConversion ( void  )
static

Definition at line 1976 of file mlang.c.

1977{
1978 /* Data */
1979 static WCHAR unc_jp[9][12] = {
1980 {9,0x31,0x20,0x3042,0x3044,0x3046,0x3048,0x304a,0x000d,0x000a},
1981 {9,0x31,0x20,0x30a2,0x30a4,0x30a6,0x30a8,0x30aa,0x000d,0x000a},
1982 {9,0x31,0x20,0xff71,0xff72,0xff73,0xff74,0xff75,0x000d,0x000a},
1983 {9,0x31,0x20,0x3041,0x3043,0x3045,0x3047,0x3049,0x000d,0x000a},
1984 {9,0x31,0x20,0x30a1,0x30a3,0x30a5,0x30a7,0x30a9,0x000d,0x000a},
1985 {9,0x31,0x20,0xff67,0xff68,0xff69,0xff6a,0xff6b,0x000d,0x000a},
1986 {9,0x31,0x20,0x300c,0x65e5,0x672c,0x8a9e,0x300d,0x000d,0x000a},
1987 {7,0x31,0x20,0x25c7,0x25c7,0x3012,0x000d,0x000a},
1988 {11,0x31,0x20,0x203b,0x3010,0x0074,0x0065,0x0073,0x0074,0x3011,0x000d,0x000a}
1989 };
1990 static CHAR jis_jp[9][27] = {
1991 {20,0x31,0x20,0x1b,0x24,0x42,0x24,0x22,0x24,0x24,0x24,0x26,0x24,0x28,
1992 0x24,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1993 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x22,0x25,0x24,0x25,0x26,0x25,0x28,
1994 0x25,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1995 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x22,0x25,0x24,0x25,0x26,0x25,0x28,
1996 0x25,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1997 {20,0x31,0x20,0x1b,0x24,0x42,0x24,0x21,0x24,0x23,0x24,0x25,0x24,0x27,
1998 0x24,0x29,0x1b,0x28,0x42,0x0d,0x0a},
1999 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x21,0x25,0x23,0x25,0x25,0x25,0x27,
2000 0x25,0x29,0x1b,0x28,0x42,0x0d,0x0a},
2001 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x21,0x25,0x23,0x25,0x25,0x25,0x27,
2002 0x25,0x29,0x1b,0x28,0x42,0x0d,0x0a},
2003 {20,0x31,0x20,0x1b,0x24,0x42,0x21,0x56,0x46,0x7c,0x4b,0x5c,0x38,0x6c,
2004 0x21,0x57,0x1b,0x28,0x42,0x0d,0x0a},
2005 {16,0x31,0x20,0x1b,0x24,0x42,0x21,0x7e,0x21,0x7e,0x22,0x29,0x1b,0x28,
2006 0x42,0x0d,0x0a},
2007 {26,0x31,0x20,0x1b,0x24,0x42,0x22,0x28,0x21,0x5a,0x1b,0x28,0x42,0x74,
2008 0x65,0x73,0x74,0x1b,0x24,0x42,0x21,0x5b,0x1b,0x28,0x42,0x0d,0x0a}
2009 };
2010 static CHAR sjis_jp[9][15] = {
2011 {14,0x31,0x20,0x82,0xa0,0x82,0xa2,0x82,0xa4,0x82,0xa6,0x82,0xa8,0x0d,0x0a},
2012 {14,0x31,0x20,0x83,0x41,0x83,0x43,0x83,0x45,0x83,0x47,0x83,0x49,0x0d,0x0a},
2013 {9,0x31,0x20,0xb1,0xb2,0xb3,0xb4,0xb5,0x0d,0x0a},
2014 {14,0x31,0x20,0x82,0x9f,0x82,0xa1,0x82,0xa3,0x82,0xa5,0x82,0xa7,0x0d,0x0a},
2015 {14,0x31,0x20,0x83,0x40,0x83,0x42,0x83,0x44,0x83,0x46,0x83,0x48,0x0d,0x0a},
2016 {9,0x31,0x20,0xa7,0xa8,0xa9,0xaa,0xab,0x0d,0x0a},
2017 {14,0x31,0x20,0x81,0x75,0x93,0xfa,0x96,0x7b,0x8c,0xea,0x81,0x76,0x0d,0x0a},
2018 {10,0x31,0x20,0x81,0x9e,0x81,0x9e,0x81,0xa7,0x0d,0x0a},
2019 {14,0x31,0x20,0x81,0xa6,0x81,0x79,0x74,0x65,0x73,0x74,0x81,0x7a,0x0d,0x0a}
2020 };
2021 static CHAR euc_jp[9][15] = {
2022 {14,0x31,0x20,0xa4,0xa2,0xa4,0xa4,0xa4,0xa6,0xa4,0xa8,0xa4,0xaa,0x0d,0x0a},
2023 {14,0x31,0x20,0xa5,0xa2,0xa5,0xa4,0xa5,0xa6,0xa5,0xa8,0xa5,0xaa,0x0d,0x0a},
2024 {14,0x31,0x20,0x8e,0xb1,0x8e,0xb2,0x8e,0xb3,0x8e,0xb4,0x8e,0xb5,0x0d,0x0a},
2025 {14,0x31,0x20,0xa4,0xa1,0xa4,0xa3,0xa4,0xa5,0xa4,0xa7,0xa4,0xa9,0x0d,0x0a},
2026 {14,0x31,0x20,0xa5,0xa1,0xa5,0xa3,0xa5,0xa5,0xa5,0xa7,0xa5,0xa9,0x0d,0x0a},
2027 {14,0x31,0x20,0x8e,0xa7,0x8e,0xa8,0x8e,0xa9,0x8e,0xaa,0x8e,0xab,0x0d,0x0a},
2028 {14,0x31,0x20,0xa1,0xd6,0xc6,0xfc,0xcb,0xdc,0xb8,0xec,0xa1,0xd7,0x0d,0x0a},
2029 {10,0x31,0x20,0xa1,0xfe,0xa1,0xfe,0xa2,0xa9,0x0d,0x0a},
2030 {14,0x31,0x20,0xa2,0xa8,0xa1,0xda,0x74,0x65,0x73,0x74,0xa1,0xdb,0x0d,0x0a}
2031 };
2032
2033 INT srcsz, destsz;
2034 INT i;
2035 HRESULT hr;
2036 CHAR output[30];
2037 WCHAR outputW[30];
2038 int outlen;
2039
2040 /* test unc->jis */
2041 for (i = 0; i < 9; i++)
2042 {
2043 int j;
2044 destsz = 30;
2045 outlen = jis_jp[i][0];
2046 srcsz = unc_jp[i][0];
2047 hr = pConvertINetUnicodeToMultiByte(NULL, 50220, &unc_jp[i][1], &srcsz, output, &destsz);
2048 if (hr == S_FALSE)
2049 {
2050 skip("Code page identifier 50220 is not supported\n");
2051 break;
2052 }
2053 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n", i, hr);
2054 ok(destsz == outlen, "(%i) Expected %i, got %i\n",i,outlen,destsz);
2055 ok(srcsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],srcsz);
2056 ok(memcmp(output,&jis_jp[i][1],destsz)==0,"(%i) Strings do not match\n",i);
2057
2058 /* and back */
2059 srcsz = outlen;
2060 destsz = 30;
2061 hr = pConvertINetMultiByteToUnicode(NULL, 50220, output, &srcsz, outputW,&destsz);
2062
2063 /*
2064 * JIS does not have hankata so it get automatically converted to
2065 * zenkata. this means that strings 1 and 2 are identical as well as
2066 * strings 4 and 5.
2067 */
2068 j = i;
2069 if (i == 2) j = 1;
2070 if (i == 5) j = 4;
2071
2072 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n",i, hr);
2073 ok(destsz == unc_jp[j][0],"(%i) Expected %i, got %i\n",i,unc_jp[j][0],destsz);
2074 ok(srcsz == outlen,"(%i) Expected %i, got %i\n",i,outlen,srcsz);
2075 ok(memcmp(outputW,&unc_jp[j][1],destsz)==0,"(%i) Strings do not match\n",i);
2076 }
2077
2078 /* test unc->sjis */
2079 for (i = 0; i < 9; i++)
2080 {
2081 destsz = 30;
2082 outlen = sjis_jp[i][0];
2083 srcsz = unc_jp[i][0];
2084
2085 hr = pConvertINetUnicodeToMultiByte(NULL, 932, &unc_jp[i][1], &srcsz, output, &destsz);
2086 if (hr == S_FALSE)
2087 {
2088 skip("Code page identifier 932 is not supported\n");
2089 break;
2090 }
2091 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n",i,hr);
2092 ok(destsz == outlen,"(%i) Expected %i, got %i\n",i,outlen,destsz);
2093 ok(srcsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],srcsz);
2094 ok(memcmp(output,&sjis_jp[i][1],outlen)==0,"(%i) Strings do not match\n",i);
2095
2096 srcsz = outlen;
2097 destsz = 30;
2098 hr = pConvertINetMultiByteToUnicode(NULL, 932, output, &srcsz, outputW,&destsz);
2099
2100 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n", i, hr);
2101 ok(destsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],destsz);
2102 ok(srcsz == outlen,"(%i) Expected %i, got %i\n",i,outlen,srcsz);
2103 ok(memcmp(outputW,&unc_jp[i][1],destsz)==0,"(%i) Strings do not match\n",i);
2104 }
2105
2106 /* test unc->euc */
2107 for (i = 0; i < 9; i++)
2108 {
2109 destsz = 30;
2110 outlen = euc_jp[i][0];
2111 srcsz = unc_jp[i][0];
2112
2113 hr = pConvertINetUnicodeToMultiByte(NULL, 51932, &unc_jp[i][1], &srcsz, output, &destsz);
2114 if (hr == S_FALSE)
2115 {
2116 skip("Code page identifier 51932 is not supported\n");
2117 break;
2118 }
2119 ok(hr == S_OK, "(%i) Expected S_OK, got %08lx\n",i,hr);
2120 ok(destsz == outlen, "(%i) Expected %i, got %i\n",i,outlen,destsz);
2121 ok(srcsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],destsz);
2122 ok(memcmp(output,&euc_jp[i][1],outlen)==0,"(%i) Strings do not match\n",i);
2123
2124 srcsz = outlen;
2125 destsz = 30;
2126 hr = pConvertINetMultiByteToUnicode(NULL, 51932, output, &srcsz, outputW,&destsz);
2127
2128 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n",i,hr);
2129 ok(destsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],destsz);
2130 ok(srcsz == outlen,"(%i) Expected %i, got %i\n",i,outlen,srcsz);
2131 ok(memcmp(outputW,&unc_jp[i][1],destsz)==0,"(%i) Strings do not match\n",i);
2132 }
2133
2134 /* Japanese autodetect */
2135 i = 0;
2136 destsz = 30;
2137 srcsz = jis_jp[i][0];
2138 hr = pConvertINetMultiByteToUnicode(NULL, 50932, &jis_jp[i][1], &srcsz, outputW, &destsz);
2139 if (hr == S_FALSE)
2140 {
2141 skip("Code page identifier 50932 is not supported\n");
2142 return;
2143 }
2144 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n",i,hr);
2145 ok(destsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],destsz);
2146 ok(srcsz == jis_jp[i][0],"(%i) Expected %i, got %i\n",i,jis_jp[i][0],srcsz);
2147 ok(memcmp(outputW,&unc_jp[i][1],destsz)==0,"(%i) Strings do not match\n",i);
2148
2149 i = 1;
2150 destsz = 30;
2151 srcsz = sjis_jp[i][0];
2152 hr = pConvertINetMultiByteToUnicode(NULL, 50932, &sjis_jp[i][1], &srcsz, outputW, &destsz);
2153 ok(hr == S_OK,"(%i) Expected S_OK, got %08lx\n",i,hr);
2154 ok(destsz == unc_jp[i][0],"(%i) Expected %i, got %i\n",i,unc_jp[i][0],destsz);
2155 ok(srcsz == sjis_jp[i][0],"(%i) Expected %i, got %i\n",i,sjis_jp[i][0],srcsz);
2156 ok(memcmp(outputW,&unc_jp[i][1],destsz)==0,"(%i) Strings do not match\n",i);
2157}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

Referenced by START_TEST().

◆ test_LcidToRfc1766()

static void test_LcidToRfc1766 ( void  )
static

Definition at line 1541 of file mlang.c.

1542{
1543 CHAR expected[MAX_RFC1766_NAME];
1544 CHAR buffer[MAX_RFC1766_NAME * 2];
1545 HRESULT hr;
1546 DWORD i;
1547
1548 for(i = 0; i < ARRAY_SIZE(lcid_table); i++) {
1549
1550 memset(buffer, '#', sizeof(buffer)-1);
1551 buffer[sizeof(buffer)-1] = '\0';
1552
1553 hr = pLcidToRfc1766A(lcid_table[i].lcid, buffer, MAX_RFC1766_NAME);
1554
1555 /* IE <5.0 does not recognize 0x180c (fr-mc) and 0x457 (kok) */
1556 ok( (hr == lcid_table[i].hr) ||
1557 broken(lcid_table[i].broken_lcid && (hr == E_FAIL)),
1558 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i, hr, lcid_table[i].hr);
1559
1560 if (hr != S_OK)
1561 continue;
1562
1564 lstrlenA(lcid_table[i].rfc1766) + 1, expected, MAX_RFC1766_NAME);
1565
1566 /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
1567 /* IE <5.0 return "fr" for LCID 0x180c ("fr-mc") */
1568 ok( (!lstrcmpA(buffer, expected)) ||
1569 broken(!lstrcmpA(buffer, lcid_table[i].broken_rfc)),
1570 "#%02ld: got '%s' (expected '%s')\n", i, buffer, expected);
1571
1572 }
1573
1574 memset(buffer, '#', sizeof(buffer)-1);
1575 buffer[sizeof(buffer)-1] = '\0';
1576 hr = pLcidToRfc1766A(-1, buffer, MAX_RFC1766_NAME);
1577 ok(hr == E_FAIL, "got 0x%08lx and '%s' (expected E_FAIL)\n", hr, buffer);
1578
1579 hr = pLcidToRfc1766A(LANG_ENGLISH, NULL, MAX_RFC1766_NAME);
1580 ok(hr == E_INVALIDARG, "got 0x%08lx (expected E_INVALIDARG)\n", hr);
1581
1582 memset(buffer, '#', sizeof(buffer)-1);
1583 buffer[sizeof(buffer)-1] = '\0';
1584 hr = pLcidToRfc1766A(LANG_ENGLISH, buffer, -1);
1585 ok(hr == E_INVALIDARG, "got 0x%08lx and '%s' (expected E_INVALIDARG)\n", hr, buffer);
1586
1587 memset(buffer, '#', sizeof(buffer)-1);
1588 buffer[sizeof(buffer)-1] = '\0';
1589 hr = pLcidToRfc1766A(LANG_ENGLISH, buffer, 0);
1590 ok(hr == E_INVALIDARG, "got 0x%08lx and '%s' (expected E_INVALIDARG)\n", hr, buffer);
1591}

Referenced by START_TEST().

◆ test_MapFont()

static void test_MapFont ( IMLangFontLink *  font_link,
IMLangFontLink2 *  font_link2 
)
static

Definition at line 2711 of file mlang.c.

2712{
2713 HFONT old_font = NULL;
2714 HFONT new_font = NULL;
2715 HFONT last_font = NULL;
2716 HFONT font1 = NULL;
2717 HFONT font2 = NULL;
2719 DWORD font_codepages;
2720 HRESULT ret;
2721 HDC hdc;
2722 WCHAR ch;
2723 UINT charset;
2725
2726 hdc = GetDC(NULL);
2730 old_font = GetCurrentObject(hdc, OBJ_FONT);
2731 ch = 0xfeed;
2732
2733 /* Tests for IMLangFontLink */
2734
2735 ret = IMLangFontLink_ResetFontMapping(font_link);
2736 ok(ret == S_OK, "IMLangFontLink_ResetFontMapping: expected S_OK, got %08lx\n", ret);
2737
2738 ret = IMLangFontLink_MapFont(font_link, NULL, 0, NULL, NULL);
2739 ok(ret == E_FAIL, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret);
2740 ret = IMLangFontLink_MapFont(font_link, NULL, codepages, old_font, &new_font);
2741 ok(ret == E_FAIL, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret);
2742 ret = IMLangFontLink_MapFont(font_link, hdc, codepages, NULL, &new_font);
2743 ok(ret == E_FAIL, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret);
2744
2745 ret = IMLangFontLink_MapFont(font_link, hdc, codepages, old_font, NULL);
2746 ok(ret == S_OK, "IMLangFontLink_MapFont: expected S_OK, got %08lx\n", ret);
2747 ret = IMLangFontLink_MapFont(font_link, hdc, codepages, old_font, &new_font);
2748 ok(ret == S_OK && new_font != NULL, "IMLangFontLink_MapFont: expected S_OK/!NULL, got %08lx/%p\n", ret, new_font);
2749 last_font = new_font;
2750 ret = IMLangFontLink_MapFont(font_link, hdc, codepages, old_font, &new_font);
2751 ok(ret == S_OK && new_font == last_font, "IMLangFontLink_MapFont: expected S_OK/%p, got %08lx/%p\n", last_font, ret, new_font);
2752
2753 ret = IMLangFontLink_ReleaseFont(font_link, NULL);
2754 ok(ret == E_FAIL, "IMLangFontLink_ReleaseFont: expected E_FAIL, got %08lx\n", ret);
2755 ret = IMLangFontLink_ReleaseFont(font_link, new_font);
2756 ok(ret == S_OK, "IMLangFontLink_ReleaseFont: expected S_OK, got %08lx\n", ret);
2757 ret = IMLangFontLink_ResetFontMapping(font_link);
2758 ok(ret == S_OK, "IMLangFontLink_ResetFontMapping: expected S_OK, got %08lx\n", ret);
2759
2760 /* Tests for IMLangFontLink2 */
2761
2762 ret = IMLangFontLink2_ResetFontMapping(font_link2);
2763 ok(ret == S_OK, "IMLangFontLink2_ResetFontMapping: expected S_OK, got %08lx\n", ret);
2764
2765 ret = IMLangFontLink2_MapFont(font_link2, NULL, 0, 0, NULL);
2766 ok(ret == E_FAIL, "IMLangFontLink2_MapFont: expected E_FAIL, got %08lx\n", ret);
2767 ret = IMLangFontLink2_MapFont(font_link2, NULL, codepages, ch, &new_font);
2768 ok(ret == E_FAIL, "IMLangFontLink2_MapFont: expected E_FAIL, got %08lx\n", ret);
2769 ret = IMLangFontLink2_MapFont(font_link2, hdc, 0, 0, NULL);
2770 ok(ret == E_INVALIDARG, "IMLangFontLink2_MapFont: expected E_INVALIDARG, got %08lx\n", ret);
2771 ret = IMLangFontLink2_MapFont(font_link2, hdc, 0, ch, NULL);
2772 ok(ret == E_INVALIDARG, "IMLangFontLink2_MapFont: expected E_INVALIDARG, got %08lx\n", ret);
2773
2774 ret = IMLangFontLink2_MapFont(font_link2, hdc, 0, ch, &new_font);
2775 todo_wine
2776 ok(ret == S_OK || broken(ret == E_FAIL), /* got E_FAIL on winxp and win2k */
2777 "IMLangFontLink2_MapFont: expected S_OK || E_FAIL, got %08lx\n", ret);
2778 ret = IMLangFontLink2_MapFont(font_link2, hdc, codepages, 0, NULL);
2779 ok(ret == S_OK, "IMLangFontLink2_MapFont: expected S_OK, got %08lx\n", ret);
2780 ret = IMLangFontLink2_MapFont(font_link2, hdc, codepages, 0, &new_font);
2781 ok(ret == S_OK && new_font != NULL, "IMLangFontLink2_MapFont: expected S_OK/!NULL, got %08lx/%p\n", ret, new_font);
2782 last_font = new_font;
2783 ret = IMLangFontLink2_MapFont(font_link2, hdc, codepages, 0, &new_font);
2784 ok(ret == S_OK && new_font == last_font, "IMLangFontLink2_MapFont: expected S_OK/%p, got %08lx/%p\n", last_font, ret, new_font);
2785
2786#ifdef __REACTOS__
2787 if (GetNTVersion() >= _WIN32_WINNT_VISTA || is_reactos()) // Broken on Windows 2003
2788 {
2789#endif
2790 /* check that the returned font can directly handle the codepage (instead of relying on a child font) */
2791 ret = IMLangFontLink2_MapFont(font_link2, hdc, FS_JISJAPAN, 0, &new_font);
2792 old_font = SelectObject(hdc, new_font);
2794 SelectObject(hdc, old_font);
2795 ok(ret == S_OK && charset == SHIFTJIS_CHARSET && !!(fs.fsCsb[0] & FS_JISJAPAN), "IMLangFontLink2_MapFont: expected S_OK/%u/1, got %08lx/%u/0\n", SHIFTJIS_CHARSET, ret, charset);
2796#ifdef __REACTOS__
2797 }
2798#endif
2799
2800 ret = IMLangFontLink2_ReleaseFont(font_link2, NULL);
2801 ok(ret == E_FAIL, "IMLangFontLink2_ReleaseFont: expected E_FAIL, got %08lx\n", ret);
2802 ret = IMLangFontLink2_ReleaseFont(font_link2, new_font);
2803 ok(ret == S_OK, "IMLangFontLink2_ReleaseFont: expected S_OK, got %08lx\n", ret);
2804 ret = IMLangFontLink2_ResetFontMapping(font_link2);
2805 ok(ret == S_OK, "IMLangFontLink2_ResetFontMapping: expected S_OK, got %08lx\n", ret);
2806
2807 /* Show that the font cache is global */
2808 ret = IMLangFontLink_MapFont(font_link, hdc, codepages, old_font, &font1);
2809 ok(ret == S_OK, "MapFont() failed, hr %#lx.\n", ret);
2810 ret = IMLangFontLink2_MapFont(font_link2, hdc, codepages, 0, &font2);
2811 ok(ret == S_OK, "MapFont() failed, hr %#lx.\n", ret);
2812 ok(font1 != NULL && font2 != NULL, "expected !NULL/!NULL, got %p/%p\n", font1, font2);
2813 ok(font1 == font2, "expected equal, got not equal\n");
2814
2815 IMLangFontLink_GetFontCodePages(font_link, hdc, font1, &font_codepages);
2816 ok((codepages & (~font_codepages)) != 0 && (codepages & font_codepages) != 0,
2817 "code pages of font is incorrect\n");
2818
2819 font_codepages = 1;
2820 ret = IMLangFontLink_GetFontCodePages(font_link, NULL, font1, &font_codepages);
2821 ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n",
2822 ret, font_codepages);
2823 font_codepages = 2;
2824 ret = IMLangFontLink_GetFontCodePages(font_link, hdc, NULL, &font_codepages);
2825 ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n",
2826 ret, font_codepages);
2827
2828 font_codepages = 3;
2829 ret = IMLangFontLink_GetFontCodePages(font_link, (void*)0xabc, font1, &font_codepages);
2830 ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n",
2831 ret, font_codepages);
2832 font_codepages = 4;
2833 ret = IMLangFontLink_GetFontCodePages(font_link, hdc, (void*)0x123456, &font_codepages);
2834 ok(ret == E_FAIL && !font_codepages, "expected E_FAIL, but got: %lx, font_codepages:%lx \n",
2835 ret, font_codepages);
2836
2837 IMLangFontLink_ResetFontMapping(font_link);
2838 IMLangFontLink2_ResetFontMapping(font_link2);
2839 ReleaseDC(NULL, hdc);
2840}
#define GetNTVersion()
Definition: apitest.h:17
static CPTABLEINFO codepages[128]
Definition: locale.c:318
#define fs
Definition: i386-dis.c:444
#define OBJ_FONT
Definition: objidl.idl:1019
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
Definition: ffs.h:70
int WINAPI GetTextCharsetInfo(_In_ HDC, _Out_opt_ LPFONTSIGNATURE, _In_ DWORD)
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_multibyte_to_unicode_translations()

static void test_multibyte_to_unicode_translations ( IMultiLanguage2 *  iML2)
static

Definition at line 566 of file mlang.c.

567{
568 /* these APIs are broken regarding constness of the input buffer */
569 char stringA[] = "Just a test string\0"; /* double 0 for CP_UNICODE tests */
570 WCHAR stringW[] = {'J','u','s','t',' ','a',' ','t','e','s','t',' ','s','t','r','i','n','g',0};
571 char bufA[256];
572 WCHAR bufW[256];
573 UINT lenA, lenW, expected_len;
574 HRESULT ret;
575
576 /* IMultiLanguage2_ConvertStringToUnicode tests */
577
578 memset(bufW, 'x', sizeof(bufW));
579 lenA = 0;
580 lenW = ARRAY_SIZE(bufW);
581 ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
582 ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
583 ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
584 ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
585
586 memset(bufW, 'x', sizeof(bufW));
587 lenA = -1;
588 lenW = ARRAY_SIZE(bufW);
589 ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
590 ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
591 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
592 ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
593 if (lenW < ARRAY_SIZE(bufW)) {
594 /* can only happen if the convert call fails */
595 ok(bufW[lenW] != 0, "buf should not be 0 terminated\n");
596 bufW[lenW] = 0; /* -1 doesn't include 0 terminator */
597 }
598 ok(!lstrcmpW(bufW, stringW), "bufW/stringW mismatch\n");
599
600 memset(bufW, 'x', sizeof(bufW));
601 lenA = -1;
602 lenW = 5;
603 ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
604 ok(ret == E_FAIL, "IMultiLanguage2_ConvertStringToUnicode should fail: %08lx\n", ret);
605 ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
606 /* still has to do partial conversion */
607 ok(!memcmp(bufW, stringW, 5 * sizeof(WCHAR)), "bufW/stringW mismatch\n");
608
609 memset(bufW, 'x', sizeof(bufW));
610 lenA = -1;
611 lenW = ARRAY_SIZE(bufW);
612 ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, CP_UNICODE, stringA, &lenA, bufW, &lenW);
613 ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
614 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
615 ok(lenW == lstrlenW(stringW)/(int)sizeof(WCHAR), "wrong lenW %u\n", lenW);
616 ok(bufW[lenW] != 0, "buf should not be 0 terminated\n");
617 bufW[lenW] = 0; /* -1 doesn't include 0 terminator */
618 ok(!lstrcmpA((LPCSTR)bufW, stringA), "bufW/stringA mismatch\n");
619
620 memset(bufW, 'x', sizeof(bufW));
621 lenA = lstrlenA(stringA);
622 lenW = 0;
623 ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, NULL, &lenW);
624 ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
625 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
626 expected_len = MultiByteToWideChar(1252, 0, stringA, lenA, NULL, 0);
627 ok(lenW == expected_len, "expected lenW %u, got %u\n", expected_len, lenW);
628
629 memset(bufW, 'x', sizeof(bufW));
630 lenA = lstrlenA(stringA);
631 lenW = ARRAY_SIZE(bufW);
632 ret = pConvertINetMultiByteToUnicode(NULL, 1252, stringA, (INT *)&lenA, NULL, (INT *)&lenW);
633 ok(ret == S_OK, "ConvertINetMultiByteToUnicode failed: %08lx\n", ret);
634 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
635 expected_len = MultiByteToWideChar(1252, 0, stringA, lenA, NULL, 0);
636 ok(lenW == expected_len, "expected lenW %u, got %u\n", expected_len, lenW);
637
638 memset(bufW, 'x', sizeof(bufW));
639 lenA = lstrlenA(stringA);
640 lenW = 0;
641 ret = pConvertINetMultiByteToUnicode(NULL, 1252, stringA, (INT *)&lenA, NULL, (INT *)&lenW);
642 ok(ret == S_OK, "ConvertINetMultiByteToUnicode failed: %08lx\n", ret);
643 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
644 expected_len = MultiByteToWideChar(1252, 0, stringA, lenA, NULL, 0);
645 ok(lenW == expected_len, "expected lenW %u, got %u\n", expected_len, lenW);
646
647 /* IMultiLanguage2_ConvertStringFromUnicode tests */
648
649 memset(bufA, 'x', sizeof(bufA));
650 lenW = 0;
651 lenA = sizeof(bufA);
652 ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
653 ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
654 ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
655 ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
656
657 memset(bufA, 'x', sizeof(bufA));
658 lenW = -1;
659 lenA = sizeof(bufA);
660 ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
661 ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
662 ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
663 ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
664 ok(bufA[lenA] != 0, "buf should not be 0 terminated\n");
665 bufA[lenA] = 0; /* -1 doesn't include 0 terminator */
666 ok(!lstrcmpA(bufA, stringA), "bufA/stringA mismatch\n");
667
668 memset(bufA, 'x', sizeof(bufA));
669 lenW = -1;
670 lenA = 5;
671 ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
672 ok(ret == E_FAIL, "IMultiLanguage2_ConvertStringFromUnicode should fail: %08lx\n", ret);
673 ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
674 /* still has to do partial conversion */
675 ok(!memcmp(bufA, stringA, 5), "bufW/stringW mismatch\n");
676
677 memset(bufA, 'x', sizeof(bufA));
678 lenW = -1;
679 lenA = sizeof(bufA);
680 ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, CP_UNICODE, stringW, &lenW, bufA, &lenA);
681 ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
682 ok(lenA == lstrlenA(stringA) * (int)sizeof(WCHAR), "wrong lenA %u\n", lenA);
683 ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
684 ok(bufA[lenA] != 0 && bufA[lenA+1] != 0, "buf should not be 0 terminated\n");
685 bufA[lenA] = 0; /* -1 doesn't include 0 terminator */
686 bufA[lenA+1] = 0; /* sizeof(WCHAR) */
687 ok(!lstrcmpW((LPCWSTR)bufA, stringW), "bufA/stringW mismatch\n");
688
689 memset(bufA, 'x', sizeof(bufA));
690 lenW = lstrlenW(stringW);
691 lenA = 0;
692 ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, NULL, &lenA);
693 ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
694 ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
695 expected_len = WideCharToMultiByte(1252, 0, stringW, lenW, NULL, 0, NULL, NULL);
696 ok(lenA == expected_len, "expected lenA %u, got %u\n", expected_len, lenA);
697}
static const WCHAR stringW[]
Definition: engine.c:38
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57

Referenced by START_TEST().

◆ test_rfc1766()

static void test_rfc1766 ( IMultiLanguage2 *  iML2)
static

Definition at line 1367 of file mlang.c.

1368{
1369 IEnumRfc1766 *pEnumRfc1766;
1370 RFC1766INFO info;
1371 ULONG n;
1372 HRESULT ret;
1373 BSTR rfcstr;
1374
1375 ret = IMultiLanguage2_EnumRfc1766(iML2, LANG_NEUTRAL, &pEnumRfc1766);
1376 ok(ret == S_OK, "IMultiLanguage2_EnumRfc1766 error %08lx\n", ret);
1377
1378 while (1)
1379 {
1380 ret = IEnumRfc1766_Next(pEnumRfc1766, 1, &info, &n);
1381 if (ret != S_OK) break;
1382
1383#ifdef DUMP_CP_INFO
1384 trace("lcid %04x rfc_name %s locale_name %s\n",
1385 info.lcid, wine_dbgstr_w(info.wszRfc1766), wine_dbgstr_w(info.wszLocaleName));
1386#endif
1387
1388 ok(n == 1, "couldn't fetch 1 RFC1766INFO structure\n");
1389
1390 /* verify the Rfc1766 value */
1391 ret = IMultiLanguage2_GetRfc1766FromLcid(iML2, info.lcid, &rfcstr);
1392 ok(ret == S_OK, "Expected S_OK, got %08lx\n", ret);
1393
1394 /* not an exact 1:1 correspondence between lcid and rfc1766 in the
1395 * mlang database, e.g., nb-no -> 1044 -> no */
1396 ok(wcsstr(info.wszRfc1766, rfcstr) != NULL,
1397 "Expected matching locale names\n");
1398
1399 SysFreeString(rfcstr);
1400 }
1401 IEnumRfc1766_Release(pEnumRfc1766);
1402}
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2993

Referenced by START_TEST().

◆ test_Rfc1766ToLcid()

static void test_Rfc1766ToLcid ( void  )
static

Definition at line 1464 of file mlang.c.

1465{
1466 LCID lcid;
1467 HRESULT ret;
1468 DWORD i;
1469
1470 for(i = 0; i < ARRAY_SIZE(lcid_table); i++) {
1471 lcid = -1;
1472 ret = pRfc1766ToLcidA(&lcid, lcid_table[i].rfc1766);
1473
1474 /* IE <6.0 guess 0x412 (ko) from "kok" */
1475 ok( (ret == lcid_table[i].hr) ||
1476 broken(lcid_table[i].broken_lcid && (ret == S_FALSE)),
1477 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i, ret, lcid_table[i].hr);
1478
1479 ok( (lcid == lcid_table[i].lcid) ||
1480 broken(lcid == lcid_table[i].broken_lcid), /* IE <6.0 */
1481 "#%02ld: got LCID 0x%lx (expected 0x%lx)\n", i, lcid, lcid_table[i].lcid);
1482 }
1483
1484 ret = pRfc1766ToLcidA(&lcid, NULL);
1485 ok(ret == E_INVALIDARG, "got 0x%08lx (expected E_INVALIDARG)\n", ret);
1486
1487 ret = pRfc1766ToLcidA(NULL, "en");
1488 ok(ret == E_INVALIDARG, "got 0x%08lx (expected E_INVALIDARG)\n", ret);
1489}

Referenced by START_TEST().

Variable Documentation

◆ de_de

const WCHAR de_de[]
static
Initial value:
= {'D','e','u','t','s','c','h',' ',
'(','D','e','u','t','s','c','h','l','a','n','d',')',0}

Definition at line 127 of file mlang.c.

◆ de_deat

const WCHAR de_deat[]
static
Initial value:
= {'D','e','u','t','s','c','h',' ',
'(',0xD6,'s','t','e','r','r','e','i','c','h',')',0}

Definition at line 129 of file mlang.c.

◆ de_dech

const WCHAR de_dech[]
static
Initial value:
= {'D','e','u','t','s','c','h',' ',
'(','S','c','h','w','e','i','z',')',0}

Definition at line 131 of file mlang.c.

◆ de_en

const WCHAR de_en[] = {'E','n','g','l','i','s','c','h',0}
static

Definition at line 114 of file mlang.c.

◆ de_enca

const WCHAR de_enca[]
static
Initial value:
= {'E','n','g','l','i','s','c','h',' ',
'(','K','a','n','a','d','a',')',0}

Definition at line 115 of file mlang.c.

◆ de_engb

const WCHAR de_engb[]
static
Initial value:
= {'E','n','g','l','i','s','c','h',' ',
'(','G','r','o',0xDF,'b','r','i','t','a','n','n','i','e','n',')',0}

Definition at line 117 of file mlang.c.

◆ de_engb2

const WCHAR de_engb2[]
static
Initial value:
={'E','n','g','l','i','s','c','h',' ',
'(','V','e','r','e','i','n','i','g','t','e','s',' ',
'K',0xF6,'n','i','g','r','e','i','c',0}

Definition at line 119 of file mlang.c.

◆ de_enus

const WCHAR de_enus[]
static
Initial value:
= {'E','n','g','l','i','s','c','h',' ',
'(','U','S','A',')',0}

Definition at line 122 of file mlang.c.

◆ de_enus2

const WCHAR de_enus2[]
static
Initial value:
={'E','n','g','l','i','s','c','h',' ',
'(','V','e','r','e','i','n','i','g','t','e',' ',
'S','t','a','a','t','e','n',')',0}

Definition at line 124 of file mlang.c.

◆ DWORD

Definition at line 42 of file mlang.c.

◆ en_de

const WCHAR en_de[]
static
Initial value:
= {'G','e','r','m','a','n',' ',
'(','G','e','r','m','a','n','y',')',0}

Definition at line 141 of file mlang.c.

◆ en_deat

const WCHAR en_deat[]
static
Initial value:
= {'G','e','r','m','a','n',' ',
'(','A','u','s','t','r','i','a',')',0}

Definition at line 143 of file mlang.c.

◆ en_dech

const WCHAR en_dech[]
static
Initial value:
= {'G','e','r','m','a','n',' ',
'(','S','w','i','t','z','e','r','l','a','n','d',')',0}

Definition at line 145 of file mlang.c.

◆ en_en

const WCHAR en_en[] = {'E','n','g','l','i','s','h',0}
static

Definition at line 134 of file mlang.c.

◆ en_enca

const WCHAR en_enca[]
static
Initial value:
= {'E','n','g','l','i','s','h',' ',
'(','C','a','n','a','d','a',')',0}

Definition at line 135 of file mlang.c.

◆ en_engb

const WCHAR en_engb[]
static
Initial value:
= {'E','n','g','l','i','s','h',' ',
'(','U','n','i','t','e','d',' ','K','i','n','g','d','o','m',')',0}

Definition at line 137 of file mlang.c.

◆ en_enus

const WCHAR en_enus[]
static
Initial value:
= {'E','n','g','l','i','s','h',' ',
'(','U','n','i','t','e','d',' ','S','t','a','t','e','s',')',0}

Definition at line 139 of file mlang.c.

◆ fr_de

const WCHAR fr_de[]
static
Initial value:
= {'A','l','l','e','m','a','n','d',' ',
'(','A','l','l','e','m','a','g','n','e',')',0}

Definition at line 157 of file mlang.c.

◆ fr_de2

const WCHAR fr_de2[]
static
Initial value:
= {'A','l','l','e','m','a','n','d',' ',
'(','S','t','a','n','d','a','r','d',')',0}

Definition at line 159 of file mlang.c.

◆ fr_deat

const WCHAR fr_deat[]
static
Initial value:
= {'A','l','l','e','m','a','n','d',' ',
'(','A','u','t','r','i','c','h','e',')',0}

Definition at line 161 of file mlang.c.

◆ fr_dech

const WCHAR fr_dech[]
static
Initial value:
= {'A','l','l','e','m','a','n','d',' ',
'(','S','u','i','s','s','e',')',0}

Definition at line 163 of file mlang.c.

◆ fr_en

const WCHAR fr_en[] = {'A','n','g','l','a','i','s',0}
static

Definition at line 148 of file mlang.c.

◆ fr_enca

const WCHAR fr_enca[]
static
Initial value:
= {'A','n','g','l','a','i','s',' ',
'(','C','a','n','a','d','a',')',0}

Definition at line 149 of file mlang.c.

◆ fr_engb

const WCHAR fr_engb[]
static
Initial value:
= {'A','n','g','l','a','i','s',' ',
'(','R','o','y','a','u','m','e','-','U','n','i',')',0}

Definition at line 151 of file mlang.c.

◆ fr_enus

const WCHAR fr_enus[]
static
Initial value:
= {'A','n','g','l','a','i','s',' ',
'(',0xC9, 't','a','t','s','-','U','n','i','s',')',0}

Definition at line 153 of file mlang.c.

◆ fr_enus2

const WCHAR fr_enus2[]
static
Initial value:
={'A','n','g','l','a','i','s',' ',
'(','U','.','S','.',')',0}

Definition at line 155 of file mlang.c.

◆ iml2_cpinfo_data

const struct cpinfo_test_data iml2_cpinfo_data[]
static

Definition at line 244 of file mlang.c.

Referenced by test_GetCodePageInfo().

◆ info_table

const info_table_entry info_table[]
static

Definition at line 166 of file mlang.c.

Referenced by test_GetRfc1766Info().

◆ INT

INT

Definition at line 48 of file mlang.c.

◆ lcid_table

◆ LPCPINFOEXA

Definition at line 42 of file mlang.c.

◆ LPCSTR

Definition at line 43 of file mlang.c.

◆ LPCWSTR

Definition at line 45 of file mlang.c.

◆ LPINT

Definition at line 44 of file mlang.c.

◆ LPSTR

Definition at line 46 of file mlang.c.

◆ LPWSTR

Definition at line 44 of file mlang.c.

◆ stream_data

const char stream_data[] = "VCARD2.1test;test"
static

◆ stream_pos

ULONG stream_pos
static

Definition at line 2413 of file mlang.c.

Referenced by stream_Read(), and stream_Seek().

◆ stream_vtbl

const IStreamVtbl stream_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI stream_LockRegion(IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
Definition: mlang.c:2494
static HRESULT WINAPI stream_Stat(IStream *iface, STATSTG *stg, DWORD flag)
Definition: mlang.c:2508
static ULONG WINAPI stream_AddRef(IStream *iface)
Definition: mlang.c:2421
static HRESULT WINAPI stream_Clone(IStream *iface, IStream **stream)
Definition: mlang.c:2514
static HRESULT WINAPI stream_CopyTo(IStream *iface, IStream *stream, ULARGE_INTEGER len, ULARGE_INTEGER *read, ULARGE_INTEGER *written)
Definition: mlang.c:2475
static HRESULT WINAPI stream_UnlockRegion(IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
Definition: mlang.c:2501
static ULONG WINAPI stream_Release(IStream *iface)
Definition: mlang.c:2427
static HRESULT WINAPI stream_Revert(IStream *iface)
Definition: mlang.c:2488
static HRESULT WINAPI stream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *newpos)
Definition: mlang.c:2455
static HRESULT WINAPI stream_SetSize(IStream *iface, ULARGE_INTEGER newsize)
Definition: mlang.c:2469
static HRESULT WINAPI stream_Write(IStream *iface, const void *buf, ULONG len, ULONG *written)
Definition: mlang.c:2449
static HRESULT WINAPI stream_QueryInterface(IStream *iface, REFIID riid, void **obj)
Definition: mlang.c:2415
static HRESULT WINAPI stream_Commit(IStream *iface, DWORD flags)
Definition: mlang.c:2482
static HRESULT WINAPI stream_Read(IStream *iface, void *buf, ULONG len, ULONG *read)
Definition: mlang.c:2433

Definition at line 2520 of file mlang.c.

◆ test_stream

Definition at line 2538 of file mlang.c.