2018-06-21 16:19:42 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Józef Kucia
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "interactioncontext.h"
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
static void test_context(void)
|
|
|
|
{
|
|
|
|
HINTERACTIONCONTEXT context;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CreateInteractionContext(&context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to create context, hr %#lx.\n", hr);
|
2018-06-21 16:19:42 +02:00
|
|
|
hr = DestroyInteractionContext(context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to destroy context, hr %#lx.\n", hr);
|
2018-06-21 16:19:42 +02:00
|
|
|
|
|
|
|
hr = CreateInteractionContext(NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:42 +02:00
|
|
|
hr = DestroyInteractionContext(NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:42 +02:00
|
|
|
}
|
|
|
|
|
2018-06-21 16:19:44 +02:00
|
|
|
static void test_properties(void)
|
|
|
|
{
|
|
|
|
HINTERACTIONCONTEXT context;
|
|
|
|
UINT32 value;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CreateInteractionContext(&context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to create context, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
|
|
|
|
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to get property, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
ok(value == TRUE, "Got unexpected value %#x.\n", value);
|
|
|
|
|
|
|
|
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, TRUE);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to set property, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to get property, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
ok(value == TRUE, "Got unexpected value %#x.\n", value);
|
|
|
|
|
|
|
|
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to set property, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to get property, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
ok(value == FALSE, "Got unexpected value %#x.\n", value);
|
|
|
|
|
|
|
|
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 2);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 3);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
|
|
|
|
hr = SetPropertyInteractionContext(context, 0xdeadbeef, 0);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
hr = GetPropertyInteractionContext(context, 0xdeadbeef, &value);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
|
|
|
|
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
|
|
|
|
hr = SetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
hr = GetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
|
|
|
|
hr = DestroyInteractionContext(context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to destroy context, hr %#lx.\n", hr);
|
2018-06-21 16:19:44 +02:00
|
|
|
}
|
|
|
|
|
2018-06-21 16:19:45 +02:00
|
|
|
static void test_configuration(void)
|
|
|
|
{
|
|
|
|
HINTERACTIONCONTEXT context;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
static const INTERACTION_CONTEXT_CONFIGURATION config[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
INTERACTION_ID_MANIPULATION,
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION |
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_X |
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_Y |
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION_SCALING |
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_INERTIA |
|
|
|
|
INTERACTION_CONFIGURATION_FLAG_MANIPULATION_SCALING_INERTIA
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
hr = CreateInteractionContext(&context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to create context, hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
|
|
|
|
hr = SetInteractionConfigurationInteractionContext(NULL, 0, NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
hr = SetInteractionConfigurationInteractionContext(context, 0, NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
hr = SetInteractionConfigurationInteractionContext(context, 1, NULL);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
|
|
|
|
hr = SetInteractionConfigurationInteractionContext(context, ARRAY_SIZE(config), config);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to set configuration, hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
|
|
|
|
hr = DestroyInteractionContext(context);
|
2022-03-02 09:03:27 +01:00
|
|
|
ok(hr == S_OK, "Failed to destroy context, hr %#lx.\n", hr);
|
2018-06-21 16:19:45 +02:00
|
|
|
}
|
|
|
|
|
2018-06-21 16:19:42 +02:00
|
|
|
START_TEST(ninput)
|
|
|
|
{
|
|
|
|
test_context();
|
2018-06-21 16:19:44 +02:00
|
|
|
test_properties();
|
2018-06-21 16:19:45 +02:00
|
|
|
test_configuration();
|
2018-06-21 16:19:42 +02:00
|
|
|
}
|