msvcrt: Use EOF from public header.
[wine/zf.git] / dlls / ninput / tests / ninput.c
blob7fd389378b017a611921d6d721f1f209380db4c4
1 /*
2 * Copyright 2018 Józef Kucia
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 "interactioncontext.h"
20 #include "wine/test.h"
22 static void test_context(void)
24 HINTERACTIONCONTEXT context;
25 HRESULT hr;
27 hr = CreateInteractionContext(&context);
28 ok(hr == S_OK, "Failed to create context, hr %#x.\n", hr);
29 hr = DestroyInteractionContext(context);
30 ok(hr == S_OK, "Failed to destroy context, hr %#x.\n", hr);
32 hr = CreateInteractionContext(NULL);
33 ok(hr == E_POINTER, "Got hr %#x.\n", hr);
34 hr = DestroyInteractionContext(NULL);
35 ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
38 static void test_properties(void)
40 HINTERACTIONCONTEXT context;
41 UINT32 value;
42 HRESULT hr;
44 hr = CreateInteractionContext(&context);
45 ok(hr == S_OK, "Failed to create context, hr %#x.\n", hr);
47 hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
48 ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
49 ok(value == TRUE, "Got unexpected value %#x.\n", value);
51 hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, TRUE);
52 ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
53 hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
54 ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
55 ok(value == TRUE, "Got unexpected value %#x.\n", value);
57 hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
58 ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
59 hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
60 ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
61 ok(value == FALSE, "Got unexpected value %#x.\n", value);
63 hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 2);
64 ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
65 hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 3);
66 ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
68 hr = SetPropertyInteractionContext(context, 0xdeadbeef, 0);
69 ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
70 hr = GetPropertyInteractionContext(context, 0xdeadbeef, &value);
71 ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
73 hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, NULL);
74 ok(hr == E_POINTER, "Got hr %#x.\n", hr);
76 hr = SetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
77 ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
78 hr = GetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
79 ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
81 hr = DestroyInteractionContext(context);
82 ok(hr == S_OK, "Failed to destroy context, hr %#x.\n", hr);
85 static void test_configuration(void)
87 HINTERACTIONCONTEXT context;
88 HRESULT hr;
90 static const INTERACTION_CONTEXT_CONFIGURATION config[] =
93 INTERACTION_ID_MANIPULATION,
94 INTERACTION_CONFIGURATION_FLAG_MANIPULATION |
95 INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_X |
96 INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_Y |
97 INTERACTION_CONFIGURATION_FLAG_MANIPULATION_SCALING |
98 INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_INERTIA |
99 INTERACTION_CONFIGURATION_FLAG_MANIPULATION_SCALING_INERTIA
103 hr = CreateInteractionContext(&context);
104 ok(hr == S_OK, "Failed to create context, hr %#x.\n", hr);
106 hr = SetInteractionConfigurationInteractionContext(NULL, 0, NULL);
107 ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
108 hr = SetInteractionConfigurationInteractionContext(context, 0, NULL);
109 ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
110 hr = SetInteractionConfigurationInteractionContext(context, 1, NULL);
111 ok(hr == E_POINTER, "Got hr %#x.\n", hr);
113 hr = SetInteractionConfigurationInteractionContext(context, ARRAY_SIZE(config), config);
114 ok(hr == S_OK, "Failed to set configuration, hr %#x.\n", hr);
116 hr = DestroyInteractionContext(context);
117 ok(hr == S_OK, "Failed to destroy context, hr %#x.\n", hr);
120 START_TEST(ninput)
122 test_context();
123 test_properties();
124 test_configuration();