Author: akhaldi
Date: Mon Mar 30 21:45:29 2015
New Revision: 66986
URL:
http://svn.reactos.org/svn/reactos?rev=66986&view=rev
Log:
[MLANG_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
Modified:
trunk/rostests/winetests/mlang/mlang.c
Modified: trunk/rostests/winetests/mlang/mlang.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mlang/mlang.c?r…
==============================================================================
--- trunk/rostests/winetests/mlang/mlang.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mlang/mlang.c [iso-8859-1] Mon Mar 30 21:45:29 2015
@@ -487,15 +487,15 @@
ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08x\n", ret);
n = 65536;
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, &n);
+ ok(ret == S_FALSE || ret == E_FAIL,
+ "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08x\n",
ret);
if (ret == S_FALSE)
- ok(n == 0 && ret == S_FALSE, "IEnumCodePage_Next: expected
0/S_FALSE, got %u/%08x\n", n, ret);
+ ok(n == 0, "IEnumCodePage_Next: expected 0/S_FALSE, got %u/%08x\n", n,
ret);
else if (ret == E_FAIL)
- ok(n == 65536 && ret == E_FAIL, "IEnumCodePage_Next: expected
65536/E_FAIL, got %u/%08x\n", n, ret);
+ ok(n == 65536, "IEnumCodePage_Next: expected 65536/E_FAIL, got
%u/%08x\n", n, ret);
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, NULL);
- if (ret == S_FALSE)
- ok(ret == S_FALSE, "IEnumCodePage_Next: expected S_FALSE, got %08x\n",
ret);
- else if (ret == E_FAIL)
- ok(n == 65536 && ret == E_FAIL, "IEnumCodePage_Next: expected
65536/E_FAIL, got %u/%08x\n", n, ret);
+ ok(ret == S_FALSE || ret == E_FAIL,
+ "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08x\n",
ret);
cpinfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*cpinfo) * total * 2);
@@ -694,6 +694,17 @@
HeapFree(GetProcessHeap(), 0, cpinfo);
IEnumCodePage_Release(iEnumCP);
+}
+
+static void test_GetCharsetInfo_alias(IMultiLanguage *ml)
+{
+ WCHAR asciiW[] = {'a','s','c','i','i',0};
+ MIMECSETINFO info;
+ HRESULT hr;
+
+ hr = IMultiLanguage_GetCharsetInfo(ml, asciiW, &info);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(!lstrcmpW(info.wszCharset, asciiW), "got %s\n",
wine_dbgstr_w(info.wszCharset));
}
static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2)
@@ -1973,10 +1984,214 @@
IMLangConvertCharset_Release(convert);
}
+static const char stream_data[] = "VCARD2.1test;test";
+static ULONG stream_pos;
+
+static HRESULT WINAPI stream_QueryInterface(IStream *iface, REFIID riid, void **obj)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI stream_AddRef(IStream *iface)
+{
+ ok(FALSE, "unexpected call\n");
+ return 2;
+}
+
+static ULONG WINAPI stream_Release(IStream *iface)
+{
+ ok(FALSE, "unexpected call\n");
+ return 1;
+}
+
+static HRESULT WINAPI stream_Read(IStream *iface, void *buf, ULONG len, ULONG *read)
+{
+ ULONG size;
+
+ if (stream_pos == sizeof(stream_data) - 1)
+ {
+ *read = 0;
+ return S_FALSE;
+ }
+ size = min(sizeof(stream_data) - 1 - stream_pos, len);
+ memcpy(buf, stream_data + stream_pos, size);
+ stream_pos += size;
+ *read = size;
+ return S_OK;
+}
+
+static HRESULT WINAPI stream_Write(IStream *iface, const void *buf, ULONG len, ULONG
*written)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin,
+ ULARGE_INTEGER *newpos)
+{
+ if (origin == STREAM_SEEK_SET)
+ stream_pos = move.QuadPart;
+ else if (origin == STREAM_SEEK_CUR)
+ stream_pos += move.QuadPart;
+ else if (origin == STREAM_SEEK_END)
+ stream_pos = sizeof(stream_data) - 1 - move.QuadPart;
+
+ if (newpos) newpos->QuadPart = stream_pos;
+ return S_OK;
+}
+
+static HRESULT WINAPI stream_SetSize(IStream *iface, ULARGE_INTEGER newsize)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_CopyTo(IStream *iface, IStream *stream, ULARGE_INTEGER len,
+ ULARGE_INTEGER *read, ULARGE_INTEGER *written)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_Commit(IStream *iface, DWORD flags)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_Revert(IStream *iface)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_LockRegion(IStream *iface, ULARGE_INTEGER offset,
+ ULARGE_INTEGER len, DWORD locktype)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_UnlockRegion(IStream *iface, ULARGE_INTEGER offset,
+ ULARGE_INTEGER len, DWORD locktype)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_Stat(IStream *iface, STATSTG *stg, DWORD flag)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI stream_Clone(IStream *iface, IStream **stream)
+{
+ ok(FALSE, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static IStreamVtbl stream_vtbl =
+{
+ stream_QueryInterface,
+ stream_AddRef,
+ stream_Release,
+ stream_Read,
+ stream_Write,
+ stream_Seek,
+ stream_SetSize,
+ stream_CopyTo,
+ stream_Commit,
+ stream_Revert,
+ stream_LockRegion,
+ stream_UnlockRegion,
+ stream_Stat,
+ stream_Clone
+};
+
+static IStream test_stream = { &stream_vtbl };
+
+static void test_DetectOutboundCodePageInIStream(IMultiLanguage3 *ml)
+{
+ HRESULT hr;
+ UINT nb_detected, detected[4];
+ UINT preferred[] = {1250,1251,1252,65001};
+ UINT preferred2[] = {1250,1251,1252};
+
+ nb_detected = 0;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
+ ok(hr == E_INVALIDARG, "got %08x\n", hr);
+
+ nb_detected = 1;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), NULL, &nb_detected, NULL);
+ ok(hr == E_INVALIDARG, "got %08x\n", hr);
+
+ nb_detected = 1;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+ ok(nb_detected == 1, "got %u\n", nb_detected);
+ ok(detected[0] == 65001, "got %u\n", detected[0]);
+
+ nb_detected = 2;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+ todo_wine ok(nb_detected == 2, "got %u\n", nb_detected);
+ ok(detected[0] == 65001, "got %u\n", detected[0]);
+ todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
+
+ nb_detected = 3;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+ todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
+ ok(detected[0] == 65001, "got %u\n", detected[0]);
+ todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
+ todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
+
+ nb_detected = 4;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
+ sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+ todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
+ ok(detected[0] == 65001, "got %u\n", detected[0]);
+ todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
+ todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
+ ok(detected[3] == 0, "got %u\n", detected[3]);
+
+ nb_detected = 3;
+ memset(detected, 0, sizeof(detected));
+ hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
+ MLDETECTF_PRESERVE_ORDER, &test_stream, preferred2,
+ sizeof(preferred2)/sizeof(preferred2[0]), detected, &nb_detected, NULL);
+ ok(hr == S_OK, "got %08x\n", hr);
+ todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
+ ok(detected[0] == 65001, "got %u\n", detected[0]);
+ todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
+ todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
+}
+
START_TEST(mlang)
{
IMultiLanguage *iML = NULL;
IMultiLanguage2 *iML2 = NULL;
+ IMultiLanguage3 *iML3 = NULL;
IMLangFontLink *iMLFL = NULL;
IMLangFontLink2 *iMLFL2 = NULL;
HRESULT ret;
@@ -2000,6 +2215,7 @@
test_GetNumberOfCodePageInfo((IMultiLanguage2 *)iML);
test_IMLangConvertCharset(iML);
+ test_GetCharsetInfo_alias(iML);
IMultiLanguage_Release(iML);
@@ -2058,5 +2274,14 @@
test_CodePageToScriptID(iMLFL2);
IMLangFontLink2_Release(iMLFL2);
+ trace("IMultiLanguage3\n");
+ ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IMultiLanguage3, (void **)&iML3);
+ if (ret == S_OK)
+ {
+ test_DetectOutboundCodePageInIStream(iML3);
+ IMultiLanguage3_Release(iML3);
+ }
+
CoUninitialize();
}