mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[INETCOMM_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866
svn path=/trunk/; revision=72345
This commit is contained in:
parent
60cad68706
commit
6873f2c1ae
1 changed files with 226 additions and 1 deletions
|
@ -214,12 +214,13 @@ static void test_CreateMessage(void)
|
|||
IStream *stream;
|
||||
LARGE_INTEGER pos;
|
||||
LONG ref;
|
||||
HBODY hbody;
|
||||
HBODY hbody, hbody2;
|
||||
IMimeBody *body;
|
||||
BODYOFFSETS offsets;
|
||||
ULONG count;
|
||||
FINDBODY find_struct;
|
||||
HCHARSET hcs;
|
||||
HBODY handle = NULL;
|
||||
|
||||
char text[] = "text";
|
||||
HBODY *body_list;
|
||||
|
@ -258,6 +259,21 @@ static void test_CreateMessage(void)
|
|||
hr = IMimeMessage_GetBody(msg, IBL_ROOT, NULL, &hbody);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetHandle(body, NULL);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetHandle(body, &handle);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
ok(handle != NULL, "handle %p\n", handle);
|
||||
|
||||
hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, NULL);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
hbody2 = (HBODY)0xdeadbeef;
|
||||
hr = IMimeMessage_GetBody(msg, IBL_PARENT, hbody, &hbody2);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
ok(hbody2 == NULL, "hbody2 %p\n", hbody2);
|
||||
|
||||
PropVariantInit(&prop);
|
||||
hr = IMimeMessage_GetBodyProp(msg, hbody, att_pritype, 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
@ -269,6 +285,11 @@ static void test_CreateMessage(void)
|
|||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetHandle(body, &handle);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
ok(handle == hbody, "handle %p\n", handle);
|
||||
|
||||
hr = IMimeBody_GetOffsets(body, &offsets);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
ok(offsets.cbBoundaryStart == 405, "got %d\n", offsets.cbBoundaryStart);
|
||||
|
@ -289,6 +310,11 @@ static void test_CreateMessage(void)
|
|||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
hr = IMimeMessage_BindToObject(msg, hbody, &IID_IMimeBody, (void**)&body);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetHandle(body, &handle);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
ok(handle == hbody, "handle %p\n", handle);
|
||||
|
||||
hr = IMimeBody_GetOffsets(body, &offsets);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
ok(offsets.cbBoundaryStart == 525, "got %d\n", offsets.cbBoundaryStart);
|
||||
|
@ -335,6 +361,7 @@ static void test_CreateMessage(void)
|
|||
static void test_MessageSetProp(void)
|
||||
{
|
||||
static const char topic[] = "wine topic";
|
||||
static const WCHAR topicW[] = {'w','i','n','e',' ','t','o','p','i','c',0};
|
||||
HRESULT hr;
|
||||
IMimeMessage *msg;
|
||||
IMimeBody *body;
|
||||
|
@ -370,6 +397,7 @@ static void test_MessageSetProp(void)
|
|||
hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
hr = IMimeBody_GetProp(body, "Thread-Topic", 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
|
@ -379,6 +407,149 @@ static void test_MessageSetProp(void)
|
|||
PropVariantClear(&prop);
|
||||
}
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
||||
ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal);
|
||||
PropVariantClear(&prop);
|
||||
}
|
||||
|
||||
/* Using the name or PID returns the same result. */
|
||||
prop.vt = VT_LPSTR;
|
||||
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(prop.vt == VT_LPSTR, "type %d\n", prop.vt);
|
||||
ok(!strcmp(prop.u.pszVal, topic), "got %s\n", prop.u.pszVal);
|
||||
PropVariantClear(&prop);
|
||||
}
|
||||
|
||||
prop.vt = VT_LPWSTR;
|
||||
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(prop.vt == VT_LPWSTR, "type %d\n", prop.vt);
|
||||
ok(!lstrcmpW(prop.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(prop.u.pwszVal));
|
||||
PropVariantClear(&prop);
|
||||
}
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_TO), 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
/* Out of Range PID */
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, PIDTOSTR(124), 0, &prop);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
IMimeBody_Release(body);
|
||||
IMimeMessage_Release(msg);
|
||||
}
|
||||
|
||||
static void test_MessageGetPropInfo(void)
|
||||
{
|
||||
static const char topic[] = "wine topic";
|
||||
static const char subject[] = "wine testing";
|
||||
HRESULT hr;
|
||||
IMimeMessage *msg;
|
||||
IMimeBody *body;
|
||||
PROPVARIANT prop;
|
||||
MIMEPROPINFO info;
|
||||
|
||||
hr = MimeOleCreateMessage(NULL, &msg);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
PropVariantInit(&prop);
|
||||
|
||||
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, "Thread-Topic", 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(subject)+1);
|
||||
strcpy(prop.u.pszVal, subject);
|
||||
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
||||
hr = IMimeBody_GetPropInfo(body, NULL, &info);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
||||
hr = IMimeBody_GetPropInfo(body, "Subject", NULL);
|
||||
ok(hr == E_INVALIDARG, "ret %08x\n", hr);
|
||||
|
||||
memset(&info, 0xfe, sizeof(info));
|
||||
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
||||
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(info.dwMask & (PIM_ENCODINGTYPE | PIM_FLAGS| PIM_PROPID), "Invalid mask 0x%08x\n", info.dwFlags);
|
||||
todo_wine ok(info.dwFlags & 0x10000000, "Invalid flags 0x%08x\n", info.dwFlags);
|
||||
ok(info.ietEncoding == 0, "Invalid encoding %d\n", info.ietEncoding);
|
||||
ok(info.dwPropId == PID_HDR_SUBJECT, "Invalid propid %d\n", info.dwPropId);
|
||||
ok(info.cValues == 0xfefefefe, "Invalid cValues %d\n", info.cValues);
|
||||
}
|
||||
|
||||
memset(&info, 0xfe, sizeof(info));
|
||||
info.dwMask = 0;
|
||||
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags);
|
||||
ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags);
|
||||
ok(info.ietEncoding == -16843010, "Invalid encoding %d\n", info.ietEncoding);
|
||||
ok(info.dwPropId == -16843010, "Invalid propid %d\n", info.dwPropId);
|
||||
}
|
||||
|
||||
memset(&info, 0xfe, sizeof(info));
|
||||
info.dwMask = 0;
|
||||
info.dwPropId = 1024;
|
||||
info.ietEncoding = 99;
|
||||
hr = IMimeBody_GetPropInfo(body, "Subject", &info);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
ok(info.dwMask == 0, "Invalid mask 0x%08x\n", info.dwFlags);
|
||||
ok(info.dwFlags == 0xfefefefe, "Invalid flags 0x%08x\n", info.dwFlags);
|
||||
ok(info.ietEncoding == 99, "Invalid encoding %d\n", info.ietEncoding);
|
||||
ok(info.dwPropId == 1024, "Invalid propid %d\n", info.dwPropId);
|
||||
}
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.dwMask = PIM_ENCODINGTYPE | PIM_FLAGS | PIM_PROPID;
|
||||
hr = IMimeBody_GetPropInfo(body, "Invalid Property", &info);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
IMimeBody_Release(body);
|
||||
IMimeMessage_Release(msg);
|
||||
}
|
||||
|
@ -473,6 +644,58 @@ static void test_BindToObject(void)
|
|||
IMimeMessage_Release(msg);
|
||||
}
|
||||
|
||||
static void test_BodyDeleteProp(void)
|
||||
{
|
||||
static const char topic[] = "wine topic";
|
||||
HRESULT hr;
|
||||
IMimeMessage *msg;
|
||||
IMimeBody *body;
|
||||
PROPVARIANT prop;
|
||||
|
||||
hr = MimeOleCreateMessage(NULL, &msg);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
PropVariantInit(&prop);
|
||||
|
||||
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_DeleteProp(body, "Subject");
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, "Subject", 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
hr = IMimeBody_DeleteProp(body, "Subject");
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
prop.vt = VT_LPSTR;
|
||||
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
|
||||
strcpy(prop.u.pszVal, topic);
|
||||
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
PropVariantClear(&prop);
|
||||
|
||||
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
|
||||
ok(hr == S_OK, "ret %08x\n", hr);
|
||||
|
||||
hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
|
||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||
|
||||
IMimeBody_Release(body);
|
||||
IMimeMessage_Release(msg);
|
||||
}
|
||||
|
||||
static void test_MimeOleGetPropertySchema(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -493,8 +716,10 @@ START_TEST(mimeole)
|
|||
test_Allocator();
|
||||
test_CreateMessage();
|
||||
test_MessageSetProp();
|
||||
test_MessageGetPropInfo();
|
||||
test_MessageOptions();
|
||||
test_BindToObject();
|
||||
test_BodyDeleteProp();
|
||||
test_MimeOleGetPropertySchema();
|
||||
OleUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue