Commit Graph

389 Commits

Author SHA1 Message Date
Emmanuele Bassi
160c62b2f9 conform: Disable the Cogl tests
Cogl is being tested pretty well, these days; also, there is a failure
in the mipmap test that I really don't have time to bisect.
2013-02-20 23:31:17 +00:00
Rob Bradford
6bef2cff19 conformance: Only check for DISPLAY on X11 windowing backend
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=693741
2013-02-20 23:06:28 +00:00
Emmanuele Bassi
65a024af92 timeline: Add progress-based marker API
Being able to set a marker at a normalized point on a timeline, instead
of using a specific time, is a nice fit with the current Timeline class
API.

https://bugzilla.gnome.org/show_bug.cgi?id=694319
2013-02-20 23:06:28 +00:00
Emanuele Aina
219d0efcc6 actor: rollback pivot translation even on explicit transforms
When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);

This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.

https://bugzilla.gnome.org/show_bug.cgi?id=690214
2012-12-14 19:15:48 +01:00
Daniel Stone
13d889814c test: Only run X11-specific code when using X11
The X11-specific windowing checks were hidden behind an #ifdef, however
if the tests were run under Wayland, they would execute uncondionally
and cause assertion failures.  Fix this by also hiding them behind a
check that the current backend is indeed X11.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-10-12 15:12:55 +01:00
Emmanuele Bassi
41ed9023eb build: Fix out of tree builds 2012-07-30 12:33:24 +01:00
Emmanuele Bassi
4546f84408 timeline: Add support for step() progress
The CSS3 Transitions specification from the W3C defines the possibility
of using a parametrized step() timing function, with the following
prototype:

        steps(n_steps, [ start | end ])

where @n_steps represents the number of steps used to divide an interval
between 0 and 1; the 'start' and 'end' tokens describe whether the value
change should happen at the start of the transition, or at the end.

For instance, the "steps(3, start)" timing function has the following
profile:

  1 |           x
    |           |
    |       x---|
    |       '   |
    |   x---'   |
    |   '       |
  0 |---'       |

Whereas the "steps(3, end)" timing function has the following profile:

  1 |       x---|
    |       '   |
    |   x---'   |
    |   '       |
    x---'       |
    |           |
  0 |           |

Since ClutterTimeline uses an enumeration for controlling the progress
mode, we need additional API to define the parameters of the steps()
progress; for this reason, we need a CLUTTER_STEPS enumeration value,
and a method for setting the number of steps and the value transition
policy.

The CSS3 Transitions spec helpfully also defines a step-start and a
step-end shorthands, which expand to step(1, start) and step(1, end)
respectively; we can provide a CLUTTER_STEP_START and CLUTTER_STEP_END
enumeration values for those.
2012-07-19 20:47:00 -04:00
Emmanuele Bassi
1da42dd8a0 actor: Add ActorIter.is_valid()
It can be useful to check whether a ClutterActorIter is currently valid,
i.e. if the iterator has been initialized *and* if the actor to which it
refers to hasn't been updated.

We can also use the is_valid() method in the conformance test suite to
check that initialization has been successful, and that changing the
children list through the ClutterActorIter API leaves the iterator in a
valid state.
2012-06-27 21:28:01 +01:00
Emmanuele Bassi
1ca4937f1e conform: Check that iterators work post-assignment
It should be possible to copy a ClutterActorIter just by copying its
contents (either via assignment or memcpy).
2012-06-27 21:28:01 +01:00
Emmanuele Bassi
98982331cb conform/script: Add the return type for the margin test
The compiler would default to 'int', and warn - and then warn again
because the function would not return a value.
2012-06-20 18:58:31 +01:00
Emmanuele Bassi
47f8be4d4b conform: Put xinput enabling under guards
Calling clutter_x11_* API should be done only under the platform
specific guards we provide with Clutter.

https://bugzilla.gnome.org/show_bug.cgi?id=678423
2012-06-20 08:53:46 +01:00
Emmanuele Bassi
c57cabd4c2 conform/interval: Add transformation unit test
Verify that it's possible to pass a transformable type to
ClutterInterval.
2012-06-18 18:04:54 +01:00
Emmanuele Bassi
aacd28cc21 conform: Initial suite for ClutterInterval
ClutterInterval is undertested, so we should start adding a unit test
for it.
2012-06-18 18:04:54 +01:00
Frédéric Péters
a88f73091b tests: link test-conformance against libm
https://bugzilla.gnome.org/show_bug.cgi?id=677921
2012-06-15 15:30:24 +01:00
Tomeu Vizoso
b4222db71d tests: Make sure we return 0 only on error 2012-06-14 11:17:05 +02:00
Emmanuele Bassi
1ab6fc0b39 conform/events-touch: Silently bail out if init failed
This removes the need to conditionally run the test.
2012-06-07 12:23:49 +01:00
Tomeu Vizoso
b339b845cb tests: Add unit test for touch event handling
For now, it just generates a simple horizontal slide (by writing
to /dev/uinput) and checks that the stage gets the events at the
expected coordinates.

The test won't run if it doesn't have read/write permissions to
/dev/uinput.

It also adds OS_LINUX to config.h.
2012-06-07 12:12:56 +02:00
Bastian Winkler
aeea9ee778 actor: Add a custom scriptable "margin" property
The property uses an array with the following CSS style syntax

 [ top, right, bottom, left ] or
 [ top, left/right, bottom ] or
 [ top/bottom, left/right ] or
 [ top/right/bottom/left ]

https://bugzilla.gnome.org/show_bug.cgi?id=676367
2012-05-21 15:31:34 +02:00
Emmanuele Bassi
dd3c66579b conform/actor-graph: Add missing NULL terminator 2012-05-01 13:30:27 +01:00
Emmanuele Bassi
0fca11ec2f path: Avoid integer overflow in get_distance()
The get_distance() API uses machine integers to compute the distance;
this means that on 32bit we can overflow the integer size. This gets
hidden by the fact that get_distance() returns an unsigned integer as
well.

In reality, ClutterPath is an unmitigated mess, and the only way to
actually fix it is to break API.

https://bugzilla.gnome.org/show_bug.cgi?id=652521
2012-04-27 12:28:49 +01:00
Jasper St. Pierre
85323f09a5 conform: Make sure that raising/lowering children doesn't change state
Namely, visibility and show-on-set-parent.

https://bugzilla.gnome.org/show_bug.cgi?id=674510
2012-04-24 11:25:42 -04:00
Neil Roberts
c9a81f035e Don't use any GL types or defines in Clutter
Some of the Clutter code was using GL types for the primitive types
such as GLint and GLubyte and then passing these to Cogl. This doesn't
make much sense because the Cogl functions directly take native C
types. This patch just replaces them with either a native C type or a
glib type.

Some of the cogl conformance tests are trying to directly call GL for
example to test creating a foreign texture. These tests have been
changed to manually define the GL enum values instead of relying on a
GL header to define them.

This is necessary because Cogl may soon stop including a GL header
from its public headers.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-23 17:24:42 +00:00
Emmanuele Bassi
6a502f7104 conform: Set harsher environment for running tests
Set the MALLOC_CHECK_ and MALLOC_PERTURB_ environment variables to catch
allocation issues.
2012-03-20 16:19:23 +00:00
Emmanuele Bassi
767b14fb2d conform/anchors: Fix a dubious test
Changing the scale gravity should not affect the scale factors as well;
it was just a side-effect of the wrong implementation of the setter.
2012-03-19 14:47:55 +00:00
Emmanuele Bassi
10e2f551f5 actor: Unconditionally emit ::paint
It's a bit late in the game for changing the emission of the paint
signal with actors that use paint nodes - mostly because we have both
implicit paint nodes (background color, content) and explicit paint
nodes (the paint_node virtual).

When we branch for 1.12 we can revert this change.
2012-03-16 12:33:39 +00:00
Emmanuele Bassi
74765404dd conform: Skip actor-offscreen-redirect
Until we figure out a way to make it succeed even without the paint
signal emission.
2012-03-16 12:33:37 +00:00
Emmanuele Bassi
485b720a54 conform/text-cache: Use the stage paint signal
The stage's paint signal is guaranteed to be emitted; ClutterText's
paint signal is not.
2012-03-16 12:33:37 +00:00
Emmanuele Bassi
de90be9586 build: Remove maintainer flags from test build
Part of the test infrastructure relies on relaxed build conditions, so
there's no point to enforce the anal retentive maintainer flags.
2012-03-07 12:36:43 +00:00
Neil Roberts
762e0de2c6 tests: Remove test-cogl-pixel-buffer
This has been converted to a Cogl-based test in the cogl source tree
so there is no need to maintain it here anymore.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-05 19:45:10 +00:00
Emmanuele Bassi
7d64693de2 conformance/invariants: Test that visibility is not recursive
The show and hide methods should not recurse; that is the job of
show_all and hide_all, which are deprecated.
2012-03-05 17:45:23 +00:00
Emmanuele Bassi
add274c447 conform/actor-invariants: Add tests for show-on-set-parent
The show-on-set-parent flag is mental, but it needs to be tested better
than just checking for it always been set to TRUE.
2012-03-05 17:27:37 +00:00
Emmanuele Bassi
4e6ff76a77 conformance: Clean up
Remove the last inconsistent bits.
2012-02-27 13:08:31 +00:00
Emmanuele Bassi
60e2f8ed5b conformance: Rename the source files
It's the conformance test suite: there's no need to namespace the files,
just like there's no need to namespace the units.

This commit does not change the Cogl tests: they will be moved to Cogl
over time, and it's easier to do if we leave them as they are.
2012-02-27 13:02:01 +00:00
Emmanuele Bassi
d16f2ac3b5 conform: Clean up test names
Drop the 'test-' prefix: it's the conformance test suite, we know it's
full of tests.
2012-02-27 12:54:23 +00:00
Robert Bragg
a8e631543e Reduce our internal dependence on the Cogl 1.x api
Since Cogl has started restricting what cogl 1.x api is exposed when
COGL_ENABLE_EXPERIMENTAL_2_0_API is defined and since we build all
Clutter internals with COGL_ENABLE_EXPERIMENTAL_2_0_API defined this
patch makes a first pass at reducing our internal use of the Cogl 1.x
api.

The most notable api that's no longer exposed to us internally is
the cogl_material_ api so this switches all Clutter internals to use the
cogl_pipeline_ api instead. This patch also makes quite a bit of
progress removing internal uses of CoglHandle although there is still
more to go.
2012-02-21 17:46:11 +00:00
Robert Bragg
eff95eba4a Pass context to cogl_texture_pixmap_x11_new() api
The experimental cogl_texture_pixmap_x11_new() api was recently changed
to take an explicit context argument and return a GError on failures.
This updates Clutter's use of the api accordingly.
2012-02-21 17:46:11 +00:00
Emmanuele Bassi
c62b69bb14 conform/invariants: Clean up
Use modern API, and add a minimal check that hiding an actor will cause
it to unmap.
2012-02-15 13:45:08 +00:00
Neil Roberts
0f04a1cd11 tests: Remove conformance tests that have been ported to Cogl
A lot of the conformance tests that were just testing Cogl
functionality have been ported to be standalone Cogl tests in the Cogl
source tree. This patch removes those from Clutter so we don't have to
maintain them in two places.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-02-14 12:09:18 +00:00
Emmanuele Bassi
8ba0351c7a conform/actor: Add unit for the Container signals
ClutterActor should be emitting signals defined on the ClutterContainer
interface, as well as ensuring that manipulating the scene graph is
still possible from within them.

The new unit checks that we're emitting signals, by implementing
something similar to the Bin class available in toolkits like gtk, st,
and mx — i.e. a container that can only hold one child at any given
point.
2012-02-09 16:48:08 +00:00
Robert Bragg
bace07c0a0 Updates use of Cogl in line with api changes
Some of Cogl's experimental apis have changed so that the buffer apis
now need to be passed a context argument and some drawing apis have been
replaced with cogl_framebuffer_ drawing apis that take explicit
framebuffer and pipeline arguments.

These changes were made as part of Cogl moving towards a more stateless
api that doesn't rely on a global context.

This patch updates Clutter to work with the latest Cogl api and bumps
the required Cogl version to 1.9.5.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 16:34:25 +00:00
Emmanuele Bassi
0c715d0026 conform/actor-graph: Add more cases
The actor-insert unit is not exercising the whole API and its allowed
arguments; this let sneak in the buglet found in bug 669730.
2012-02-09 14:22:31 +00:00
Emmanuele Bassi
58ffcfb10e actor: Add ClutterActorIter
Iterating over children and ancestors of an actor is a relatively common
operation. Currently, you only have one option: start a for() loop, get
the first child of the actor, and advance to the next sibling for the
list of children; or start a for() loop and advance to the parent of the
actor.

These operations can be easily done through the ClutterActor API, but
they all require going through the public API, and performing multiple
type checks on the arguments.

Along with the DOM API, it would be nice to have an ancillary, utility
API that uses an iterator structure to hold the state, and can be
advanced in a loop.

https://bugzilla.gnome.org/show_bug.cgi?id=668669
2012-01-27 11:55:39 +00:00
Emmanuele Bassi
9d355f12c6 conform: Avoid a deadlock
Something is causing a deadlock when using clutter_threads_* API inside
the offscreen redirect conformance test. The conformance tests are
pretty insane anyway, so for the time being, let's put g_timeout_add()
back in while we figure out the issue.
2012-01-27 11:42:33 +00:00
Emmanuele Bassi
9206bd7627 tests/*: Use symbolic constants for sources and events
And make sure to use clutter_threads_add_* instead of the bare
g_*_add().
2012-01-25 23:20:25 +00:00
Emmanuele Bassi
8492b17ae2 conform/actor-size: Do not use Rectangle
Use ClutterActor directly, instead.
2012-01-17 16:21:55 +00:00
Emmanuele Bassi
9a66392d49 actor: Add new methods for changing the paint sequence
ClutterActor provides four methods for changing the paint sequence order
of its children:

  raise_top()
  raise()
  lower()
  lower_bottom()

The first and last one being just wrappers around raise() and lower(),
respectively. These methods have various issues: they omit the parent,
preferring to retrieve it from the actor passed as the first argument;
this does not match the new style of API introduced to operate on the
list of children of an actor.

Additionally, the raise() and lower() methods of ClutterActor call into
the Container interface, and are not really aptly named (raise() in
particular collides with the completely unrelated 'raise' keyword in
Python, and usually needs to be wrapped in order to be used at all).

Furthermore, we need public methods that Container can call from its
default implementation, as well as methods to port current Container
implementations.

Finally, since we have insert_child_at_index(), we should also have an
equivalent set_child_at_index() as well.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
f61916fc5e actor: Add remove_all_children()
A simple method for removing all children of an actor in one fell swoop.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
4f470b9231 actor: Provide a proper implementation of replace_child()
The correct sequence of actions should be remove(old) → insert(new), not
insert(new) → remove(old). We can implement a simple delegate insertion
functions to insert the new child between the previous and next siblings
of the old child.

While we're at it, let's also add a unit test for replace_child().
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
f2015baeb7 conform/actor-graph: Add lower/raise units
Check that the lower_bottom(), lower(), raise(), and raise_top()
methods work as intended.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
419a6a38f2 conform: Add a suite for the Actor scene graph API
Verify that insertion and removal maintain a stable graph, with pointers
to the various children. This should help out tracking regressions in
the scene graph API.
2012-01-16 23:37:10 +00:00