Commit Graph

777 Commits

Author SHA1 Message Date
Kristian Høgsberg a1377cf198 Add missing builddir includes for version.h
af4f2aaf19 broke this
2013-02-20 14:47:43 -05:00
Kristian Høgsberg af4f2aaf19 Install header files and pkg-config file for external modules
This patch installs the three header files that define the compositor
plugin interface as well as a pkg-config file.  This allows
building weston plugins outside the weston tree.  We currently don't make
any guarantees about the plugin API/ABI except that within a stable
branch we won't break it.
2013-02-18 15:29:35 -05:00
Jan Arne Petersen a75a789fc1 text: fix weston key bindings with input methods
Add a struct weston_keyboard, to handle the input method grab.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:02:26 -05:00
Pekka Paalanen d1c426eef7 tests: add test for buffer release event
Tests especially, that attach-attach-commit does not result in a release
of the first buffer.

Also tests, that the old buffer is released when a new buffer has been
attached, committed, and displayed (frame callback).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-08 13:38:17 -05:00
Pekka Paalanen 32ac9b9245 tests: export create_shm_buffer() helper
Lets the tests create additional buffers easily.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-08 13:38:14 -05:00
Pekka Paalanen 8aaef7d48c tests: add frame callback waiting helpers
To avoid duplicating the code for setting and waiting for a frame
callback, add helpers for it.

Convert move_client() to use the new helpers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-08 13:38:09 -05:00
Tiago Vignatti 19dadf2617 tests: Add XWayland test
By default enabled but one can disable it by passing --disable-xwayland-test
to the configure script. Also, the weston-tests-env script is trying to load
xwayland.so in either case, but it behaves resilient in the absence of that
meaning all the other tests are still going to be kicked for running.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2013-02-08 12:18:05 -05:00
U. Artie Eoff 209e8f177a tests: fix assignment typo, should be comparison
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2013-02-07 21:18:35 -05:00
Pekka Paalanen 585c27c717 tests: make signal other than ABRT a hard failure
We handle FAIL_TEST tests by simply inverting the success flag. The
problem with this is, that if a FAIL_TEST fails by a SIGSEGV, it will be
interpreted as passed. However, no code should ever cause a SEGV, or any
other signal than ABRT. And even ABRT only in the case of an assert()
that is meant to fail. We would probably need more sophistication for the
FAIL_TEST cases.

For now, just interpret any other signal than ABRT as a hard failure,
regardless whether it is a TEST or FAIL_TEST. At least segfaults do not
cause false passes anymore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-01-24 16:24:22 -05:00
Rob Bradford c59a33a1e2 tests/setbacklight: Close filedescriptor on return paths 2013-01-10 16:07:08 -05:00
Kristian Høgsberg e565b40569 tests: Pass --backend so the test suite runs with the right modules
Without this we try to load the installed backends, which is nasty for
regular runs, and just doesn't work for make distcheck, which sets
prefix to $PWD/_inst.  This makes sure we load the right backend
and make distcheck pass.  Other modules (xwayland, shells etc) just don't
get loaded for distcheck and for make check we still try to load the
installed modules.
2012-12-14 16:34:00 -05:00
Pekka Paalanen d56d4d5f44 tests: remove test logs on 'make clean'
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-13 13:10:06 -05:00
Pekka Paalanen f2aa64f18a tests: check wl_display_roundtrip() for errors
Add a macro that wraps wl_display_roundtrip() and check for errors. It
is a macro, so that the assert would show the relevant file and line
number.

This will also catch protocol errors, that would go unnoticed otherwise.

All roundtrips in tests are replaced with the check.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:39:01 -05:00
Pekka Paalanen 07921d791a tests: set client log handler
Otherwise we cannot normally see protocol errors etc. in the test
output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:48 -05:00
Pekka Paalanen c660821918 update git ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:45 -05:00
Pekka Paalanen fd51796094 tests: write logs to files
This cleans up the 'make check' output considerably. When all goes well,
you will only see the "PASS" line for each of $TESTS.

Weston logs into a separate file than stdout and stderr, so server logs
end up in one file per test, and other output to another file per test.

'make distclean' does not remove the tests/logs/ directory.

Also changes the weston-tests-env interpreter to bash, since I think &>
and ${1/.la/.so} might be bashisms.
2012-12-12 10:38:38 -05:00
Kristian Høgsberg 15be01ebe6 tests: Convert remaining module tests to not use test-runner.c
The remaining module tests don't need to fork and talk to a test client,
so just convert them to regular modules and let them handle running their
tests themselves.  Then drop test-runner.[ch].
2012-12-11 23:22:16 -05:00
Kristian Høgsberg cbc35ae281 tests: Remove client-test test
This test case is the last user of the test-client code and it only
tests launching the test-client.  In other words it's a minimal test
of the framework we're dropping, so just drop this test.
2012-12-11 23:16:11 -05:00
Kristian Høgsberg 1cb3df4e46 tests: Port text-test to new test framework
So much simpler this way and the test suite is now back too 100% pass.
2012-12-11 23:04:14 -05:00
Kristian Høgsberg ba0cfdd284 tests: Drop yield() helper function
Remaining use case was when we move the pointer.  This doesn't change
geometry so we can just use a wl_display_roundtrip() to make sure
we get the request to the server and receive the resulting events.
2012-12-11 22:17:35 -05:00
Kristian Høgsberg 1f4d8e9def keyboard-test: Use wl_display_roundtrip() instead of yield()
As for button-test, a wl_display_roundtrip is sufficient here.  The
yield() between wl_test_activate_surface() and wl_test_send_key() is
also not needed, since the two requests will arrive at the server in
order, and will activate the surface first, then send a key event.
2012-12-11 22:00:54 -05:00
Kristian Høgsberg f63fab7241 button-test: Use wl_display_roundtrip instead of yield()
A round trip is sufficient here.  We need to make sure that the server
has received the wl_test request and that we've received the event
that the request triggers.  The wl_display_roundtrip() helper does
exactly that: it sends a wl_display.sync request, which will hit the
server after the wl_test requests and thus the wl_callback.done event
will come back after the server has seen all the previous requests and
after we've handled all preceeding event.
2012-12-11 21:58:22 -05:00
Kristian Høgsberg db6dc7d470 weston-test-client-helper: Use a frame callback to flush surface geometry
When moving a test surface, use a frame callback to make sure the
surface has been moved and the geometry updated.  The compositor may
delay updating the transform matrices, but once we get the frame
callback we know the surface has been repainted and the geometry
updated.
2012-12-11 21:50:14 -05:00
U. Artie Eoff 0a7d588740 tests: Convert button-test to new test extension
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56821

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:40 -05:00
U. Artie Eoff 84f9db5f90 tests: Convert event-test to new test extension
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56819

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:33 -05:00
U. Artie Eoff 1ba9b38ec6 tests: Convert keyboard-test to new test extension
This adds a weston-test-runner for the weston test extension and
some weston test client helper methods.

Converted keyboard-test to use the new test interface, runner,
and helper methods.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56822

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:25 -05:00
U. Artie Eoff 617f478df3 tests: Allow weston-tests-env to process different test types
The weston-tests-env script needs to be able to handle weston
test extension style tests as well as module style tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:05 -05:00
U. Artie Eoff e491b13d0a tests: Rename weston-test to weston-tests-env
Renamed weston-test test environment script to weston-tests-env
to avoid ambiguity with weston-test.c (the weston test extension).

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:29:58 -05:00
U. Artie Eoff 65e7e7a65b tests: Define and implement a test protocol extension.
The weston test extension, called weston-test.so, can be loaded
from the "modules" configuration option on the command line
or in the .ini file.

Clients can bind to the "wl_test" interface to interact with
the weston test extension.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:29:52 -05:00
Rob Bradford 4a822495fa Move matrix.[ch] to shared
This means it can be used for the calibration tool.
2012-12-06 15:53:03 -05:00
Kristian Høgsberg f3dfe716f3 tests: Remove last GLfloat use
With the EGL/GLES2 types out of compositor.h this now fails to compile.

https://bugs.freedesktop.org/show_bug.cgi?id=57129
2012-11-14 14:42:51 -05:00
Kristian Høgsberg 128ee2c342 test-client: Make sure we process pending eevents before we verify state
Since the send-button-state request comes in on one socket and the
wayland event we're looking for comes in on another socket, the order
that we process the two in is undefined.  Thus, button-test fails
intermittently, depending on which event we process first.

We change wl_display_flush() to wl_display_roundtrip(), to make sure that
we deal with all wayland events before handling test protocol requests.
2012-10-21 22:30:26 -04:00
John Kåre Alsaker 011a1ce350 Remove some dead code. 2012-10-16 11:29:10 -04:00
Kristian Høgsberg d1ecb284ba tests: Update tests to new APIs 2012-10-11 10:07:31 -04:00
John Kåre Alsaker 71c474416a tests: Remove GLfloat usage. 2012-10-04 12:28:04 -04:00
U. Artie Eoff 840d5f975b tests: add keyboard test
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:40:57 -04:00
U. Artie Eoff 58990cae31 tests: add button test
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:40:04 -04:00
U. Artie Eoff d690175a22 tests: test surface to/from global functions
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:39:59 -04:00
U. Artie Eoff 1ae298f9d9 event-test: more aggressive event testing
Test surface pointer enter/leave/motion and surface leave/enter
events more aggressively.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:39:55 -04:00
U. Artie Eoff 13dc708ab7 test-client: initialize input instance.
In seat_handle_capabilities, if input->pointer is not properly
initialized, then it will contain an arbitrary value and results
in the wl_pointer listener not getting registered if that value
is not 0/null.  Thus, use calloc to initialize the "input" instance.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=49937

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-09-25 11:24:49 -04:00
Ander Conselvan de Oliveira 231ba171c6 compositor: Always assign an output when updating a surface transform
Also make all the callers of weston_surface_assign_output() update the
transform instead. This makes sure that when the surface is assigned an
output its bouding box is valid.

This fixes a bug where a newly created surface would have a NULL output
assigned. This would cause weston_surface_schedule_repaint() to not
schedule a repaint, preventing the surface to be shown until something
else caused a repaint.
2012-09-14 13:43:08 -04:00
Jan Arne Petersen ce8a4433f5 text: Add support for control keys to the protocol
Add key event to the text_model interface and a key request to the
input_method_context interface. Implement it in the example editor
client and the example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:52:41 -04:00
Jan Arne Petersen e202bae9d3 text: Add delete_surrounding_text to protocol
Add delete_surrounding_text event in the text_model interface and the
request in the input_method_context interface. Implement it in the
example editor client and in the example keyboard so that the backspace
key works with it.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:51:08 -04:00
Jan Arne Petersen 4c26518ad1 text: Remove surface arg in create_text_model
Remove the wl_surface argument from create_text_model request. The
wl_surface is specified as an argument in the activate request instead.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:28:04 -04:00
Kristian Høgsberg a6813d2887 compositor: Generalize module loading
We can now load any number of general modules, and the shell and xwayland
are just two of them.  We continue to use the mechanism for testing but
custom input drivers or logging mechanisms, for example are other use cases.
2012-09-12 12:21:03 -04:00
U. Artie Eoff 38b4d62ece test-text-client: fix compile error
Pass surface to text_model_factory_create_text_model.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54502

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-09-04 16:15:59 -04:00
Jan Arne Petersen b00e6632f6 tests: Add unit test for text model
Add tests for activate/deactivate and unfocusing of the assigned
surface.
2012-08-29 15:02:21 -04:00
Jan Arne Petersen 6f83d0d4a7 tests: Explicitly define the test client to launch
Allow different test clients to launch. The test client is defined by
an argument in the test_client_launch() function.
2012-08-29 15:02:18 -04:00
Philipp Brüschweiler 468262be3e event-test: fix compilation
Also fixes a compiler warning in test-client. The test is still failing,
but that's for another patch.

https://bugs.freedesktop.org/show_bug.cgi?id=53462
2012-08-14 10:17:07 -04:00
Pekka Paalanen 4b141597c6 configure: make setbacklight optional
Modify the pkg-config check for setbacklight so that failure only
disables building setbacklight, instead of failing the whole configure.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:43 -04:00
Damien Lespiau ea40bf88bc tests: Use pkg-config to find setbacklight CFLAGS and libs
setbacklight depends on udev and drm, one cannot just add the -l flags
if you want to support unusual install paths.
2012-07-25 10:40:11 -04:00
Kristian Høgsberg 5085001f82 tests: Handle modifier event in test-client.c
We need the handle the newly added modifiers event.

https://bugs.freedesktop.org/show_bug.cgi?id=51567
2012-07-09 22:17:03 -04:00
Kristian Høgsberg 325b3d16ce tests: Add weston-test to EXTRA_DIST 2012-06-25 17:50:22 -04:00
Kristian Høgsberg c3a13cc6cf tests: Use weston_surface_to_global_float
Forgot to update use of weston_surface_to_global() here.
2012-06-09 08:46:51 -04:00
Daniel Stone b7452fe313 Add support for wl_keyboard::keymap events
These keymap events communicate the keymap from the compositor to the
clients via fd passing, rather than having the clients separately
compile a map.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-06-01 11:14:51 -04:00
Daniel Stone 2fce4028d6 Convert wl_pointer::axis to wl_fixed_t
To go with the matching protocol change.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:45:25 -04:00
Daniel Stone 4dbadb1556 Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:42:47 -04:00
Daniel Stone 11d7139989 test-client.c: Replace hard-coded magic value
Took me a second to work out that the 272 was actually BTN_LEFT, as keys
and buttons share a namespace in evdev.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:42:25 -04:00
Pekka Paalanen daed3bc1aa tests, wcap: update ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-31 13:53:57 -04:00
Kristian Høgsberg 870461997a tests: Rename left-over caps_mask to capability 2012-05-17 09:09:21 -04:00
Daniel Stone 37816df646 Convert wl_input_device to wl_seat (and friends)
wl_input_device has been both renamed and split.  wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.

It now only generates one event: to let clients know that it has new
capabilities.  It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.

This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat).  Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.

For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-16 15:29:06 -04:00
Ander Conselvan de Oliveira 6d2030dabb tests: Fix event-test
notify_motion() now receives coordinates in wl_fixed_t but the test was
still passing integers.
2012-05-15 10:59:11 -04:00
Daniel Stone 103db7fb56 Convert wire input co-ordinates to fixed-point
To add greater precision when working with transformed surfaces and/or
high-resolution input devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:41:01 -04:00
Daniel Stone b230a7ee58 Convert internal input co-ordinates to GLfloat
Change all client motion handlers to take GLfloat for co-ordinates,
rather than int32_t.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:40:57 -04:00
Daniel Stone 7ceeb7dd43 test-client: Include poll.h to silence warning
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 10:59:08 -04:00
Kristian Høgsberg 3018b4431b tests: Add event-test, which tests for a few incoming events
We check that we get surface.enter_output and move the pointer into
the window and make sure we get input_device.pointer_enter with
the right coordinates.

There's a lot of code for a very simple test here, so we need to
figure out how to reuse most of the event handling and such.  It's also
not clear that a custom, text based protocol is practical here, we might
just use a wayland extension after all.
2012-04-27 15:03:06 -04:00
Kristian Høgsberg dd90921d87 tests: Generalize test client and add helpers for launching it 2012-04-27 11:15:58 -04:00
Kristian Høgsberg 915b7f8945 tests: Add test case for basic client lifecycle 2012-04-26 10:18:24 -04:00
Kristian Høgsberg 306e36185c tests: Add an initial weston integration test
The idea here is to make weston load test cases as a module and then
run test cases from within weston.
2012-04-26 09:07:13 -04:00
Kristian Høgsberg 6412718c0d Always build tests
There are no dependencies or requirements there that we don't already
need for weston itself.  So lets just always build them.

Use check_PROGRAMS for the matrix unit test case.
2012-04-11 09:38:32 -04:00
Casey Dahlin 476168ea05 weston: update .gitignore files
Updates the .gitignore files for clients and tests to reflect a new test and a
couple of renamed applications.

Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
2012-04-11 08:24:35 -04:00
Tiago Vignatti 1b079abe0e tests: add backlight test
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-20 22:43:54 -04:00
Kristian Høgsberg 010f98b083 window: Track and report input and opaque regions
We just set the input region to the bounding box of the window frame
and set the opaque region to be the opaque rectangle inside the window
if the child widget is opaque.
2012-02-23 17:30:54 -05:00
Kristian Høgsberg becfcbfbd2 test: Fix out-of-tree builds 2012-01-30 19:17:52 -05:00
Ander Conselvan de Oliveira a7ef5c85d8 build: fix build of matrix test
This test uses files from src/ so use COMPOSITOR_CFLAGS to find headers
in non-standard locations.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-01-30 19:17:17 -05:00
Pekka Paalanen d1f0ab6343 compositor: simplify the matrix inversion API
The compositor will likely do an order of magnitude less matrix
inversions than point transformations with an inverse, hence we do not
really need the optimised path for single-shot invert-and-transform.

Expose only the computing of the explicit inverse matrix in the API.

However, the matrix inversion tests need access to the internal
functions. Designate a unit test build by #defining UNIT_TEST, and
export the internal functions in that case.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00
Pekka Paalanen 4520d5cafb tests: add matrix-test
Add a new directory tests/ for unit test applications. This directory
will be built only if --enable-tests is given to ./configure.

Add matrix-test application. It excercises especially the
weston_matrix_invert() and weston_matrix_inverse_transform() functions.
It has one test for correctness and precision, and other tests for
measuring the speed of various matrix operations.

For the record, the correctness test prints:

a random matrix:
   1.112418e-02   2.628150e+00   8.205844e+02  -1.147526e-04
   4.943677e-04  -1.117819e-04  -9.158849e-06   3.678122e-02
   7.915063e-03  -3.093254e-04  -4.376583e+02   3.424706e-02
  -2.504038e+02   2.481788e+03  -7.545445e+01   1.752909e-03

The matrix multiplied by its inverse, error:
   0.000000e+00  -0.000000e+00  -0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
  -0.000000e+00  -0.000000e+00   0.000000e+00  -0.000000e+00
   0.000000e+00   0.000000e+00   0.000000e+00   0.000000e+00
max abs error: 0, original determinant 11595.2

Running a test loop for 10 seconds...
test fail, det: -0.00464805, error sup: inf
test fail, det: -0.0424053, error sup: 1.30787e-06
test fail, det: 5.15191, error sup: 1.15956e-06
tests: 6791767 ok, 1 not invertible but ok, 3 failed.
Total: 6791771 iterations.

These results are expected with the current precision thresholds in
src/matrix.c and tests/matrix-test.c. The random number generator is
seeded with a constant, so the random numbers should be the same on
every run. Machine speed and scheduling affect how many iterations are
run.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 10:44:22 +02:00