Some tests don't need to wait for the frame callback when a surface is
moved. This commit renames the move_client() helper function to
move_client_frame_sync() so that tests which need synchronisation must
explicitely request it. This allows to get 4 more tests using
repaint only on capture and to speed up runtime.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The test suite is throttled by the headless backend repaint
timer. This commit uses the headless refresh rate option to speed up
runtime by using the immediate repaint-only-on-capture mode by
default. Tests which don't support that mode yet override the refresh
value to use the highest rate possible.
Fixes#682
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Exercise the color-management protocol mechanics.
This lacks a few test cases that are a bit harder to have, e.g. testing
that a bad ICC file gets rejected. In the future we plan to add them.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
wl_display_get_protocol_error() takes a pointer to interface as
parameter and may set it to NULL when the error comes from an unknown
interface.
That can happen when the client destroys the wl_proxy before calling
this function. So when the wl_display.error event comes, it will refer
to an object id that has already been marked as deleted in the
client's object map. So the protocol error interface will be set to
NULL and its id to 0.
In our test suite, expect_protocol_error() ignores such case, and
asserts that a interface != NULL is set. This commit fixes that, and
now callers are able to call expect_protocol_error() when they expect
errors from unknown objects.
In the next commit we add the color-management protocol implementation
tests, and that requires such case to work.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is preparation for the CM&HDR protocol implementation. It requires
us to give a unique id to each color-profile, so let's do that.
In this commit we introduce a generic id generator to libweston, and
its first user: the color-profile.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Start to use the helpers introduced in "tests: add helpers to create
unique filenames".
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Pekka: Dropped program name from output_filename_for_test_case() calls
as it is already added automatically.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
With such helpers we are able to create unique filenames for a test
program, a fixture or specific test cases.
This help us to avoid accidents related to using files from other
tests or overriding them.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We'll need to craft ICC profiles in the CM&HDR protocol implementation
tests. So move it from color-icc-output-test.c to the LittleCMS helper
in our test suite.
This also removes some unused headers from color-icc-output-test.c, as
we've moved a bunch of code to the LittleCMS helper.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The non-zero area check of clipper_quad_clip() is incorrect for quads
initialized with a polygon starting with a vertical edge. In order to
handle polygons starting with an horizontal edge and polygons starting
with a vertical one, it must check opposite vertices for equality.
The test previously described as "Box intersects entire smaller
aligned quad" is now described as "Clockwise winding and top/left
initial vertex". This test keeps the same values as before but all
combinations of winding order and first edge orientations are
also tested. The QUAD() macro isn't used anymore to do so.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add quad clipping tests checking intersections at all edges and
corners of axis-aligned and unaligned quads with negative and positive
values.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Simplify box and quad declarations using dedicated macros.
Hard-coded literals are used instead of preprocessor constants for the
sake of brevity and because, as several new tests will be added, it
appears to be easier to understand those when values are inlined.
Descriptions have been revised to better understand the intent of each
test. Previous descriptions used a coord system with Y pointing up,
new descriptions use Y pointing down in order to improve consistency
with the rest of the code base and to have a common ground when
talking about winding order.
All the tests keep the same input values with the exception of the
last 2 tests with (new) descriptions: "Rotated quad with edges
adjacent to box corners" and "Rotated quad with edges cutting out box
corners". These tests had a different winding order and have been
modified so that all tests use a clockwise order (new axis
convention). The last test also gets a counter-clockwise version in
order to ensure the opposite winding order is correctly supported too.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
When the first vertex passed to the clipper is clipped into two
vertices, the second vertex can sometimes be emitted as the first
clipped vertices while the first vertex is emitted as the last one. A
new utility function assert_vertices() is added to handle that
case. The function also checks the number of clipped vertices and the
clipped vertices in one go.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
One of the three fixture setups of alpha-blending test requires
color-lcms.so. If color-lcms.so is not built, that fixture fails.
Make it skip as necessary, making the test suite pass with
color-management-lcms=false build option.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is very trivial test, which does not skip correctly when built with
color-management-lcms=false. It fails instead.
Since alpha-blending test already covers everything that color-manager
test did, remove color-manager test.
My editor eliminated a stray whitespace, too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Simplify clip_transformed() by replacing its context parameter with a
clipping box parameter. The context struct is still used internally to
pass data around.
Since clip_transformed() doesn't take a context anymore, the clipping
boxes are now declared per test and stored along with the other vertex
data. That prepares the ground to add new tests using different boxes.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Carry on the common vertex representation front by making boxes use
the clip_vertex struct.
A new function clip_quad_box32() is added to clearly separate the main
function taking a clip_vertex struct from the utility function taking
a pixman_box32 struct.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Pass a clip_vertex struct and a size to clip_transformed() instead of
a polygon8 struct to simplify the clipper API by sticking to a common
vertex representation.
Simmplify vertex-clip test since clip_transformed() now works on a
copy of the polygon (commit edd5d1cc09).
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
In the following commits, we'll create the stock sRGB color profile for
outputs in weston_output_init(), and destroy it in
weston_output_release().
We already have a mock color manager in the tests, but we still need
to add the functions to create/destroy a mock stock sRGB color profile.
This should avoid crashes in the following commits.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Add yet another flavor of assertion macros.
Unlike libc assert.h assert(), these cannot be easily disabled by the
build. They also print both the implied expression and the compared
values.
Unlike ZUC macros, there is much less framework code and it can handle
also floating-point types.
The function custom_assert_fail_ can be redefined, meaning that
different compilation units can do different things on failure.
Also the 'compositor' parameter was added to the new macros because we
plan to use these asserts in our log infrastructure, and we want to
print the "failure" messages in the right log scopes. Having the
compositor already in the macros will avoid double work.
Another future possibility is to write specific asserts for the test
suite. So we would be able to write a test suite failure function that
just print what "failed" without aborting.
There is also limited support for custom types.
These are actually pretty similar to libinput's litest macros.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
There are many times when we want to set a global position with a surface
offset added.
It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)
Add a helper for this and convert existing usage.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
On attaching a NULL wl_buffer, weston_surface_attach() will unmap the
surface. Don't immediately remap it within committed() if we don't have
a buffer.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Use the helper, don't mark stuff as mapped ourselves. Set the position
before the view, so when it's marked as mapped, it's already in
position.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The color-metadata-errors test inits outputs with a NULL compositor, and
makes a compositor that's entirely 0s except for the bits it's interested
in.
This makes a mess in a future where the primary_plane is split up per
output, as initializing the primary plane tries to add it to the
compositor's plane_list.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Make sure that in a 1 -> 2 -> 3 -> 4 parent->child subsurface nesting,
destroying surface 2 also immediately unmaps 3 and 4.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The list of client breakpoints was used for both client tests and plugin
tests - anything that uses the weston-test module - but was only
initialised in the client-test path. Make it unconditional.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: efde2fa0b1 ("tests: Add client<->compositor breakpoint support")
This is a very simple test, mostly intended as a demonstration of the
new client<->compositor breakpoint infrastructure. It ensures that for a
simple test surface, a paint node has been created in the output's
paint-node list, reflecting the properties of the attached buffer.
This is an example of properties which are not observable by regular
clients.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add support for clients to request the server insert breakpoints at
various points in its processing. These breakpoints are handled
internally by semaphores (visible to tests through helpers): when the
server reaches the specified point, it will pause execution until the
client allows it to restart.
A weston_compositor pointer returned at each breakpoint allows the
client to reach across the thread boundary and access the server's
internal data structures. This can be used to, for example, inspect
paint nodes, internal damage, or any other work which is not necessarily
client-visible.
The majority of tests will not need to use this infrastructure; it is
only intended for tightly-coupled tests which can very specifically
dictate and anticipate the server's execution flow.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Keep a tracking set of every weston_output created by the compositor,
and use this to listen to the repaint signal.
This currently does nothing, but will later be used to listen to repaint
signals as a client breakpoint type.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Make sure every test handler now gets a copy of wet_testsuite_data,
which we'll later use for client<->compositor synchronisation.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Currently we have some device tests which run in a single iteration
once, then in lots of iterations after that.
The single-iteration case is useless, so remove it, which has the happy
side effect of not breaking when we change the test signature.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This will help us to debug our color pipeline optimizer without the
need to craft special ICC profiles for that. In this initial patch,
we are able to add matrices and curve sets to the pipeline and assure
that the optimizer is doing the right thing.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The event-test moves a client off of all the outputs to check for an
output leave event, but our move_client() code waits on a frame callback
to continue.
The fact that weston currently generates this frame callback is not
something we should enforce in a test, as it could (should) change in
the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
cf. the never-ending saga of how we can't neuter the fontconfig leaks,
also pass our CI leak-sanitizer suppression file when running tests
locally. This makes it easier to run with ASan enabled in your local
environment.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We rely on the Xwayland launcher setting $DISPLAY to connect to our own
X server. Make very sure in the tests that we're actually getting that
set properly.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We need this so that Weston can update the "click to activate" serial, so
that we can then use the constraints protocol (see
maybe_enable_pointer_constraint() in libweston/input.c).
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>