• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Collabora, Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23  * SOFTWARE.
24  */
25 
26 #ifndef WESTON_TEST_FIXTURE_COMPOSITOR_H
27 #define WESTON_TEST_FIXTURE_COMPOSITOR_H
28 
29 #include <wayland-client-protocol.h>
30 #include <libweston/libweston.h>
31 
32 #include "weston-testsuite-data.h"
33 
34 /** Weston renderer type
35  *
36  * \sa compositor_setup
37  * \ingroup testharness
38  */
39 enum renderer_type {
40 	/** Dummy renderer that does nothing. */
41 	RENDERER_NOOP = 0,
42 	/** Pixman-renderer */
43 	RENDERER_PIXMAN,
44 	/** GL-renderer */
45 	RENDERER_GL
46 };
47 
48 /** Weston shell plugin
49  *
50  * \sa compositor_setup
51  * \ingroup testharness
52  */
53 enum shell_type {
54 	/** Desktop test-shell with predictable window placement and
55 	 * no helper clients */
56 	SHELL_TEST_DESKTOP = 0,
57 	/** The full desktop shell. */
58 	SHELL_DESKTOP,
59 	/** The ivi-shell. */
60 	SHELL_IVI,
61 	/** The fullscreen-shell. */
62 	SHELL_FULLSCREEN
63 };
64 
65 /** Weston compositor configuration
66  *
67  * This structure determines the Weston compositor command line arguments.
68  * You should always use compositor_setup_defaults() to initialize this, then
69  * override any members you need with assignments.
70  *
71  * \ingroup testharness
72  */
73 struct compositor_setup {
74 	/** The backend to use. */
75 	enum weston_compositor_backend backend;
76 	/** The renderer to use. */
77 	enum renderer_type renderer;
78 	/** The shell plugin to use. */
79 	enum shell_type shell;
80 	/** Whether to enable xwayland support. */
81 	bool xwayland;
82 	/** Default output width. */
83 	unsigned width;
84 	/** Default output height. */
85 	unsigned height;
86 	/** Default output scale. */
87 	int scale;
88 	/** Default output transform, one of WL_OUTPUT_TRANSFORM_*. */
89 	enum wl_output_transform transform;
90 	/** The absolute path to \c weston.ini to use,
91 	 * or NULL for \c --no-config . */
92 	const char *config_file;
93 	/** Full path to an extra plugin to load, or NULL for none. */
94 	const char *extra_module;
95 	/** Debug scopes for the compositor log,
96 	 * or NULL for compositor defaults. */
97 	const char *logging_scopes;
98 	/** The name of this test program, used as a unique identifier. */
99 	const char *testset_name;
100 };
101 
102 void
103 compositor_setup_defaults_(struct compositor_setup *setup,
104 			   const char *testset_name);
105 
106 /** Initialize compositor setup to defaults
107  *
108  * \param s The variable to initialize.
109  *
110  * The defaults are:
111  * - backend: headless
112  * - renderer: noop
113  * - shell: desktop shell
114  * - xwayland: no
115  * - width: 320
116  * - height: 240
117  * - scale: 1
118  * - transform: WL_OUTPUT_TRANSFORM_NORMAL
119  * - config_file: none
120  * - extra_module: none
121  * - logging_scopes: compositor defaults
122  * - testset_name: the test name from meson.build
123  *
124  * \ingroup testharness
125  */
126 #define compositor_setup_defaults(s) do {\
127 	compositor_setup_defaults_(s, THIS_TEST_NAME); \
128 } while (0)
129 
130 int
131 execute_compositor(const struct compositor_setup *setup,
132 		   struct wet_testsuite_data *data);
133 
134 #endif /* WESTON_TEST_FIXTURE_COMPOSITOR_H */
135