wined3d: Remove unused variables.
[wine] / dlls / ieframe / tests / ie.c
1 /*
2  * Copyright 2011 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #define COBJMACROS
20
21 #include <wine/test.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ole2.h"
28 #include "exdisp.h"
29 #include "mshtml.h"
30
31 static void test_visible(IWebBrowser2 *wb)
32 {
33     VARIANT_BOOL b;
34     HRESULT hres;
35
36     b = 0x100;
37     hres = IWebBrowser2_get_Visible(wb, &b);
38     ok(hres == S_OK, "get_Visible failed: %08x\n", hres);
39     ok(b == VARIANT_FALSE, "Visible = %x\n", hres);
40
41     hres = IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
42     ok(hres == S_OK, "put_Visible failed: %08x\n", hres);
43
44     b = 0x100;
45     hres = IWebBrowser2_get_Visible(wb, &b);
46     ok(hres == S_OK, "get_Visible failed: %08x\n", hres);
47     ok(b == VARIANT_TRUE, "Visible = %x\n", hres);
48
49     hres = IWebBrowser2_put_Visible(wb, VARIANT_FALSE);
50     ok(hres == S_OK, "put_Visible failed: %08x\n", hres);
51 }
52
53 static void test_html_window(IWebBrowser2 *wb)
54 {
55     IHTMLWindow2 *html_window;
56     IServiceProvider *sp;
57     HRESULT hres;
58
59     hres = IWebBrowser2_QueryInterface(wb, &IID_IServiceProvider, (void**)&sp);
60     ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
61
62     hres = IServiceProvider_QueryService(sp, &SID_SHTMLWindow, &IID_IHTMLWindow2, (void**)&html_window);
63     IServiceProvider_Release(sp);
64     ok(hres == S_OK, "Could not get SHTMLWindow service: %08x\n", hres);
65
66     IHTMLWindow2_Release(html_window);
67 }
68
69 static void test_InternetExplorer(void)
70 {
71     IWebBrowser2 *wb;
72     IUnknown *unk;
73     ULONG ref;
74     HRESULT hres;
75
76     hres = CoCreateInstance(&CLSID_InternetExplorer, NULL, CLSCTX_SERVER,
77             &IID_IUnknown, (void**)&unk);
78     ok(hres == S_OK, "Could not create InternetExplorer instance: %08x\n", hres);
79
80     if(hres != S_OK)
81         return;
82
83     hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
84     ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
85
86     test_visible(wb);
87     test_html_window(wb);
88
89     IWebBrowser2_Release(wb);
90     ref = IUnknown_Release(unk);
91     ok(!ref, "object not destroyed, ref=%u\n", ref);
92 }
93
94 START_TEST(ie)
95 {
96     CoInitialize(NULL);
97
98     test_InternetExplorer();
99
100     CoUninitialize();
101 }