wbemprox: Add support for uncommitted instances in IWbemClassObject::Get.
[wine] / dlls / dwrite / tests / layout.c
1 /*
2  *    Text layout/format tests
3  *
4  * Copyright 2012 Nikolay Sivov for CodeWeavers
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #define COBJMACROS
22
23 #include "windows.h"
24 #include "dwrite.h"
25
26 #include "wine/test.h"
27
28 static IDWriteFactory *factory;
29
30 static void test_CreateTextLayout(void)
31 {
32     static const WCHAR strW[] = {'s','t','r','i','n','g',0};
33     IDWriteTextLayout *layout;
34     HRESULT hr;
35
36     hr = IDWriteFactory_CreateTextLayout(factory, NULL, 0, NULL, 0.0, 0.0, &layout);
37     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
38
39     hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 0.0, 0.0, &layout);
40     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
41
42     hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 1.0, 0.0, &layout);
43     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
44
45     hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 0.0, 1.0, &layout);
46     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
47
48     hr = IDWriteFactory_CreateTextLayout(factory, strW, 6, NULL, 1000.0, 1000.0, &layout);
49     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
50 }
51
52 static void test_CreateGdiCompatibleTextLayout(void)
53 {
54     static const WCHAR strW[] = {'s','t','r','i','n','g',0};
55     IDWriteTextLayout *layout;
56     HRESULT hr;
57
58     hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, NULL, 0, NULL, 0.0, 0.0, 0.0, NULL, FALSE, &layout);
59     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
60
61     hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 0.0, 0.0, 0.0, NULL, FALSE, &layout);
62     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
63
64     hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1.0, 0.0, 0.0, NULL, FALSE, &layout);
65     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
66
67     hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1.0, 0.0, 1.0, NULL, FALSE, &layout);
68     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
69
70     hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, NULL, 1000.0, 1000.0, 1.0, NULL, FALSE, &layout);
71     ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
72 }
73
74 START_TEST(layout)
75 {
76     HRESULT hr;
77
78     hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_ISOLATED, &IID_IDWriteFactory, (IUnknown**)&factory);
79     ok(hr == S_OK, "got 0x%08x\n", hr);
80     if (hr != S_OK)
81     {
82         win_skip("failed to create factory\n");
83         return;
84     }
85
86     test_CreateTextLayout();
87     test_CreateGdiCompatibleTextLayout();
88
89     IDWriteFactory_Release(factory);
90 }