tests: migrate surface, surface-global
These are normal plugin tests, moved to the new harness. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
9615ad8b91
commit
99c536db91
+2
-2
@@ -116,6 +116,8 @@ tests = [
|
|||||||
{ 'name': 'roles', },
|
{ 'name': 'roles', },
|
||||||
{ 'name': 'string', },
|
{ 'name': 'string', },
|
||||||
{ 'name': 'subsurface-shot', },
|
{ 'name': 'subsurface-shot', },
|
||||||
|
{ 'name': 'surface', },
|
||||||
|
{ 'name': 'surface-global', },
|
||||||
{
|
{
|
||||||
'name': 'vertex-clip',
|
'name': 'vertex-clip',
|
||||||
'dep_objs': dep_vertex_clipping,
|
'dep_objs': dep_vertex_clipping,
|
||||||
@@ -203,8 +205,6 @@ if get_option('xwayland')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
tests_weston_plugin = [
|
tests_weston_plugin = [
|
||||||
['surface'],
|
|
||||||
['surface-global'],
|
|
||||||
['surface-screenshot', 'surface-screenshot-test.c', dep_libshared],
|
['surface-screenshot', 'surface-screenshot-test.c', dep_libshared],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+15
-18
@@ -31,11 +31,23 @@
|
|||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "libweston-internal.h"
|
#include "libweston-internal.h"
|
||||||
#include "compositor/weston.h"
|
#include "compositor/weston.h"
|
||||||
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
|
||||||
static void
|
static enum test_result_code
|
||||||
surface_to_from_global(void *data)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
{
|
{
|
||||||
struct weston_compositor *compositor = data;
|
struct compositor_setup setup;
|
||||||
|
|
||||||
|
compositor_setup_defaults(&setup);
|
||||||
|
|
||||||
|
return weston_test_harness_execute_as_plugin(harness, &setup);
|
||||||
|
}
|
||||||
|
DECLARE_FIXTURE_SETUP(fixture_setup);
|
||||||
|
|
||||||
|
PLUGIN_TEST(surface_to_from_global)
|
||||||
|
{
|
||||||
|
/* struct weston_compositor *compositor; */
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_view *view;
|
struct weston_view *view;
|
||||||
float x, y;
|
float x, y;
|
||||||
@@ -76,19 +88,4 @@ surface_to_from_global(void *data)
|
|||||||
|
|
||||||
weston_view_from_global(view, 5, 10, &ix, &iy);
|
weston_view_from_global(view, 5, 10, &ix, &iy);
|
||||||
assert(ix == 0 && iy == 0);
|
assert(ix == 0 && iy == 0);
|
||||||
|
|
||||||
weston_compositor_exit(compositor);
|
|
||||||
}
|
|
||||||
|
|
||||||
WL_EXPORT int
|
|
||||||
wet_module_init(struct weston_compositor *compositor,
|
|
||||||
int *argc, char *argv[])
|
|
||||||
{
|
|
||||||
struct wl_event_loop *loop;
|
|
||||||
|
|
||||||
loop = wl_display_get_event_loop(compositor->wl_display);
|
|
||||||
|
|
||||||
wl_event_loop_add_idle(loop, surface_to_from_global, compositor);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-18
@@ -30,11 +30,23 @@
|
|||||||
|
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "compositor/weston.h"
|
#include "compositor/weston.h"
|
||||||
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
|
||||||
static void
|
static enum test_result_code
|
||||||
surface_transform(void *data)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
{
|
{
|
||||||
struct weston_compositor *compositor = data;
|
struct compositor_setup setup;
|
||||||
|
|
||||||
|
compositor_setup_defaults(&setup);
|
||||||
|
|
||||||
|
return weston_test_harness_execute_as_plugin(harness, &setup);
|
||||||
|
}
|
||||||
|
DECLARE_FIXTURE_SETUP(fixture_setup);
|
||||||
|
|
||||||
|
PLUGIN_TEST(surface_transform)
|
||||||
|
{
|
||||||
|
/* struct weston_compositor *compositor; */
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_view *view;
|
struct weston_view *view;
|
||||||
float x, y;
|
float x, y;
|
||||||
@@ -56,19 +68,4 @@ surface_transform(void *data)
|
|||||||
weston_view_update_transform(view);
|
weston_view_update_transform(view);
|
||||||
weston_view_to_global_float(view, 50, 40, &x, &y);
|
weston_view_to_global_float(view, 50, 40, &x, &y);
|
||||||
assert(x == 200 && y == 340);
|
assert(x == 200 && y == 340);
|
||||||
|
|
||||||
weston_compositor_exit(compositor);
|
|
||||||
}
|
|
||||||
|
|
||||||
WL_EXPORT int
|
|
||||||
wet_module_init(struct weston_compositor *compositor,
|
|
||||||
int *argc, char *argv[])
|
|
||||||
{
|
|
||||||
struct wl_event_loop *loop;
|
|
||||||
|
|
||||||
loop = wl_display_get_event_loop(compositor->wl_display);
|
|
||||||
|
|
||||||
wl_event_loop_add_idle(loop, surface_transform, compositor);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user