Author: akhaldi Date: Sun Jun 5 19:24:01 2016 New Revision: 71556 URL: http://svn.reactos.org/svn/reactos?rev=71556&view=rev Log: [INETCOMM_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
Modified: trunk/rostests/winetests/inetcomm/mimeole.c Modified: trunk/rostests/winetests/inetcomm/mimeole.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/inetcomm/mimeole.c?rev=71556&r1=71555&r2=71556&view=diff ============================================================================== --- trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/rostests/winetests/inetcomm/mimeole.c [iso-8859-1] Sun Jun 5 19:24:01 2016 @@ -332,6 +332,158 @@ IStream_Release(stream); } +static void test_MessageSetProp(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_SetProp(body, NULL, 0, &prop); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_SetProp(body, "Thread-Topic", 0, NULL); + ok(hr == E_INVALIDARG, "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); + + hr = IMimeBody_GetProp(body, NULL, 0, &prop); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Thread-Topic", 0, NULL); + ok(hr == E_INVALIDARG, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Wine-Topic", 0, &prop); + ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr); + + hr = IMimeBody_GetProp(body, "Thread-Topic", 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); + } + + IMimeBody_Release(body); + IMimeMessage_Release(msg); +} + +static void test_MessageOptions(void) +{ + static const char string[] = "XXXXX"; + static const char zero[] = "0"; + HRESULT hr; + IMimeMessage *msg; + PROPVARIANT prop; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + PropVariantInit(&prop); + + prop.vt = VT_BOOL; + prop.u.boolVal = TRUE; + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(string)+1); + strcpy(prop.u.pszVal, string); + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + /* Invalid property type doesn't change the value */ + prop.vt = VT_LPSTR; + prop.u.pszVal = CoTaskMemAlloc(strlen(zero)+1); + strcpy(prop.u.pszVal, zero); + hr = IMimeMessage_SetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + ok(hr == S_OK, "ret %08x\n", hr); + PropVariantClear(&prop); + + hr = IMimeMessage_GetOption(msg, OID_HIDE_TNEF_ATTACHMENTS, &prop); + todo_wine ok(hr == S_OK, "ret %08x\n", hr); + todo_wine ok(prop.vt == VT_BOOL, "vt %08x\n", prop.vt); + todo_wine ok(prop.u.boolVal == TRUE, "Hide Attachments got %d\n", prop.u.boolVal); + PropVariantClear(&prop); + + /* Invalid OID */ + prop.vt = VT_BOOL; + prop.u.boolVal = TRUE; + hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop); + ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr); + PropVariantClear(&prop); + + /* Out of range before type. */ + prop.vt = VT_I4; + prop.u.lVal = 1; + hr = IMimeMessage_SetOption(msg, 0xff00000a, &prop); + ok(hr == MIME_E_INVALID_OPTION_ID, "ret %08x\n", hr); + PropVariantClear(&prop); + + IMimeMessage_Release(msg); +} + +static void test_BindToObject(void) +{ + HRESULT hr; + IMimeMessage *msg; + IMimeBody *body; + ULONG count; + + hr = MimeOleCreateMessage(NULL, &msg); + ok(hr == S_OK, "ret %08x\n", hr); + + hr = IMimeMessage_CountBodies(msg, HBODY_ROOT, TRUE, &count); + ok(hr == S_OK, "ret %08x\n", hr); + ok(count == 1, "got %d\n", count); + + hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body); + ok(hr == S_OK, "ret %08x\n", hr); + IMimeBody_Release(body); + + IMimeMessage_Release(msg); +} + +static void test_MimeOleGetPropertySchema(void) +{ + HRESULT hr; + IMimePropertySchema *schema = NULL; + + hr = MimeOleGetPropertySchema(&schema); + ok(hr == S_OK, "ret %08x\n", hr); + + IMimePropertySchema_Release(schema); +} + START_TEST(mimeole) { OleInitialize(NULL); @@ -340,5 +492,9 @@ test_CreateBody(); test_Allocator(); test_CreateMessage(); + test_MessageSetProp(); + test_MessageOptions(); + test_BindToObject(); + test_MimeOleGetPropertySchema(); OleUninitialize(); }