gdi32: Fix the sign of the vertical text position in ExtTextOutW.
[wine/multimedia.git] / dlls / ole32 / tests / defaulthandler.c
bloba6469b709e54934f74b701d86981f500eaee7745
1 /*
2 * Default Handler Tests
4 * Copyright 2008 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
21 #define COBJMACROS
22 #define CONST_VTABLE
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "objbase.h"
30 #include "wine/test.h"
33 static HRESULT create_storage(IStorage **stg)
35 HRESULT hr;
36 ILockBytes *lock_bytes;
38 hr = CreateILockBytesOnHGlobal(NULL, TRUE, &lock_bytes);
39 if(SUCCEEDED(hr))
41 hr = StgCreateDocfileOnILockBytes(lock_bytes,
42 STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, stg);
43 ILockBytes_Release(lock_bytes);
45 return hr;
48 typedef struct
50 DWORD version;
51 DWORD flags;
52 DWORD link_update_opt;
53 DWORD res;
54 DWORD moniker_size;
55 } ole_stream_header_t;
57 static void test_olestream(void)
59 HRESULT hr;
60 const CLSID non_existent_class = {0xa5f1772f, 0x3772, 0x490f, {0x9e, 0xc6, 0x77, 0x13, 0xe8, 0xb3, 0x4b, 0x5d}};
61 IOleObject *ole_obj;
62 IPersistStorage *persist;
63 IStorage *stg;
64 IStream *stm;
65 static const WCHAR olestream[] = {1,'O','l','e',0};
66 ULONG read;
67 ole_stream_header_t header;
69 hr = create_storage(&stg);
70 ok(hr == S_OK, "got %08x\n", hr);
72 hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm);
73 ok(hr == STG_E_FILENOTFOUND, "got %08x\n", hr);
75 hr = OleCreateDefaultHandler(&non_existent_class, 0, &IID_IOleObject, (void**)&ole_obj);
76 ok(hr == S_OK, "got %08x\n", hr);
78 hr = IOleObject_QueryInterface(ole_obj, &IID_IPersistStorage, (void**)&persist);
79 ok(hr == S_OK, "got %08x\n", hr);
81 hr = IPersistStorage_InitNew(persist, stg);
82 ok(hr == S_OK, "got %08x\n", hr);
84 hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm);
85 ok(hr == S_OK, "got %08x\n", hr);
86 hr = IStream_Read(stm, &header, sizeof(header), &read);
87 ok(hr == S_OK, "got %08x\n", hr);
88 ok(read == sizeof(header), "read %d\n", read);
89 ok(header.version == 0x02000001, "got version %08x\n", header.version);
90 ok(header.flags == 0x0, "got flags %08x\n", header.flags);
91 ok(header.link_update_opt == 0x0, "got link update option %08x\n", header.link_update_opt);
92 ok(header.res == 0x0, "got reserved %08x\n", header.res);
93 ok(header.moniker_size == 0x0, "got moniker size %08x\n", header.moniker_size);
95 IStream_Release(stm);
97 IPersistStorage_Release(persist);
98 IOleObject_Release(ole_obj);
100 IStorage_Release(stg);
103 START_TEST(defaulthandler)
105 OleInitialize(NULL);
107 test_olestream();
109 OleUninitialize();