tests/wayland: Add int property type to test driver
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
This commit is contained in:
parent
a0877dc071
commit
08147d0c9b
@ -338,6 +338,12 @@ bind_test_driver (struct wl_client *client,
|
|||||||
key,
|
key,
|
||||||
g_variant_get_string (variant, NULL));
|
g_variant_get_string (variant, NULL));
|
||||||
}
|
}
|
||||||
|
else if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32))
|
||||||
|
{
|
||||||
|
test_driver_send_property_int (resource,
|
||||||
|
key,
|
||||||
|
g_variant_get_int32 (variant));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_autofree char *variant_string = NULL;
|
g_autofree char *variant_string = NULL;
|
||||||
@ -436,6 +442,16 @@ meta_wayland_test_driver_set_property (MetaWaylandTestDriver *test_driver,
|
|||||||
g_variant_new_string (value));
|
g_variant_new_string (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_test_driver_set_property_int (MetaWaylandTestDriver *test_driver,
|
||||||
|
const char *name,
|
||||||
|
int32_t value)
|
||||||
|
{
|
||||||
|
g_hash_table_replace (test_driver->properties,
|
||||||
|
g_strdup (name),
|
||||||
|
g_variant_new_int32 (value));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_sync_point (MetaWaylandTestDriver *test_driver,
|
on_sync_point (MetaWaylandTestDriver *test_driver,
|
||||||
unsigned int sequence,
|
unsigned int sequence,
|
||||||
|
@ -33,5 +33,9 @@ void meta_wayland_test_driver_set_property (MetaWaylandTestDriver *test_driver,
|
|||||||
const char *name,
|
const char *name,
|
||||||
const char *value);
|
const char *value);
|
||||||
|
|
||||||
|
void meta_wayland_test_driver_set_property_int (MetaWaylandTestDriver *test_driver,
|
||||||
|
const char *name,
|
||||||
|
int32_t value);
|
||||||
|
|
||||||
void meta_wayland_test_driver_wait_for_sync_point (MetaWaylandTestDriver *test_driver,
|
void meta_wayland_test_driver_wait_for_sync_point (MetaWaylandTestDriver *test_driver,
|
||||||
unsigned int sync_point);
|
unsigned int sync_point);
|
||||||
|
@ -50,5 +50,10 @@
|
|||||||
<arg name="name" type="string"/>
|
<arg name="name" type="string"/>
|
||||||
<arg name="value" type="string"/>
|
<arg name="value" type="string"/>
|
||||||
</event>
|
</event>
|
||||||
|
|
||||||
|
<event name="property_int">
|
||||||
|
<arg name="name" type="string"/>
|
||||||
|
<arg name="value" type="uint"/>
|
||||||
|
</event>
|
||||||
</interface>
|
</interface>
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -247,9 +247,23 @@ test_driver_handle_property (void *user_data,
|
|||||||
g_variant_new_string (value));
|
g_variant_new_string (value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_driver_handle_property_int (void *user_data,
|
||||||
|
struct test_driver *test_driver,
|
||||||
|
const char *name,
|
||||||
|
const uint32_t value)
|
||||||
|
{
|
||||||
|
WaylandDisplay *display = WAYLAND_DISPLAY (user_data);
|
||||||
|
|
||||||
|
g_hash_table_replace (display->properties,
|
||||||
|
g_strdup (name),
|
||||||
|
g_variant_new_int32 (value));
|
||||||
|
}
|
||||||
|
|
||||||
static const struct test_driver_listener test_driver_listener = {
|
static const struct test_driver_listener test_driver_listener = {
|
||||||
test_driver_handle_sync_event,
|
test_driver_handle_sync_event,
|
||||||
test_driver_handle_property,
|
test_driver_handle_property,
|
||||||
|
test_driver_handle_property_int,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -705,6 +719,17 @@ lookup_property_string (WaylandDisplay *display,
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t
|
||||||
|
lookup_property_int (WaylandDisplay *display,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
GVariant *variant;
|
||||||
|
|
||||||
|
variant = g_hash_table_lookup (display->properties, name);
|
||||||
|
g_return_val_if_fail (variant, -1);
|
||||||
|
return g_variant_get_int32 (variant);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
effects_completed (void *data,
|
effects_completed (void *data,
|
||||||
struct wl_callback *callback,
|
struct wl_callback *callback,
|
||||||
|
@ -127,6 +127,9 @@ void draw_surface (WaylandDisplay *display,
|
|||||||
const char * lookup_property_string (WaylandDisplay *display,
|
const char * lookup_property_string (WaylandDisplay *display,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
|
int32_t lookup_property_int (WaylandDisplay *display,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
void wait_for_effects_completed (WaylandDisplay *display,
|
void wait_for_effects_completed (WaylandDisplay *display,
|
||||||
struct wl_surface *surface);
|
struct wl_surface *surface);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user