Return S_OK when committing/decomitting an already
[wine.git] / dlls / quartz / tests / memallocator.c
blob4acb133bf5636422fabfb3e44ec0929b7301dcc8
1 /*
2 * Unit tests for Direct Show functions
4 * Copyright (C) 2005 Christian Costa
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <assert.h>
23 #define COBJMACROS
25 #include "wine/test.h"
26 #include "uuids.h"
27 #include "dshow.h"
28 #include "control.h"
30 static void CommitDecommitTest()
32 IMemAllocator* pMemAllocator;
33 HRESULT hr;
35 hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)&pMemAllocator);
36 ok(hr==S_OK, "Unable to create memory allocator %lx\n", hr);
38 if (hr == S_OK)
40 ALLOCATOR_PROPERTIES RequestedProps;
41 ALLOCATOR_PROPERTIES ActualProps;
43 RequestedProps.cBuffers = 1;
44 RequestedProps.cbBuffer = 65536;
45 RequestedProps.cbAlign = 1;
46 RequestedProps.cbPrefix = 0;
48 hr = IMemAllocator_SetProperties(pMemAllocator, &RequestedProps, &ActualProps);
49 ok(hr==S_OK, "SetProperties returned: %lx\n", hr);
51 hr = IMemAllocator_Commit(pMemAllocator);
52 ok(hr==S_OK, "Commit returned: %lx\n", hr);
53 hr = IMemAllocator_Commit(pMemAllocator);
54 ok(hr==S_OK, "Commit returned: %lx\n", hr);
56 hr = IMemAllocator_Decommit(pMemAllocator);
57 ok(hr==S_OK, "Decommit returned: %lx\n", hr);
58 hr = IMemAllocator_Decommit(pMemAllocator);
59 ok(hr==S_OK, "Cecommit returned: %lx\n", hr);
61 IMemAllocator_Release(pMemAllocator);
65 START_TEST(memallocator)
67 CoInitialize(NULL);
69 CommitDecommitTest();