wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / rtworkq / tests / rtworkq.c
blob627e024d76105ec0591b77b6804f8a9b9c4fed5d
1 /*
2 * Copyright 2020 Nikolay Sivov 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 #include <stdarg.h>
20 #include <string.h>
22 #include "windef.h"
23 #include "winbase.h"
24 #include "rtworkq.h"
26 #include "wine/test.h"
28 static void test_platform_init(void)
30 APTTYPEQUALIFIER qualifier;
31 APTTYPE apttype;
32 HRESULT hr;
34 /* Startup initializes MTA. */
35 hr = CoGetApartmentType(&apttype, &qualifier);
36 ok(hr == CO_E_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
38 hr = RtwqStartup();
39 ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
41 hr = CoGetApartmentType(&apttype, &qualifier);
42 ok(hr == S_OK || broken(FAILED(hr)) /* Win8 */, "Unexpected hr %#x.\n", hr);
43 if (SUCCEEDED(hr))
44 ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA,
45 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
47 hr = RtwqShutdown();
48 ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
50 hr = CoGetApartmentType(&apttype, &qualifier);
51 ok(hr == CO_E_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
53 /* Try with STA initialized before startup. */
54 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
55 ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
57 hr = CoGetApartmentType(&apttype, &qualifier);
58 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
59 ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE,
60 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
62 hr = RtwqStartup();
63 ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
65 hr = CoGetApartmentType(&apttype, &qualifier);
66 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
67 ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE,
68 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
70 hr = RtwqShutdown();
71 ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
73 CoUninitialize();
75 /* Startup -> init main STA -> uninitialize -> shutdown */
76 hr = RtwqStartup();
77 ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr);
79 hr = CoGetApartmentType(&apttype, &qualifier);
80 ok(hr == S_OK || broken(FAILED(hr)) /* Win8 */, "Unexpected hr %#x.\n", hr);
81 if (SUCCEEDED(hr))
82 ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA,
83 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
85 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
86 ok(hr == S_OK, "Failed to initialize, hr %#x.\n", hr);
88 hr = CoGetApartmentType(&apttype, &qualifier);
89 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
90 ok(apttype == APTTYPE_MAINSTA && qualifier == APTTYPEQUALIFIER_NONE,
91 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
93 CoUninitialize();
95 hr = CoGetApartmentType(&apttype, &qualifier);
96 ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
97 ok(apttype == APTTYPE_MTA && qualifier == APTTYPEQUALIFIER_IMPLICIT_MTA,
98 "Unexpected apartment type %d, qualifier %d.\n", apttype, qualifier);
100 hr = RtwqShutdown();
101 ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
104 START_TEST(rtworkq)
106 test_platform_init();