Commit Graph

826 Commits

Author SHA1 Message Date
Samuel Degrande
4594d1bafe Removes the addition of the .exe extension to unit-test scripts, on win32.
On win32, test scripts are created with a .exe extension.
Under mingw, a .exe script is launched in 16 bit compatibility mode (through
ntvdm), and so it just does not run.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2619
2011-04-01 17:08:25 +01:00
Emmanuele Bassi
d3a7b7502e event: Add setters for ClutterEvent members
Creating a synthetic event requires direct access to the ClutterEvent
union members; this access does not map in bindings to high-level
languages, especially run-time bindings using GObject-Introspection.
It's also midly annoying from C, as it unnecessarily exposes the guts of
ClutterEvent - something we might want to fix in the future.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2575
2011-02-28 14:16:23 +00:00
Neil Roberts
26ec3efbff tests: Check return value of clutter_init_with_args instead of error
Some of the tests were ignoring the return value of
clutter_init_with_args and instead they would recognise an error by
seeing whether the GError parameter was set. This patch changes it to
check the return value so that it won't give a warning now that
G_GNUC_WARN_UNUSED_RESULT is on that function.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
2011-02-28 14:10:06 +00:00
nobled
eb906d85ca tests: abort if clutter_init fails
This fixes segfaults when something goes wrong during
init, but the test keeps going anyway.

Except for test-easing and test-picking, these were fixed by
sed magic:

sed -i -s -e "s/clutter_init \?(&argc, &argv)/\
if (clutter_init (\&argc, \&argv) != CLUTTER_INIT_SUCCESS)\n\
    return 1/" tests/*/*.c

http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
2011-02-28 14:10:04 +00:00
Neil Roberts
daa6d67cc0 Add a conformance test for atlas migration
This adds a conformance test which creates a lot of textures with
increasing size and destroys them again a number of times in order to
cause a few atlas migrations. The last time the textures are created
they are all read back and the data is verified to confirm that the
atlas migration successfully preserved the data.
2011-02-24 20:45:30 +00:00
Emmanuele Bassi
3c25fcfe49 tests: Remove unused variables 2011-02-19 16:47:20 +00:00
Emmanuele Bassi
b505c022c4 test-timeline: Ignore the default stage
We need to create the default stage to have the master clock spin, but
we can tell the compiler that the returned value is meaningless.
2011-02-19 16:47:20 +00:00
Emmanuele Bassi
92ddaa9c13 stage: Move stage redraw logic into clutter-stage.c
The _clutter_do_redraw() function should really be moved inside
ClutterStage, since all it does is calling private stage and
backend functions. This also allows us to change a long-standing
issue with a global fps counter for all stages, instead of a\
per-stage one.
2011-02-18 12:56:17 +00:00
Emmanuele Bassi
fc89513295 actor: Move the ShaderData out of the private data
Let's try and start reducing the size of ClutterActorPrivate by moving
some optional, out-of-band data from it to GObject data.

The ShaderData structure is a prime candidate for this migration: it
does not need to be inspected by the actor, and its relationship with an
actor is transient and optional.

By attaching it to the actor's instance through g_object_set_data() we
neatly tie its lifetime to the instance, and we don't have to care
cleaning it up in the finalize()/dispose() implementation of
ClutterActor itself.
2011-02-18 11:43:27 +00:00
Emmanuele Bassi
24c311466c tests/multi-stage: Clean up child stages
Do not leave them around: force a destroy() on any child stage left when
the main loop quits.
2011-02-13 19:27:51 +00:00
Neil Roberts
98a33e03d3 Add a conformance test for cogl_pipeline_set_layer_matrix
This adds a conformance test which paints using a pipeline that has
two layers containing textures. Each layer has a different user
matrix. When the two layers are combined with the right matrices then
all of the colors end up white. The test then verifies this by reading
back the pixels.
2011-02-09 16:14:12 +00:00
Emmanuele Bassi
03358aca6c test-actors: Clear the state on destroy
The venerable test-actors used the default stage, which meant that
closing the window just stopped the main loop but left the scene intact.
This does not happen with a normal stage created through
clutter_stage_new().

The change happened in 6ed6b2a54b, in an
unhelpfully named commit that was just supposed to switch to static
colors. My bad.

Anyway, the change led to some assertion failures when closing the stage
in the middle of an animation.

The correct thing to do when using an actor from another object (a
Timeline ::new-frame callback in this case) without owning the instance
is to connect to the ::destroy signal and clean up the pointer to avoid
calling an invalid actor.
2011-02-09 13:36:54 +00:00
Neil Roberts
1d7e223313 test-path: Fix the test when running against latest Cairo versions
Cairo has recently changed so that it no longer adds a final move-to
command when the path ends with a close. This patch makes the test
check the run-time version number of Cairo to avoid duplicating this
behaviour when testing the conversion to and from a Cairo path.
2011-01-28 18:11:38 +00:00
Emmanuele Bassi
5329c98694 bind-constraint: Add BIND_POSITION and BIND_SIZE
CLUTTER_BIND_POSITION and CLUTTER_BIND_SIZE are two convenience
enumeration values for binding x and y, and width and height
respectively, using a single ClutterBindConstraint.
2011-01-25 11:14:37 +00:00
Neil Roberts
6102f80244 test-clip: Replace the ellipse with a rotated rectangle
With test-clip it's possible to draw three different shapes depending
on what mouse button is used: a rectangle, an ellipse or a path
containing multiple shapes. However the ellipse is also a path so it
doesn't really test anything extra from the third option. This
replaces the ellipse with a rectangle that is first rotated by the
modelview matrix. The rotated matrix won't be able to use the scissor
so it can be used to test stencil and clip plane clipping.
2011-01-24 17:40:07 +00:00
Neil Roberts
e8d5be0ba7 ClutterTimeline: Fix the 'msecs' parameter for the new-frame signal
Between Clutter 0.8 and 1.0, the new-frame signal of ClutterTimeline
changed the second parameter to be an elapsed time in milliseconds
rather than the frame number. However a few places in clutter were
still calling the parameter 'frame_num' which is a bit
misleading. Notably the signature for the signal class closure in the
header was using the wrong name. This changes them to use 'msecs'.
2011-01-24 11:52:47 +00:00
Bastian Winkler
6bffd407fd model: Add support to define rows in ClutterScript
This adds a custom "rows" property, that allows to define the rows of a
ClutterModel. A single row can either an array of all columns or an
object with column-name : column-value pairs.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2528
2011-01-21 20:44:17 +00:00
Emmanuele Bassi
86c786aaad Merge branch 'xi2'
* xi2: (41 commits)
  test-devices: Actually print the axis data
  device-manager/xi2: Sync the stage of source devices
  event: Clean up clutter_event_copy()
  device: unset the axes array pointer when resetting
  device-manager/xi2: Fix device hotplugging
  glx: Clean up GLX implementation
  device/x11: Store min/max keycode in the XI device class
  x11: Hide all private symbols
  docs: More documentation fixes for InputDevice
  */event: Never manipulate the event queue directly
  win32: Update DeviceManager device creation
  device: Allow enabling/disabling non-master devices
  backend/eglx: Add newly created stages to the translators
  device: Add more doc annotations
  device: Use a double for translate_axis() argument
  test-devices: Clean up and show axes data
  event: Fix up clutter_event_copy()
  device/xi2: Translate the axis data after setting devices
  device: Add more accessors for properties
  docs: Update API reference
  ...
2011-01-21 20:22:32 +00:00
Robert Bragg
b3775a7564 cogl: s/Cogl*Vertex/CoglVertex*/
We have a bunch of experimental convenience functions like
cogl_primitive_p2/p2t2 that have corresponding vertex structures but it
seemed a bit odd to have the vertex annotation e.g. "P2T2" be an infix
of the type like CoglP2T2Vertex instead of be a postfix like
CoglVertexP2T2. This switches them all to follow the postfix naming
style.
2011-01-21 16:22:40 +00:00
Robert Bragg
3f9e859167 test-picking: Don't manually paint the stage
Instead of using an idle handler that synchonously paints the stage
by manually calling clutter_actor_paint (stage) the test now uses an
idle handler that repeatedly queues a redraw on the stage.

do_events is now called from a "paint" signal handler for the stage, and
instead of manually determining the fps the test now uses
CLUTTER_SHOW_FPS=1 instead.
2011-01-21 16:18:11 +00:00
Emmanuele Bassi
b7d26b2d02 test-devices: Actually print the axis data
Returning in an if() block whose condition we assume to be true doesn't
play nicely with having statements after the block. Let's fix that.
2011-01-21 15:27:56 +00:00
Emmanuele Bassi
0e99346915 device-manager/xi2: Fix device hotplugging
Hierarchy and Device changed events come through with the X window set
to be the root window, not the stage window. We need to whitelist them
so that we can actually support hotplugging and device changes.
2011-01-21 11:41:36 +00:00
Emmanuele Bassi
73cf6bd52c device: Allow enabling/disabling non-master devices
Slave and floating devices should always be disabled, and not deliver
events to the scene. It is up to the user to enable non-master devices
and handle events coming from them.

ClutterInputDevice gets a new :enabled property, defaulting to FALSE;
when a device manager creates a new device it has to set it to TRUE if
the :device-mode property is set to CLUTTER_INPUT_MODE_MASTER.

The main event queue entry point, _clutter_event_push(), will
automatically discard events coming from disabled devices.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
f54044f7e4 test-devices: Clean up and show axes data 2011-01-21 10:25:45 +00:00
Emmanuele Bassi
1b1e77b469 event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.

The new design for handling X11 event translation works this way:

  - ClutterBackend::translate_event() has been added as the central
    point used by a ClutterBackend implementation to translate a
    native event into a ClutterEvent;

  - ClutterEventTranslator is a private interface that should be
    implemented by backend-specific objects, like stage
    implementations and ClutterDeviceManager sub-classes, and
    allows dealing with class-specific event translation;

  - ClutterStageX11 implements EventTranslator, and deals with the
    stage-relative X11 events coming from the X11 event source;

  - ClutterStageGLX overrides EventTranslator, in order to
    deal with the INTEL_GLX_swap_event extension, and it chains up
    to the X11 default implementation;

  - ClutterDeviceManagerX11 has been split into two separate classes,
    one that deals with core and (optionally) XI1 events, and the
    other that deals with XI2 events; the selection is done at run-time,
    since the core+XI1 and XI2 mechanisms are mutually exclusive.

All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
770bcd5b40 test-pixmap: Remove the GLX code
The ClutterGLXTexturePixmap actor is just a wrapper around
ClutterX11TexturePixmap, since the relevant texture-from-pixmap code has
been moved down to Cogl.
2011-01-20 12:59:56 +00:00
Emmanuele Bassi
a2d6edd422 test-pixmap: Fix up compilation on EGLX
We need to check for the GLX windowing system if we are to include
clutter-glx.h.
2011-01-19 18:51:01 +00:00
Emmanuele Bassi
a43c5f10bb tests: Try to drop including config.h
The config.h header should be considered a Clutter internal header, and
the test cases (especially the interactive test cases) should strive to
never rely on internal headers.
2011-01-19 14:36:30 +00:00
Neil Roberts
5fc3122dad test-cogl-shader-glsl: Disable the atlas for the hand texture
Atlasing needs to be disabled for the hand texture so that it can work
out the step value needed to fetch a neighbouring pixel in the blur
shader. If the texture ends up in the atlas then the test can't know
the actual size of the texture so it looks wrong.
2011-01-13 11:50:09 +00:00
Damien Lespiau
b922ac6059 test-shader: Fix the edge-detect shader
cogl_text_coord_in in a array to access the texture units. In this case
we want to sample texture unit 0, where the texture is.
2011-01-11 14:21:21 +00:00
Emmanuele Bassi
bf0dd2cbcc test-text-field: Grab key focus on the first entry
So that you can start typing right away.
2010-12-30 12:49:41 +00:00
Emmanuele Bassi
91cc8edba1 test-text-field: Do not expand the labels 2010-12-21 10:51:39 +00:00
Emmanuele Bassi
ec5e910cd3 test-text-field: Clean up
Use a Table layout manager, and clean up a bit this test case.
2010-12-20 17:59:35 +00:00
Emmanuele Bassi
21a12b966d interactive: Remove test-bind
The BindConstraint is already exercised in the test-constraints and in
other interactive tests.
2010-12-20 12:41:07 +00:00
Emmanuele Bassi
c444447cd3 timeline: Rename the reverse property to auto-reverse
Other frameworks expose the same functionality as "auto-reverse",
probably to match the cassette tape player. It actually makes sense
for Clutter to follow suit.
2010-12-17 12:07:52 +00:00
Emmanuele Bassi
397e0ddb16 interactive: Rename test-rotate
The rotation test is now really testing the shader-based effects we ship
with Clutter. The name should be changed to reflect that.
2010-12-16 15:35:38 +00:00
Emmanuele Bassi
c2365c63cf interactive: Remove test-viewport
The test-viewport interactive test is exercising the clip code - a job
better done by the conformance test suite and by the test-clip
interactive test.
2010-12-16 15:25:29 +00:00
Emmanuele Bassi
1515a9f989 interactive: Remove test-project
The test-project test case was an old test that was barely working after
landing the size allocation API in Clutter 0.8. It has never been fixed,
and it's been of relative use ever since.
2010-12-16 15:10:27 +00:00
Emmanuele Bassi
8ae47eb79c interactive: Remove test-offscreen
The test-offscreen interactive test was a dummy test for the
ClutterStage:offscreen property, which has been deprecated and
not implemented since Clutter 1.0, and never really worked except
briefly in Clutter 0.2 or something.
2010-12-16 15:08:11 +00:00
Neil Roberts
d03c3a646a test-cogl-just-vertex-shader: Update to use the portable cogl_* names
The vertex shader in this test now uses the cogl_* names for the GL
builtin so that it will work on GLES2 as well.
2010-12-13 17:29:15 +00:00
Neil Roberts
e0a02b2b5b test-cogl-multitexture: Don't test the alpha component
On EGL we don't request a context with any alpha bits so testing alpha
component of cogl_read_pixels isn't reliable.
2010-12-13 17:29:14 +00:00
Neil Roberts
afe3929618 test-cogl-materials: Use GL_MAX_VERTEX_ATTRIBS on GLES2
When determining the maximum number of layers we also need to take
into account GL_MAX_VERTEX_ATTRIBS on GLES2. Cogl needs one vertex
attrib for each texture unit plus two for the position and color.
2010-12-13 17:29:14 +00:00
Jussi Kukkonen
ca42ec1a7a tests: Add test for clutter_model_get_iter_at_row()
http://bugzilla.clutter-project.org/show_bug.cgi?id=2460
2010-12-09 13:38:35 +00:00
Damien Lespiau
c20beabf93 evdev: Add mouse support
We know support EV_REL events comming from evdev devices. This addition
is pretty straigthforward, it adds a x,y per GSource listening to a
evdev device, updates from EL_REL (relative) events and craft new
ClutterMotionEvents. As for buttons, BTN_LEFT..BTN_TASK are translated
to ClutterButtonEvents with 1..8 as button number.
2010-11-30 14:40:38 +00:00
Robert Bragg
b424bd7512 tests: Adds test-cogl-perf micro benchmark
This is mostly a stub, starting point for a one-stop Cogl
micro-benchmarking tool. The first test it adds is one that tries to
hammer the Cogl journal, but no doubt there are lots of other things we
should be regularly testing. Currently the aim is that the tool will be
able to also generate reports which we can collect to keep track of
performance changes over time.
2010-11-26 14:33:50 +00:00
Neil Roberts
9c32d07453 Add a conformance test that uses a vertex shader with no frag shader
This creates a material which users a layer to override the color of
the rectangle. A simple vertex shader is then created which just
emulates the fixed function pipeline. No fragment shader is
added. This demonstrates a bug where the layer state is getting
ignored when a vertex shader is in use.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2221
2010-11-24 18:06:44 +00:00
Neil Roberts
1fdd82fcf1 test-cogl-texture-get-set-data: Test the alpha component
Previously the alpha component of the test texture data was always set
to 255 and the data was read back as RGB so that the alpha component
is ignored. Now the alpha component is set to a generated value and
the data is read back a second time as RGBA to verify that Cogl is not
doing any premult conversions when the internal texture and target
data is the same.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:35 +00:00
Owen W. Taylor
d52bd995a6 Test slicing when getting data in both directions
http://bugzilla.clutter-project.org/show_bug.cgi?id=2414
2010-11-24 15:56:34 +00:00
Emmanuele Bassi
e86db85cd2 color: Support the CSS hsl() notation
Since we support the rgb() and rgba() notations we might as well also
support the hsl() one.
2010-11-22 15:02:47 +00:00
Emmanuele Bassi
ab6da347f6 color: Support CSS color definitions
The CSS Color Module 3, available at:

  http://www.w3.org/TR/css3-color/

allows defining colors as:

  rgb ( r, g, b )
  rgba ( r, g, b, a)

along with the usual hexadecimal and named notations.

The r, g, and b channels can be:

  • integers between 0 and 255
  • percentages, between 0% and 100%

The alpha channel, if included using the rgba() modifier, can be a
floating point value between 0.0 and 1.0.

The ClutterColor parser should support this notation.
2010-11-22 14:38:44 +00:00