wined3d: Fix a "ordered comparison of pointer with integer zero".
[wine/gsoc_dplay.git] / dlls / mshtml / tests / misc.c
blob62c7e37901dc5ea10864fcb82f3426563f8e036e
1 /*
2 * Copyright 2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include <wine/test.h>
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "ole2.h"
27 #include "optary.h"
29 #include "initguid.h"
31 static void test_HTMLLoadOptions(void)
33 IHtmlLoadOptions *loadopts;
34 BYTE buf[100];
35 DWORD size, i, data = 0xdeadbeef;
36 HRESULT hres;
38 hres = CoCreateInstance(&CLSID_HTMLLoadOptions, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
39 &IID_IHtmlLoadOptions, (void**)&loadopts);
40 ok(hres == S_OK, "creating HTMLLoadOptions failed: %08x\n", hres);
41 if(FAILED(hres))
42 return;
44 for(i=0; i <= HTMLLOADOPTION_FRAMELOAD+3; i++) {
45 size = 0xdeadbeef;
46 memset(buf, 0xdd, sizeof(buf));
47 hres = IHtmlLoadOptions_QueryOption(loadopts, i, NULL, &size);
48 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
49 ok(size == 0, "size = %d\n", size);
50 ok(buf[0] == 0xdd, "buf changed\n");
53 size = 0xdeadbeef;
54 hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, NULL, &size);
55 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
56 ok(size == 0, "size = %d\n", size);
58 hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, &data, sizeof(data));
59 ok(hres == S_OK, "SetOption failed: %08x\n", hres);
61 size = sizeof(data);
62 memset(buf, 0xdd, sizeof(buf));
63 hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
64 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
65 ok(size == sizeof(data), "size = %d\n", size);
66 ok(*(DWORD*)buf == data, "unexpected buf\n");
68 size = sizeof(data)-1;
69 memset(buf, 0xdd, sizeof(buf));
70 hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
71 ok(hres == E_FAIL, "QueryOption failed: %08x\n", hres);
72 ok(size == sizeof(data) || !size, "size = %d\n", size);
73 ok(buf[0] == 0xdd, "buf changed\n");
75 data = 100;
76 hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, &data, 0);
77 ok(hres == S_OK, "SetOption failed: %08x\n", hres);
79 size = 0xdeadbeef;
80 memset(buf, 0xdd, sizeof(buf));
81 hres = IHtmlLoadOptions_QueryOption(loadopts, HTMLLOADOPTION_CODEPAGE, buf, &size);
82 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
83 ok(size == 0, "size = %d\n", size);
84 ok(buf[0] == 0xdd, "buf changed\n");
86 hres = IHtmlLoadOptions_SetOption(loadopts, HTMLLOADOPTION_CODEPAGE, NULL, 0);
87 ok(hres == S_OK, "SetOption failed: %08x\n", hres);
89 hres = IHtmlLoadOptions_SetOption(loadopts, 1000, &data, sizeof(data));
90 ok(hres == S_OK, "SetOption failed: %08x\n", hres);
92 size = sizeof(data);
93 memset(buf, 0xdd, sizeof(buf));
94 hres = IHtmlLoadOptions_QueryOption(loadopts, 1000, buf, &size);
95 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
96 ok(size == sizeof(data), "size = %d\n", size);
97 ok(*(DWORD*)buf == data, "unexpected buf\n");
99 hres = IHtmlLoadOptions_SetOption(loadopts, 1000, buf, sizeof(buf));
100 ok(hres == S_OK, "SetOption failed: %08x\n", hres);
102 size = 0xdeadbeef;
103 hres = IHtmlLoadOptions_QueryOption(loadopts, 1000, buf, &size);
104 ok(hres == S_OK, "QueryOption failed: %08x\n", hres);
105 ok(size == sizeof(buf), "size = %d\n", size);
107 IHtmlLoadOptions_Release(loadopts);
110 START_TEST(misc)
112 CoInitialize(NULL);
114 test_HTMLLoadOptions();
116 CoUninitialize();