4 * Copyright 2007 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/test.h"
36 "MIME-Version: 1.0\r\n"
37 "Content-Type: multipart/mixed;\r\n"
38 " boundary=\"------------1.5.0.6\";\r\n"
39 " stuff=\"du;nno\"\r\n"
41 "From: Huw Davies <huw@codeweavers.com>\r\n"
42 "From: Me <xxx@codeweavers.com>\r\n"
43 "To: wine-patches <wine-patches@winehq.org>\r\n"
44 "Cc: Huw Davies <huw@codeweavers.com>,\r\n"
45 " \"Fred Bloggs\" <fred@bloggs.com>\r\n"
49 "This is a multi-part message in MIME format.\r\n"
50 "--------------1.5.0.6\r\n"
51 "Content-Type: text/plain; format=fixed; charset=UTF-8\r\n"
52 "Content-Transfer-Encoding: 8bit\r\n"
55 "--------------1.5.0.6\r\n"
56 "Content-Type: text/plain; charset=\"us-ascii\"\r\n"
57 "Content-Transfer-Encoding: 7bit\r\n"
60 "--------------1.5.0.6--\r\n";
62 static void test_CreateVirtualStream(void)
67 hr
= MimeOleCreateVirtualStream(&pstm
);
68 ok(hr
== S_OK
, "ret %08x\n", hr
);
70 IStream_Release(pstm
);
73 static void test_CreateSecurity(void)
78 hr
= MimeOleCreateSecurity(&sec
);
79 ok(hr
== S_OK
, "ret %08x\n", hr
);
81 IMimeSecurity_Release(sec
);
84 static void test_CreateBody(void)
88 HBODY handle
= (void *)0xdeadbeef;
94 hr
= CoCreateInstance(&CLSID_IMimeBody
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IMimeBody
, (void**)&body
);
95 ok(hr
== S_OK
, "ret %08x\n", hr
);
97 hr
= IMimeBody_GetHandle(body
, &handle
);
98 ok(hr
== MIME_E_NO_DATA
, "ret %08x\n", hr
);
99 ok(handle
== NULL
, "handle %p\n", handle
);
101 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &in
);
102 ok(hr
== S_OK
, "ret %08x\n", hr
);
103 IStream_Write(in
, msg1
, sizeof(msg1
) - 1, NULL
);
105 IStream_Seek(in
, off
, STREAM_SEEK_SET
, NULL
);
107 /* Need to call InitNew before Load otherwise Load crashes with native inetcomm */
108 hr
= IMimeBody_InitNew(body
);
109 ok(hr
== S_OK
, "ret %08x\n", hr
);
111 hr
= IMimeBody_GetCurrentEncoding(body
, &enc
);
112 ok(hr
== S_OK
, "ret %08x\n", hr
);
113 ok(enc
== IET_7BIT
, "encoding %d\n", enc
);
115 hr
= IMimeBody_Load(body
, in
);
116 ok(hr
== S_OK
, "ret %08x\n", hr
);
118 IStream_Seek(in
, off
, STREAM_SEEK_CUR
, &pos
);
119 ok(pos
.LowPart
== 328, "pos %u\n", pos
.LowPart
);
121 hr
= IMimeBody_IsContentType(body
, "multipart", "mixed");
122 ok(hr
== S_OK
, "ret %08x\n", hr
);
123 hr
= IMimeBody_IsContentType(body
, "text", "plain");
124 ok(hr
== S_FALSE
, "ret %08x\n", hr
);
125 hr
= IMimeBody_IsContentType(body
, NULL
, "mixed");
126 ok(hr
== S_OK
, "ret %08x\n", hr
);
128 hr
= IMimeBody_SetData(body
, IET_8BIT
, "text", "plain", &IID_IStream
, in
);
129 ok(hr
== S_OK
, "ret %08x\n", hr
);
130 hr
= IMimeBody_IsContentType(body
, "text", "plain");
132 ok(hr
== S_OK
, "ret %08x\n", hr
);
133 hr
= IMimeBody_GetCurrentEncoding(body
, &enc
);
134 ok(hr
== S_OK
, "ret %08x\n", hr
);
135 ok(enc
== IET_8BIT
, "encoding %d\n", enc
);
137 IMimeBody_Release(body
);
143 test_CreateVirtualStream();
144 test_CreateSecurity();