1
0
Fork 0
Commit graph

1110 commits

Author SHA1 Message Date
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
Emmanuele Bassi
b0f5350379 test-layout: Port away from Behaviour
Use a simple animation with a looping+reversing timeline.
2010-11-18 15:21:16 +00:00
Emmanuele Bassi
eade1ab19e test-rotate: Remove the behaviour code
Use a looping animation with a shared timeline instead.
2010-11-18 15:21:16 +00:00
Emmanuele Bassi
a35708eb74 Deprecate ClutterBehaviour and sub-classes
The Behaviour class and its implementations have been replaced by the
new animation framework API and by the constraints for layout-related
animations.

Currently, we need to make tests build, so we undef DISABLE_DEPRECATED
in specific test cases while they get ported.
2010-11-18 15:21:16 +00:00
Emmanuele Bassi
71a838815f timeline: Add :reverse property
The :reverse property removes the pattern of connecting to the
::completed signal of a Timeline to change the direction.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2408
2010-11-18 15:18:19 +00:00
Emmanuele Bassi
3c15c0c9bb Add SnapConstraint
A SnapConstraint is a constraint that "snaps" the edges of two actors
together.
2010-11-15 16:00:49 +00:00
Emmanuele Bassi
dfdd591414 Merge branch 'wip/static-colors'
* wip/static-colors:
  Move tests to static colors where possible
  color: Add named, global colors
2010-11-11 17:53:42 +00:00
Robert Bragg
fb9d3a8350 path 2.0: update path API for experimental 2.0 API
When COGL_ENABLE_EXPERIMENTAL_2_0_API is defined cogl.h will now include
cogl2-path.h which changes cogl_path_new() so it can directly return a
CoglPath pointer; it no longer exposes a prototype for
cogl_{get,set}_path and all the remaining cogl_path_ functions now take
an explicit path as their first argument.

The idea is that we want to encourage developers to retain path objects
for as long as possible so they can take advantage of us uploading the
path geometry to the GPU. Currently although it is possible to start a
new path and query the current path, it is not convenient.

The other thing is that we want to get Cogl to the point where nothing
depends on a global, current context variable. This will allow us to one
day define a sensible threading model if/when that is ever desired.
2010-11-11 13:17:26 +00:00
Emmanuele Bassi
6ed6b2a54b Move tests to static colors where possible 2010-11-11 13:14:39 +00:00
Robert Bragg
5f30835eae cogl-shader: Prepend boilerplate for portable shaders
We now prepend a set of defines to any given GLSL shader so that we can
define builtin uniforms/attributes within the "cogl" namespace that we
can use to provide compatibility across a range of the earlier versions
of GLSL.

This updates test-cogl-shader-glsl.c and test-shader.c so they no longer
needs to special case GLES vs GL when splicing together its shaders as
well as the blur, colorize and desaturate effects.

To get a feel for the new, portable uniform/attribute names here are the
defines for OpenGL vertex shaders:

 #define cogl_position_in gl_Vertex
 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in  gl_MultiTexCoord0
 #define cogl_tex_coord0_in gl_MultiTexCoord0
 #define cogl_tex_coord1_in gl_MultiTexCoord1
 #define cogl_tex_coord2_in gl_MultiTexCoord2
 #define cogl_tex_coord3_in gl_MultiTexCoord3
 #define cogl_tex_coord4_in gl_MultiTexCoord4
 #define cogl_tex_coord5_in gl_MultiTexCoord5
 #define cogl_tex_coord6_in gl_MultiTexCoord6
 #define cogl_tex_coord7_in gl_MultiTexCoord7
 #define cogl_normal_in gl_Normal

 #define cogl_position_out gl_Position
 #define cogl_point_size_out gl_PointSize
 #define cogl_color_out gl_FrontColor
 #define cogl_tex_coord_out gl_TexCoord

 #define cogl_modelview_matrix gl_ModelViewMatrix
 #define cogl_modelview_projection_matrix gl_ModelViewProjectionMatrix
 #define cogl_projection_matrix gl_ProjectionMatrix
 #define cogl_texture_matrix gl_TextureMatrix

And for fragment shaders we have:

 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in gl_TexCoord

 #define cogl_color_out gl_FragColor
 #define cogl_depth_out gl_FragDepth

 #define cogl_front_facing gl_FrontFacing
2010-11-10 14:24:52 +00:00
Robert Bragg
a4b984186c tests: test-cogl-shader-arbfp wasn't compiling shader
test-cogl-shader-arbfp was never calling cogl_shader_compile so it was a
fluke that it used to run before.
2010-11-10 14:19:34 +00:00
Tomeu Vizoso
373140c830 Discard the current pick buffer...
if we are asked to pick with a different mode.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2385
2010-11-08 16:45:15 +00:00
Emmanuele Bassi
26a70707ab path-constraint: Add a ::node-reached signal
Emit a signal whenever a node in the path has been reached.
2010-11-07 21:35:40 +00:00
Neil Roberts
57633520d4 Make test-cogl-npot-texture a bit more extensive
The size of the texture used for test-cogl-npot-texture was only using
1 pixel of waste and the texture was scaled down so it would be quite
likely that the test would still pass if only the top left slice was
rendered. It also didn't test using non-default texture
coordinates. These problems made it fail to pick up bug 2398. The
texture is now using the maximum amount of waste and rendered in four
parts at 1:1 scale.
2010-11-05 18:45:31 +00:00
Neil Roberts
8112bfc49f Replace the disable-npots tool with a COGL_DEBUG option
Previously in the tests/tools directory we build a disable-npots
library which was used as an LD_PRELOAD to trick Cogl in to thinking
there is no NPOT texture extension. This is a little awkward to use so
it seems much simpler to just define a COGL_DEBUG option to disable
npot textures.
2010-11-05 18:45:31 +00:00
Neil Roberts
a53c9dafb5 Add a conformance test for the CoglPrimitive convenience constructors
This adds a simple conformance test which calls all of the convenience
constructors for CoglPrimitive.
2010-11-04 17:59:33 +00:00
Emmanuele Bassi
ef6b46d826 Merge branch 'wip/path-constraint'
* wip/path-constraint:
  docs: Add PathConstraint
  tests: Add a PathConstraint interactive test
  Add ClutterPathConstraint
  actor-box: Add setters for origin and size
2010-10-25 17:09:46 +01:00
Emmanuele Bassi
6f8e46e0b3 tests: Add a PathConstraint interactive test 2010-10-25 15:47:15 +01:00
Neil Roberts
f1752ff3ba Avoid mixing declarations and code
Mixing declarations and code causes problems for MSVC as it is a C99
feature so we should try to avoid it.
2010-10-25 13:18:25 +01:00
Emmanuele Bassi
ce3311df26 conform: Remove unnecessary destroy() calls
Unparented actors are owned by the Script instance, and if that goes
away then the actors go away with it. The fact that we needed an
explicit destroy() before was a hint of a memory management issue that I
blissfully - and regretfully - ignored for the sake of a passing test
suite.
2010-10-19 12:32:02 +01:00
Emmanuele Bassi
b5bbdd6cec build: Add test wrappers to the main ignore file
They are generated at configure time, so it's a good idea to have them
in the main ignore file instead of adding them to the built ignore files
under tests.
2010-10-19 11:03:13 +01:00
Emmanuele Bassi
0f613ea134 cairo-texture: Allow overriding the surface creation
By using a new signal, ::create-surface (width, height), it should be
possible for third party code and sub-classes to override the default
surface creation code in CairoSurface.

This commit takes a bit of the patch from:

  http://bugzilla.clutter-project.org/show_bug.cgi?id=1878

which cleans up CairoTexture; the idea, mutuated from that bug, is that
the CairoTexture actor checks whether the surface it has it's an image
one, and in that case it uses a Cogl texture as the backing store. In
case the surface is not an image one we assume that the surface itself
has some way of updating the GL state and flush the surface.
2010-10-18 11:26:45 +01:00
Emmanuele Bassi
d032b9b2bf conform: Start cleaning up the conformance test suite
Re-order the units into a sensible list, with basic tests at the
beginning, and per-class tests at the end - with Cogl last.

Also, start renaming the unit functions from test_<foo> to <foo>,
so that the executable wrappers and the reports have sensible names.
2010-10-12 17:42:18 +01:00
Emmanuele Bassi
b5d5b9628e conform: Implement TEST_CONFORM_TODO() correctly
The TODO() macro for adding new tests to the test suite has always meant
to be implemented like the TODO block in Test::More, i.e. a test that is
assumed to fail, and which warns if it unexpectedly succeeds.

Since GTest lacks the expressivity of Test::More, the implementation
just verifies that the tests marked as TODO actually fail, and will fail
if they happen to succeed - at which point the developer will have to
change the macro to SIMPLE or SKIP.
2010-10-12 17:11:52 +01:00
Emmanuele Bassi
2a23bab819 conform: Save the revision and date inside the test report
Even if gtester-report doesn't use that information (yet), we should
store the revision of Clutter that generated the report, and the date in
which the test suite was ran.
2010-10-12 15:44:57 +01:00
Neil Roberts
7fd6273c25 tests: Generate the stub scripts using sed
Instead of trying to run ./test-conformance with the -l option to
generate a list of available tests it now runs sed on the
test-conform-main.c file instead. Running the generated executable is
a pain for cross-compiling so it would be nice to avoid it unless it's
absolutely necessary. Although you could tell people who are cross
compiling to just disable the conformance tests, this seems a shame
because they could still be useful along with the wrappers for example
if the cross compile is built to a shared network folder where the
tests can be run on the actual device.

The sed script is a little more ugly than it could be because it tries
to avoid using the GNU extensions '\+' and '\|'.

The script ends up placing restrictions on the format of the C file
because the tests must all be listed on one line each. There is now a
comment to explain this. Hopefully the trade off is worth it.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2363
2010-10-12 15:24:32 +01:00
Neil Roberts
100d541f47 tests: Re-enable the test-anchors conformance test
This test was disabled in b5d58213. The commit message doesn't mention
this so I'm guessing it was a mistake. In any case the test appears to
work now anyway so it should be re-enabled.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2363
2010-10-12 15:24:32 +01:00
Emmanuele Bassi
2831addcf5 test-flow-layout: Track stage size by default
Instead of requiring a special command line switch.
2010-10-12 14:53:20 +01:00
Robert Bragg
471659ed4b test-pixmap: add timeout to draw arcs on pixmap
As a convenient test that clipped redraws are working correctly in
response to X pixmap damage this updates test-pixmap to have a repeating
1 second timeout that draws arcs on the pixmap.
2010-09-30 11:44:12 +01:00
Neil Roberts
d0cab85673 Add a conformance test for clutter_actor_contains
This adds a conformance test for clutter_actor_contains to assert that
it gets the expected results for the given tree of actors.
2010-09-28 15:21:49 +01:00
Emmanuele Bassi
8fe9f3a37d test-clutter-units: Force a known resolution to avoid fuzzyness
Instead of taking the current resolution, whatever it may be, use a
known DPI. This should alleviate fuzzyness and create consistent
results.
2010-09-24 16:21:06 +01:00
Emmanuele Bassi
4c8867ea07 table-layout: Invert row/column in arguments
*** This is an API change ***

The general pattern for axis-aligned arguments is:

        x argument
        y argument

If we consider columns an x-aligned argument, and row a y-aligned
argument, then we need to update the TableLayout functions to be:

        column
        row

and not:

        row
        column
2010-09-23 15:17:58 +01:00
Neil Roberts
bcd4385a0e test-conform: Delay initializing Clutter until a test is run
Instead of calling clutter_init immediately, test-conformance now only
calls it as part of test_conform_simple_fixture_setup. The conformance
tests assert that only one test is run per instance of
test-conformance so it should never end up calling clutter_init
twice. Delaying clutter_init has the advantage that calling
"test-conformance -l" will still work even on systems with no X
server. This could be useful for automated build systems.
2010-09-21 14:10:19 +01:00
Emmanuele Bassi
bdcac5617b test-bind: Fix colors and set the name of the boxes 2010-09-17 12:17:50 +01:00
Emmanuele Bassi
8ca47e3b20 build: Use the power of abs_builddir
When calling test-conformance to get the list of conformance tests.
2010-09-17 12:17:50 +01:00
Emmanuele Bassi
40af71fad7 build: List the units inside a file
This avoids trying to run test-conformance -l multiple times.
2010-09-13 02:10:35 +01:00
Emmanuele Bassi
4ee05f8e21 keysyms: Update the macros to CLUTTER_KEY_*
The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.

This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:

  - clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
  - clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*

The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.

This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
2010-09-10 17:54:52 +01:00
Emmanuele Bassi
32ea9702e6 build: Add XML files to the ignore blacklist 2010-09-08 17:50:38 +01:00
Henrik Hedberg
1eae9fcd7e drag-action: Added x-drag-threshold and y-drag-threshold properties
*** This is an API change ***

Replaced the original drag-threshold property with two separate
horizontal (x-drag-threshold) and vertical (y-drag-threshold)
thresholds.

It is some times necessary to have different drag thresholds for the
horizontal and vertical axes. For example, when a draggable actor is
inside a horizontal scrolling area, only vertical movement must begin
dragging. That can be achieved by setting the x-drag-threshold to
G_MAXUINT while y-drag-threshold is something usual, say, 20 pixels.

This is different than drag axis, because after the threshold
has been cleared by the pointer, the draggable actor can be dragged
along both axes (if allowed by the drag-axis property).

http://bugzilla.clutter-project.org/show_bug.cgi?id=2291

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-09-07 10:40:49 +01:00
Emmanuele Bassi
7e56a98413 texture: Use a base material for all instances
Creating new materials for every Texture instance results in a lot of
ARBfp programs being generated/compiled. Since most textures will just
be similar we should create a template material for all of them, and
then copy it in every instance. Cogl will try to optimize the generation
of the program and, hopefully, will reuse the same program most of the
time.

With this change, a simple test shows that loading 48 textures will
result in just two programs being compiled - with and without batching
enabled.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2295
2010-09-06 18:09:19 +01:00
Emmanuele Bassi
abef73bb58 Replace cogl_color_set_from_* with cogl_color_init_from_*
The former is not yet "officially" deprecated by the latter, but it's
confusing to have them both in the code base.
2010-09-03 16:58:47 +01:00
Emmanuele Bassi
88b026fa72 test-actors: Name all the actors
Makes it easier to debug events.
2010-08-26 17:31:32 +01:00
Bastian Winkler
870e7ddfad test-script-parser: Add a second child to the container
The script parser won't apply child and layout properties correctly with
more than one children.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2285

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-08-25 16:18:25 +01:00
Emmanuele Bassi
fd6d6a93f1 build: Fix distcheck errors 2010-08-16 13:23:10 +01:00
Emmanuele Bassi
3142b15a9f build: Use maintainer-clean for the ignore files removal
Instead of distclean.
2010-08-15 18:42:54 +01:00
Emmanuele Bassi
c4913bfce9 Revert "build: Distclean generated ignore files"
Git ignore files are not dist'ed, so it's pointless to remove them on
distclean.

This reverts commit f14587aadc.
2010-08-15 18:33:10 +01:00
Emmanuele Bassi
94c8635d0f build: Autogenerate more ignore files
The tests/accessibility, tests/micro-bench and the examples directory
in the coobook create a lot of non-installed binaries. Since we know who
they are, and we ignore them, we can auto-generate the ignore files as
well.

The rest of Clutter is covered by the main ignore file.
2010-08-14 08:43:16 +01:00
Emmanuele Bassi
f14587aadc build: Distclean generated ignore files 2010-08-13 18:35:35 +01:00
Emmanuele Bassi
a3bc2ebfa7 build: Make test-conform depend on Makefile changes 2010-08-13 18:32:10 +01:00
Emmanuele Bassi
1e0a83b881 build: Autogenerate interactive/.gitignore
Exactly like we did for conform/.gitignore
2010-08-13 18:31:44 +01:00
Emmanuele Bassi
7c412464c2 build: Generate the conformance/.gitignore file
Since we are generating a lot of files that we should ignore, we should
generate the Git ignore file as well.
2010-08-13 18:25:22 +01:00
Emmanuele Bassi
e888da2180 build: Split up the test-conformance SOURCES
Having different sections should make it easier to add new test units to
the build.
2010-08-13 18:15:01 +01:00
Emmanuele Bassi
a25cf14e97 Revert "clutter.modules: Remove deps on gir-repository"
This reverts commit 0ce9cf730b.

The commit contained unrelated changes
2010-08-13 18:12:43 +01:00
Emmanuele Bassi
0ce9cf730b clutter.modules: Remove deps on gir-repository
Keep it in the moduleset, but don't let Clutter depend on it.
2010-08-13 18:09:28 +01:00
Emmanuele Bassi
50c5ecfe87 state: Plug some memory leakage
Thanks to Valgrind, test-state-base now reports 0 bytes definitely lost.
2010-08-13 12:12:59 +01:00
Robert Bragg
a26119b551 tests: Remove use of cogl_program_use
The removes the use of cogl_program_use which has been deprecated and
instead of using the cogl_program_uniform functions we now use the
cogl_program_set_uniform methods.
2010-08-12 16:50:46 +01:00
Neil Roberts
c129c563f5 Remove test-random-text from the interactive .gitignore 2010-08-12 14:37:38 +01:00
Emmanuele Bassi
1a8df6788b Update the micro-bench Git ignore file 2010-08-12 13:48:35 +01:00
Neil Roberts
1e45428483 test-random-text: Convert to a micro-benchmark
test-random-text is moved to the micro-bench directory. It now prints
out the time taken to draw every 10 frames.
2010-08-12 11:54:42 +01:00
Neil Roberts
65f449bdb0 test-text-perf: Add a wider range of characters
Instead of just using the latin alphabet, this adds digits and some
other alphabets to increase the range of glyphs used.
2010-08-12 11:54:41 +01:00
Neil Roberts
c26d2c5ef9 test-text-perf: Scale the text if the settings will not fit
If the font size or the number of characters causes the label not to
fit on the stage, instead of aborting it will now scale the labels so
that it fits within one of the dimensions. This makes it easier to
test with large glyph sizes.
2010-08-12 11:54:41 +01:00
Emmanuele Bassi
304e7dd077 test-drag: Fix the page curl angle 2010-08-11 14:21:22 +01:00
José Dapena Paz
d14e294d86 Add ClutterTableLayout, a layout showing children in rows and columns
A TableLayout is a layout manager that allocates its children in rows
and columns. Each child is assigned to a cell (or more if a cell span
is set).

The supported child properties are:

  • x-expand and y-expand: if this cell with try to allocate the
    available extra space for the table.
  • x-fill and y-fill: if the child will get all the space available in
    the cell.
  • x-align and y-align: if the child does not fill the cell, then
    where the child will be aligned inside the cell.
  • row-span and col-span: number of cells the child will allocate for
    itself.

Also, the TableLayout has row-spacing and col-spacing for specifying
the space in pixels between rows and between columns.

We also include a simple test of the layout manager, and the
documentation updates.

The TableLayout was implemented starting from MxTable and
ClutterBoxLayout.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2038

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-08-10 23:20:06 +01:00
Emmanuele Bassi
02b7bf3635 test-flow-layout: Use BindConstraints
If we want to fit the FlowLayout to the Stage size we should use the
BindConstraint API instead of a watcher on ::allocation-changed.
2010-08-10 18:47:45 +01:00
Damien Lespiau
985a4db947 gitignore: Ignore test-cogl-shader-{arbfp,glsl}
Fear the out of tree builds!
2010-08-09 17:27:09 +01:00
Robert Bragg
a4339842f9 tests-interactive: Adds a test-cogl-shader-glsl.c
This is based on test-shader.c but is solely implemented with the
cogl_program/shader APIs instead of the clutter shader APIs.
2010-08-09 17:27:02 +01:00
Robert Bragg
f6a1f56031 tests/interactive: Adds a test-cogl-shader-arbfp.c
This tests the ARBfp support for cogl_program and cogl_shader using the
shaders Chris Lord adapted from test-shader when he was experimenting
with adding ARBfp support to clutter back in 2008 (See:
http://bugzilla.clutter-project.org/show_bug.cgi?id=1049)
2010-08-09 17:27:02 +01:00
Emmanuele Bassi
e7381c47fd bin-layout: Add a text to the test
We have a rectangle, a cairo texture and a texture. Let's go add a text
actor as well.
2010-08-05 17:22:50 +01:00
Roman Kudiyarov
5218da748f test: fixed uninitialized variable in test-cogl-point-sprites 2010-08-04 15:13:11 +01:00
Roman Kudiyarov
904f619419 osx: Implemented hide cursor backend implementation
Add implementation for hide cursor in stage. Also added using this
feature in test-animator.
2010-08-04 15:13:11 +01:00
Emmanuele Bassi
00eb71b89a conform: Move the Score test to the conformance suite
The interactive test for ClutterScore is really meant to be run as part
of the conformance test suite, so we should move it there.
2010-07-30 19:39:35 +01:00
Neil Roberts
616eccdad6 test-shader: Unref the ClutterShader after setting it on an actor
Otherwise the test leaks the shader object and the underlying GLSL
program.
2010-07-22 21:51:47 +01:00
Neil Roberts
a1c7420979 test-shader: The tex_coord varying is now an array under GLES2
Since the GLES2 wrapper grew support for multi-texturing, the
tex_coord varying variable defined in the vertex shader is actually an
array of texture coordinates so it ought to match in the fragment
shader in test-shader. This seemed to work anyway under Mesa/Intel but
under NVidia it does not so I don't think it's safe to assume that
linking a non-array varying with an array will work.
2010-07-22 21:48:16 +01:00
Neil Roberts
cefc0e381b Add a conformance test for 3D textures
This creates a 3D texture with different colors on all of the images
and renders it using a VBO to verify that the texture coordinates can
select all of the images.
2010-07-13 14:29:02 +01:00
Emmanuele Bassi
fdc79427a6 Add new tests to the ignore files 2010-07-09 11:40:00 +01:00
Neil Roberts
972c0c24f0 Add a conformance test for cogl_texture_{get_data,set_region}
This verifies that calling cogl_texture_get_data returns the same data
uploaded to the texture. The bottom quarter of the texture is replaced
using cogl_texture_set_region. It tries creating the texture with
different sizes and flags in the hope that it will hit different
texture backends.
2010-07-09 11:14:10 +01:00
Robert Bragg
4ca1e491da tests: don't delay/skip frames due to glReadPixel concerns
This greatly speeds up running all the conformance tests by no longer
delaying many of the tests for a number of dummy frames to be painted.

We used to skip frames because we thought there was a problem with the
driver's glReadPixels implementation. Although we have seen driver
issues at times the real reason the delay was needed was because
resizing the stage usually happens asynchronously (because a non
synchronous X request is used by clutter_stage_set_size()). We now force
all X requests to be synchronized for the conformance tests so this is
no longer a problem and we can avoid these hacks.
2010-07-08 22:40:35 +01:00
Neil Roberts
ad6d597445 Add an interactive test for cogl point sprites
The test draws some fireworks with trailing sparks that fade out.

http://bugzilla.openedhand.com/show_bug.cgi?id=2047
2010-07-08 16:34:31 +01:00
Neil Roberts
c76d53a9c4 tests/accessibility: Fix the soname for libclutter
The required .so file was named using @CLUTTER_WINSYS@ but since
bf9d5f3949 the .so should be named with @CLUTTER_SONAME_INFIX@. This
was breaking the build on eglx.
2010-07-08 15:32:48 +01:00
Øyvind Kolås
9e730727ca state: add clutter_state_set_state and clutter_state_warp_to_state
Replaced clutter_state_change with a boolean argument for animating the
transition or not with two separate argument-less methods.
2010-07-07 18:17:09 +01:00
Emmanuele Bassi
f87e4037a8 build: Distcheck fixes after the Cally merge 2010-07-07 16:30:31 +01:00
Emmanuele Bassi
e3a8ece54d Merge branch 'cally-merge'
* cally-merge:
  cally: Add introspection generation
  cally: Improving cally doc
  cally: Cleaning CallyText
  cally: Refactoring "window:create" and "window:destroy" emission code
  cally: Use proper backend information on CallyActor
  cally: Check HAVE_CONFIG_H on cally-util.c
  docs: Fix Cally documentation
  cally: Clean up the headers
  Add binaries of the Cally examples to the ignore file
  docs: Add Cally API reference
  Avoid to load cally module on a11y examples
  Add accessibility tests
  Initialize accessibility support on clutter_init
  Rename some methods and includes to avoid -Wshadow warnings
  Cally initialization code
  Add Cally
2010-07-07 16:06:30 +01:00
Robert Bragg
175317a754 test-timeline: instantiate a stage so the master clock runs
This makes test-timeline get the default stage so there is at least one
stage instantiated. Without any stages the master clock will never run
which was causing this test to fail.
2010-07-07 16:00:46 +01:00
Emmanuele Bassi
7d1445afca Restore the report on the conformance test suite
The report generation was broken by the split of the various test units;
also, we were using GTest in a way that's not really sanctioned by
upstream.

This commit tries to re-use the targets from GLib's Makefile rules while
compensating for our own set up.
2010-07-07 14:52:19 +01:00
Robert Bragg
551945ce6c tests: Force X synchronization so the stage size is reliable
Normally the asynchronous nature of X means that setting the clutter
stage size may really happen an indefinite amount of time later but
since the tests are so short lived and may only render a single frame
this is not an acceptable semantic.

This way we should be able to remove all the hacky sleeps and frame
count delays from our tests.
2010-07-07 14:07:22 +01:00
Robert Bragg
b24c96189d tests: no longer clean up state between tests
Since we now run every test in a separate process there is no need to
try and avoid state leakage between tests. This removes the code to
cleanup all children of the stage and disconnect handlers from the
stage paint signal. We now explicitly print a warning if the users tries
to run multiple tests in one process.
2010-07-07 14:07:17 +01:00
Øyvind Kolås
5cb4e0c5d0 test-state: fix test for state count after state removal
In the .json file used for the test, there is no null -> "base"
transition defined only a "clicked" -> "base", when the "clicked" state
is removed the "base" state will also disappear.
2010-07-06 14:28:14 +01:00
Øyvind Kolås
6d1f697bc4 state: automatically remove unused states
When there is no further keys with a state as the target state, remove
the state (and all transitions that used this state as a target)
2010-07-06 14:14:34 +01:00
Damien Lespiau
1860d45087 build: Allow to run the tests from any directory
I was fed up to cd into the tests/conform or tests/interactive directories
to launch a specific test. Now, with the power the abs_ variants of
builddir and srcdir we can run specific test from any directory.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2159
2010-07-06 12:39:15 +01:00
Robert Bragg
82ba7220af pixel-array: Allow passing of hints to cogl_buffer_map
This allows you to tell Cogl that you are planning to replace all the
buffer's data once it is mapped with cogl_buffer_map. This means if the
buffer is currently being accessed by the GPU then the driver doesn't
have to stall and wait for it to finish before it can access it from the
CPU and can instead potentially allocate a new buffer with undefined
data and map that.
2010-07-06 12:07:28 +01:00
Robert Bragg
0273b13d75 test-cogl-pixel-array: fix how data is initialized
There was a missing '* 4' and '* i' in the for() loops that initialized
the first test buffer, so it was containing uninitialized data causing
the test to fail.
2010-07-06 12:07:28 +01:00
Emmanuele Bassi
da4dbbb926 Add binaries of the Cally examples to the ignore file 2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
e110b35694 Avoid to load cally module on a11y examples
As cally is being integrated on clutter is not required to load
cally module anymore. Anyway, it is still required to load
the atk bridge by hand. The current way to load it could change
in the future, more information here:

https://bugzilla.gnome.org/show_bug.cgi?id=612599
https://bugzilla.gnome.org/show_bug.cgi?id=619946

Part [4/4] of CB#2099
2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
790d2165f3 Add accessibility tests
http://bugzilla.clutter-project.org/show_bug.cgi?id=2099

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-05 16:45:43 +01:00
Emmanuele Bassi
b9c65510cb Update conformance Git ignore file 2010-07-05 16:45:19 +01:00
Robert Bragg
ae43fe9968 conform: don't reference old test_cogl_pixel_buffer symbol
Since CoglPixelBuffer was renamed to CoglPixelArray the test entry point
was also renamed to test_cogl_pixel_array, but mistakenly the
corresponding test-conform-main.c change wasn't pushed at the same time.
2010-07-05 16:19:35 +01:00
Robert Bragg
8a5aed36fe pixel-array: Only allow allocation of arrays with a 2D size
This removes cogl_pixel_array_new which just took a size in bytes.

Without the image size and pixel format then the driver often doesn't
have enough information to allocate optimal GPU memory that can be
textured from directly. This is because GPUs often have ways to
spatially alter the layout of a texture to improve cache access patterns
which may require special alignment and padding dependant in the images
width, height and bpp.

Although currently we are limited by OpenGL because it doesn't let us
pass on the width and height when allocating a PBO, the hope is that we
can define a better extension at some point.
2010-07-05 15:20:04 +01:00
Robert Bragg
54f4a3a752 rename CoglPixelBuffer to CoglPixelArray
This renames CoglPixelBuffer to CoglPixelArray to be consistent with the
new CoglVertexArray API.
2010-07-05 15:20:04 +01:00
Robert Bragg
57341dbb60 cogl-buffer: make the COGL_BUFFER_USAGE_HINT private
The usage hint should be implied by the CoglBuffer subclass type so the
public getter and setter APIs for manually changing the usage hint of a
CoglBuffer have now been removed.
2010-07-05 15:20:04 +01:00
Øyvind Kolås
38941372bf state: rename property "target-state" to "state"
This reduces the amount of typing, and should provide for more readable
code for most uses of ClutterState.
2010-07-02 17:41:33 +01:00
Neil Roberts
6341ba98f9 test-cogl-path: Add tests for changing the fill rule
This creates a path with an outer clockwise and two internal sub
paths, one clockwise and one counter-clockwise. The path is then
painted twice, once with each fill rule.
2010-06-29 20:37:14 +01:00
Emmanuele Bassi
32ad63efef bind-constraint: Add width and height binding
Allow using the BindConstraint to bind width and height of a source
actor.

Also, add a test for the BindConstraint showing all types of usages
for this constraint class.
2010-06-28 18:06:23 +01:00
Emmanuele Bassi
98613382a4 test-text-field: Use the system font instead of using Sans 2010-06-25 11:44:53 +01:00
Neil Roberts
fbeab37828 test-conformance: Use -export-dynamic instead of -rdynamic
The -rdynamic linker option is specific to ELF so it was breaking
builds on systems with other object formats such as Windows and
Solaris. This patch replaces that option with -export-dynamic which is
a portable libtool option which should do the right thing on each
platform.

http://bugzilla.clutter-project.org/show_bug.cgi?id=1930
2010-06-24 17:46:29 +01:00
Øyvind Kolås
2a29cd2aee state: removed special handling of state named "default"
The "default" state used for unspecified source transitions is NULL.
Small update and some other fixes to documentation.
2010-06-24 15:49:01 +01:00
Emmanuele Bassi
e9fa68fbdd Add test-cogl-texture-pixmap-x11 to the ignore file 2010-06-22 14:05:39 +01:00
Emmanuele Bassi
c2b8a0272b conform: Do not use deprecated API in test-clutter-units
Setting the DPI is done through the ClutterSettings:font-dpi property.
2010-06-22 13:32:11 +01:00
Neil Roberts
05b6c283eb Add a test case for CoglTexturePixmapX11 2010-06-22 12:22:48 +01:00
Neil Roberts
d42c3069d1 test-pixmap: Use the 'm' key to toggle texture quality
When the 'm' key is pressed it will now recursively look for all
ClutterTexture subclasses on the stage and toggle the texture quality
between high and low. This is useful to test the mipmap fallback.
2010-06-22 12:22:48 +01:00
Neil Roberts
c5b5a88d6d test-pixmap: Draw something more interesting when the mouse is clicked
When the mouse button is pressed it would previously draw a small
1-pixel wide fully transparent line to the pixmap. This is a useful
feature to help test the automatic updates but the line is quite hard
to see so it's to easy miss. This patch changes it to draw a thick
black circle. The circle is drawn at a different position every time
the button is clicked.
2010-06-22 12:22:48 +01:00
Neil Roberts
02de8b9ad5 test-pixmap: Add a --disable-animation option
Sometimes the animation makes debugging awkward so this patch adds a
--disable-animation option to simplify the test.
2010-06-22 12:22:48 +01:00
Neil Roberts
75f48ad0ec test-pixmap: Enable automatic updates for the hand
The hand actor has a feature that if you click on the stage it will
draw a line to the actor. However it's not possible to see the results
of this because automatic updates were disabled so the texture would
never be updated.
2010-06-22 12:22:48 +01:00
Neil Roberts
f7dfc8caa4 test-pixmap: Implement the --disable-x11 option
test-pixmap has long had a --disable-x11 option that didn't do
anything. This patch adds the neccessary if (disable_x11) to disable
adding the ClutterX11TexturePixmap actor when the option is given.
2010-06-22 12:22:48 +01:00
Robert Bragg
a871ac669f test-shader: guard GLES2 specific changes with COGL_HAS_GLES2
Previously we were using an internal only HAVE_COGL_GLES2 define to
guard GLES 2 specific changes so for instance the precision modifiers
weren't being emitted in the shader source.

http://bugzilla.o-hand.com/show_bug.cgi?id=2178
2010-06-22 11:35:29 +01:00
Robert Bragg
bf9d5f3949 build: distinguish CLUTTER_WINSYS and CLUTTER_SONAME_INFIX
This adds a separate variable name "CLUTTER_SONAME_INFIX" to define the
infix for the clutter library that gets linked. Currently the WINSYS
corresponds to the directory we enter when building to compile the
window system and input support, but it is desirable to be able to
define multiple flavours that use the same WINSYS but should result in
different library names.

For example we are planning to combine the eglx and eglnative window
systems into one "egl" winsys but we will need to preserve the current
library names for the eglx and eglnative flavours.
2010-06-18 17:38:40 +01:00
Emmanuele Bassi
0411ba7d32 actor: Parse actions, constraints and effects members
ClutterActor should allow attaching actions, constraints and effects
just like it allows behaviours, e.g.:

  {
    ...
    "constraints" : [
      {
        "type" : "ClutterAlignConstraint",
        "source" : "stage",
        "align-axis" : "x-axis",
        "factor" : 0.5
      },
      {
        "type" : "ClutterAlignConstraint",
        "source" : "stage",
        "align-axis" : "y-axis",
        "factor" : 0.5
      }
    ],
    ...
  }

or:

  {
    ...
    "actions" : [
      {
        "type" : "ClutterDragAction",
        "signals" : [
          { "name" : "drag-end", "handler" : "on_drag_end" }
        ]
      }
    ],
    ...
  }

In order to do so, we use the Scriptable interface implementation and
add three new custom properties accepting an array; then we parse each
member of the array as a new object.
2010-06-17 17:35:00 +01:00
Emmanuele Bassi
2d99f77e3b cairo-texture: Disable :sync-size
The :sync-size property of ClutterTexture should be set to FALSE by
default by ClutterCairoTexture. The preferred size of the
ClutterCairoTexture is already the size of the internal Cairo surface,
and we override the preferred width/height getters to that effect.

The :sync-size property is also responsible of changing the size of
the Texture actor when changing the texture handle - but since we
encourage that to happen during the CairoTexture allocation, we get a
queue_relayout() invocation (and a warning) when we change the size
of the Cairo image surface.

Since GObject doesn't make it easy to override the default value of the
:sync-size property in sub-classes, we should simply call the setter
function during the ClutterCairoTexture instance initialization.

We should also change one of the interactive tests using a CairoTexture
to rebuild the contents of the actor in response to an allocation.
2010-06-16 13:58:41 +01:00
Emmanuele Bassi
5382e8722b Split out the ignored test files 2010-06-15 16:53:41 +01:00
Robert Bragg
c434f1fc48 material: Make CoglMaterial responsible for depth state
This redirects the legacy depth testing APIs through CoglMaterial and
adds a new experimental cogl_material_ API for handling the depth
testing state.

This adds the following new functions:
cogl_material_set_depth_test_enabled
cogl_material_get_depth_test_enabled
cogl_material_set_depth_writing_enabled
cogl_material_get_depth_writing_enabled
cogl_material_set_depth_test_function
cogl_material_get_depth_test_function
cogl_material_set_depth_range
cogl_material_get_depth_range

As with other experimental Cogl API you need to define
COGL_ENABLE_EXPERIMENTAL_API to access them and their stability isn't
yet guaranteed.
2010-06-15 15:26:28 +01:00
Øyvind Kolås
66de8656e9 test-state: move press/release callbacks to stage avoiding grab 2010-06-14 15:49:20 +01:00
Emmanuele Bassi
f97d16cd2d drag-action: Remove the press event button
Both ::drag-begin and ::drag-end have a "button" argument - even though
we assume internally, and externally, that dragging can only be the
result of a primary button operation.
2010-06-12 17:45:54 +01:00
Emmanuele Bassi
44f300b3a2 effect: Add PageTurnEffect
A simple deformation effect that simulates a page curl.

Ported from MxDeformPageTurn inside the Mx toolkit, written by
Chris Lord.
2010-06-10 18:40:29 +01:00
Robert Bragg
4f0a4b8521 test-cogl-tex-foreign: save and restore GL state correctly
This test breaks out into raw OpenGL to create a foreign texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.
2010-06-09 15:19:31 +01:00
Robert Bragg
3907825d05 test-cogl-texture-rectangle: save restore GL state correctly
This test breaks out into raw OpenGL to create a RECTANGLE texture so it
needs to be careful not to trample on any state that may be cached by
Cogl internally.
2010-06-09 15:19:31 +01:00
Neil Roberts
037f7a29d1 test-cogl-texture-rectangle: Fix the size allocated for reading data
The test was only allocating enough space for 256 rows of pixels but
it was then reading 384 so it would randomly fail.
2010-06-09 12:19:55 +01:00
Emmanuele Bassi
00675f42aa texture-async: Fix path fallback code
And error out in case of load failure.
2010-06-08 11:19:28 +01:00
Emmanuele Bassi
4c22f122e1 script: Support layout manager properties
Layout properties work similarly to child properties, with the added
headache that they require the 3-tuple:

  ( layout manager, container, actor )

to be valid in order to be inspected, parsed and applied. This means
using the newly added back-pointer from the container to the layout
manager and then rejigging a bit how the ScriptParser handles the
unresolved properties.

Similarly to the child properties, which use the "child::" prefix, the
layout manager properties use the "layout::" prefix and are defined with
the child of a container holding a layout manager.
2010-06-07 22:45:34 +01:00
Emmanuele Bassi
8583986e16 blur-effect: Fix loop unrolling
The box blur shader was not sampling all the points for producing the
desired effect.
2010-06-07 15:45:24 +01:00
Robert Bragg
457faaffb7 conform: Adds a test-cogl-object conformance test
This tests the new cogl_object_get/set_user_data API
2010-06-04 14:44:15 +01:00
Robert Bragg
eca2634050 cogl-path: Renames cogl_path_get/set cogl_get/set_path
These aren't path methods so aren't consistent with the
cogl_object_method naming style we are aiming for.
2010-06-04 14:44:15 +01:00
Emmanuele Bassi
781a413362 test-drag: Add desaturation effect
Use a desaturation effect on the drag handle.
2010-06-04 10:16:51 +01:00
Emmanuele Bassi
aef2f805a6 effects: Fix stacking of offscreen-based effects
Stacking multiple effects sub-classing ClutterOffscreenEffect requires
a small fix in the code that computes the screen coordinates of the
actor to position the FBO correctly with regards to the stage.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
8ef4d9fe21 actor: Add "effects" to the animatable metas
Since ClutterEffect is an ActorMeta it should be possible to animate the
properties of named effects using the @effects syntax, just like it
happens for actions and constraints.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
73a773d37a effect: Add DesaturateEffect
A simple shader-based effect that desaturates an actor and its contents
based on a controllable factor.
2010-06-03 14:10:55 +01:00
Emmanuele Bassi
a86f1b45bb Add the ClutterEffect abstract class
ClutterEffect is an abstract class that should be used to apply effects
on generic actors.

The ClutterEffect class just defines what an effect should implement; it
could be defined as an interface, but we might want to add some default
behavior dependent on the internal state at a later point.

The effect API applies to any actor, so we need to provide a way to
assign an effect to an actor, and let ClutterActor call the Effect
methods during the paint sequence.

Once an effect is attached to an actor we will perform the paint in this
order:

  • Effect::pre_paint()
  • Actor::paint signal emission
  • Effect::post_paint()

Since an effect might collide with the Shader class, we either allow a
shader or an effect for the time being.
2010-06-03 14:10:55 +01:00
Damien Lespiau
3161e92818 analysis: Make all function declarations be protoypes
It's valid C to declare a function omitting it prototype, but it seems
to be a good practise to always declare a function with its
corresponding prototype.
2010-06-01 12:08:18 +01:00
Damien Lespiau
83b7801e49 analysis: Fix the "key-press-event" callback signature
We were returning FALSE in a function declared as returning a gpointer.
Turns out that the function should return a gboolea instead.
2010-06-01 12:08:18 +01:00
Damien Lespiau
ec59af290c analysis: None used in pointer context
While this is totally fine (None is 0L and, in the pointer context, will
be converted in the right internal NULL representation, which could be a
value with some bits to 1), I believe it's clearer to use NULL instead
of None when we talk about pointers.
2010-06-01 12:08:18 +01:00
Robert Bragg
589c8d9579 [texture] Support picking textures according to their alpha channel
This adds a boolean "pick-with-alpha" property to ClutterTexture and when
true, it will use the textures alpha channel to define the actors shape when
picking.

Users should be aware that it's a bit more expensive to pick textures like
this (so probably best not to blindly enable it on *all* your textures)
since it implies rasterizing the texture during picking whereas we would
otherwise just send a solid filled quad to the GPU.  It will also interrupt
the internal batching of geometry for pick renders which can otherwise often
be done in a single draw call.
2010-05-28 16:07:17 +01:00
Emmanuele Bassi
dfe6eb1e51 test-scrolling: Use a better looking bounce easing 2010-05-27 16:33:01 +01:00
Emmanuele Bassi
aab411bde4 test-scrolling: Animate intermediate positions
Animating intermediate positions in the viewport panning is a neat
effect.
2010-05-27 12:32:45 +01:00
Emmanuele Bassi
346ebce573 actor: Add accessors pair for :clip-to-allocation
We should have an accessors pair for the :clip-to-allocation property,
to avoid going through the generic GObject accessors.
2010-05-26 16:09:47 +01:00
Emmanuele Bassi
6ea56f1160 Add a scrolling interactive example
We can use a container with :clip-to-allocation set to TRUE and a
DragAction to create a panning viewport.
2010-05-26 15:58:15 +01:00
Emmanuele Bassi
823251c159 Use ClickAction in test-animation
Instead of using ::button-press-event.
2010-05-26 14:18:19 +01:00
Emmanuele Bassi
728e2d8071 drag: Add a default drag-motion behaviour
The DragAction should, by default, drag the actor to which it has been
applied, instead of delegating what to do to the developer. If custom
code need to override it, g_signal_stop_emission_by_name() can be called
to stop the default handler to ever running.
2010-05-25 11:01:46 +01:00
Øyvind Kolås
8f0b70a9ee state: replaced test with a more complex one 2010-05-24 16:29:04 +01:00
Neil Roberts
70abe3dd8a test-cogl-materials: Test invalid layers with a constant color
This adds a test using a layer with no texture but that replaces the
fragment color with the layer constant. This currently causes the test
to fail.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Neil Roberts
ff7ce2c5b2 test-cogl-materials: Run the 'all layers' test with different prims
The drawing code from test_invalid_texture_layers which draws a
rectangle, a polygon and a vertex buffer has been split out to
separate function. test_using_all_layers now also uses this so that it
will also test the other two primitives. This causes the test to fail
when all of the layers are drawn using a vertex buffer.

http://bugzilla.openedhand.com/show_bug.cgi?id=2132
2010-05-24 16:10:56 +01:00
Emmanuele Bassi
382bd394b9 Merge branch 'wip/state-machine'
* wip/state-machine:
  Do not use wildcards in test-state
  script: Implement State deserialization
  state: added a "target-state" property
  state: documented data structures
  Add State interactive tests to the ignore file
  state: Documentation and introspection annotation fixes
  state: Minor coding style fixes
  state: Clean up the header's documentation
  state: Constify StateKey accessors
  Do not include clutter.h from a Clutter header file
  state-machine: made clutter_state_change take a boolean animate argument
  state-machine: use clutter_timeline_get_progress
  state-machine: add completed signal
  state machine: added state machine

Conflicts:
	.gitignore
2010-05-24 10:42:03 +01:00
Emmanuele Bassi
9fcbb274e0 Do not use wildcards in test-state
Use named states, like in a real case.
2010-05-21 14:22:56 +01:00
Emmanuele Bassi
6ca425679e script: Implement State deserialization
It should be possible to describe ClutterState transitions using
ClutterScript in a similar way as ClutterAnimator.
2010-05-21 14:13:14 +01:00
Emmanuele Bassi
5e3dc55666 Merge branch 'wip/constraints'
* wip/constraints: (24 commits)
  Add the Cogl API reference to the fixxref extra directories
  Document the internal MetaGroup class
  Remove the construct-only flag from ActorMeta:name
  doc: Remove gtk-doc annotations from the json-glib copy
  doc: Fix parameter documentation
  Add named modifiers for Action and Constraint
  Remove a redundant animation
  Set the stage resizable in test-constraints
  Use a 9 grid for the constraints test
  Miscellaneous documentation fixes
  docs: Document animating action and constraint properties
  docs: Document BindConstraint and AlignConstraint
  constraint: Rename BindConstraint:bind-axis
  constraints: Add AlignConstraint
  tests: Add a constraints interactive test
  constraint: Add BindConstraint
  actor: Implement Animatable
  animation: Use the new Animatable API for custom properties
  animatable: Add custom properties to Animatable
  constraint: Add ClutterConstraint base class
  ...

Conflicts:
	configure.ac
2010-05-21 10:55:09 +01:00
Øyvind Kolås
1dc8c0ff05 state-machine: made clutter_state_change take a boolean animate argument
Most of the time this will be TRUE, pass FALSE to change to the target
state immediately.
2010-05-20 16:24:29 +01:00
Øyvind Kolås
8761b279a7 state-machine: add completed signal
Added a completed signal to the animator
2010-05-20 16:24:29 +01:00
Øyvind Kolås
fcdc3a8989 state machine: added state machine 2010-05-20 16:24:29 +01:00
Emmanuele Bassi
7ce2693944 Add named modifiers for Action and Constraint
The ClutterActor API should have modifier methods for adding, removing
and retrieving Actions and Constraints using the ClutterActorMeta:name
property - mostly, for convenience.
2010-05-20 11:19:51 +01:00
Emmanuele Bassi
4dc91339c3 Remove a redundant animation 2010-05-19 18:23:29 +01:00
Emmanuele Bassi
86a773536f Set the stage resizable in test-constraints
To demonstrate that constraints can be used to reposition actors in a
resizable stage, set the :user-resizable property to TRUE, and spend the
next 15 minutes playing with the stage size.
2010-05-19 18:20:27 +01:00
Emmanuele Bassi
5d1b18669b Use a 9 grid for the constraints test
Let's complicate the interactive constraints test a little bit by adding
more actors and animating two constraints at a time.
2010-05-19 18:17:49 +01:00
Emmanuele Bassi
e9b93d5676 constraint: Rename BindConstraint:bind-axis
We're not binding an axis: we're really binding a coordinate of an actor
to the coordinate of another one.
2010-05-19 14:34:18 +01:00
Emmanuele Bassi
f857457b9d constraints: Add AlignConstraint
AlignConstraint is a simple constraint that keeps an actor's position
aligned to the width or height of another actor, multiplied by an
alignment factor.
2010-05-19 13:02:43 +01:00
Emmanuele Bassi
56e8e7d62f tests: Add a constraints interactive test
Show how to use constraints and how to animate them.
2010-05-19 12:28:35 +01:00
Neil Roberts
871683abd3 test-cogl-materials: Fix compilation under GLES 2
GLES 2 doesn't have GL_MAX_TEXTURE_UNITS. Instead the cogl backend
uses GL_MAX_TEXTURE_IMAGE_UNITS with a maximum limit of 16. The same
restriction is now used in the test.
2010-05-18 16:11:58 +01:00
Emmanuele Bassi
4fd74e71e6 action: Add DragAction, an action implementing drag capabilities
DragAction is an Action sub-class that provides dragging capabilities to
any actor. DragAction has:

  • drag-begin, drag-motion and drag-end signals, relaying the event
    information like coordinates, button and modifiers to user code;

  • drag-threshold property, for delaying the drag start by a given
    amount of pixels;

  • drag-handle property, to allow using other actors as the drag
    handle.

  • drag-axis property, to allow constraining the dragging to a specific
    axis.

An interactive test demonstrating the various features is also provided.
2010-05-17 16:42:11 +01:00
Neil Roberts
a12a2e591b Add a conformance test for ClutterCairoTexture
This adds a simple test for ClutterCairoTexture that draws two
rectangles to the cairo surface in an idle callback and then verifies
that they appeared at the right colours in the paint callback. If that
succeeds then the second time the idle callback is invoked it will
replace one of the rectangles with a sub region update and the
following paint callback will again verify the rectangles.
2010-05-11 15:57:12 +01:00
Robert Bragg
6228082e14 conform: Make gtester run a list of wrappers
Instead of asking gtester to run ./test-conformance directly we now tell
it to run a list of wrapper scripts. This results in each test being
spawned in a separate process avoiding leakage of state between tests
which has been a big problem with the conformance tests for quite a
while now.
2010-05-07 17:17:59 +01:00
Neil Roberts
0120abe5b0 test-cogl-multitexture: Set linear filters on the two textures
Otherwise it seems that rounding errors will cause the fragments at
the edge of the quad to blend with neighbouring quarters of the
texture which cause the test to fail.
2010-05-07 17:06:01 +01:00
Neil Roberts
21117bb7a9 test-conform-common: Disconnect all paint handlers on the stage
A few of the tests connected to the paint signal but never
disconnected it. Most of these handlers had a call to g_main_quit in
them which meant that it could sometimes cause subsequent tests to
exit after the first frame is painted. Most of the tests don't
validate any of the results until after a couple of frames have been
rendered so this ended up skipping out the test entirely.

To workaround this the test setup function now disconnects all
handlers for the paint signal on the default stage before the test is
run.
2010-05-06 14:21:53 +01:00
Neil Roberts
61ae7c6df7 test-cogl-readpixels: Reset the viewport and matrices
The on_paint function for test-cogl-readpixels tries to temporarily
set the projection, modelview and viewport to its own values. However
it was never restoring the saved values so it could affect the results
of subsequent tests.
2010-05-06 14:18:32 +01:00
Neil Roberts
b9c7051484 test-cogl-path: Initialise state.frame
state.frame was left unitialized so it would be left to happenstance
which of the first three frames would be used for validating the test.
2010-05-06 14:16:33 +01:00
Neil Roberts
a3bc4a6009 test-cogl-materials: Add a test using the maximum number of layers
This adds a test which creates a material using the maximum number of
layers. All of the layers are assigned a white texture except the last
which is set to red. The default combine mode is used for all of the
layers so the final fragment should end up red.

Currently Cogl doesn't provide a way to query the maximum number of
layers so it just uses glGetIntegerv instead. This might cause
problems on GLES 2 because that adds additional restrictions on the
number of layers.

http://bugzilla.openedhand.com/show_bug.cgi?id=2064
2010-04-29 12:15:06 +01:00
Neil Roberts
fddd316986 test-cogl-path: Test sub paths and intersections
This changes the original tests so that it splits the original path
into two sub paths. When adding a new block to the copied path it also
adds another sub path. This further stresses the path copying
mechanism and exposes a bug.

It also tests intersections by drawing a self-intersecting path and a
path with two sub-paths that overlap. Where the path overlaps it
should be inverted.
2010-04-21 18:58:18 +01:00
Neil Roberts
08a4995383 tests: Add a conformance test for the wrap modes of a cogl material
This renders a texture using different combinations of wrap modes for
the s and t coordinates and then verifies that the expected wrapping
is acheived. The texture is drawn using rectangles, polygons and
vbos. There is also code to test a rectangle using an atlased texture
(which should test the manual repeating) however the validation for
this is currently disabled because it doesn't work.

http://bugzilla.openedhand.com/show_bug.cgi?id=2063
2010-04-12 15:44:23 +01:00
Emmanuele Bassi
6583f8bb49 tests: Fix test-script.json
A trailing comma is breaking the validity of test-script.json
2010-04-09 18:28:37 +01:00
Neil Roberts
10b16b4b7e Add a test case for cogl_path
This tests various paths drawing rectangles and verifies that the
expected pixels are filled in. Some of the paths are drawn by copying
an existing path and modifying it which should test the copy-on-write
code.
2010-04-08 19:54:20 +01:00
Robert Bragg
d2d890a33e test-cogl-offscreen: Setup a clutter style modelview/projection
This updates test-cogl-offscreen to give an example of setting up a
CoglFramebuffer with a Clutter style 2D coordinate system with (0,0) top
left and (framebuffer_width, framebuffer_height) bottom right.
2010-04-06 09:26:10 +01:00
Neil Roberts
fdf608af4c test-cogl-tex-polygon: Actually use the material it creates
test-cogl-tex-polygon creates a separate material so that it can set
the texture filters. However in the paint functions that use
cogl_polygon it was calling cogl_set_source_texture which replaces the
material and ends up always using GL_LINEAR. This patch makes the
paint functions assume the correct source is set up instead of trying
to select a new source.
2010-03-31 19:03:24 +01:00
José Dapena Paz
7b63da69cf Add "homogeneous" mode to ClutterBoxLayout.
Added new "homogeneous" mode to ClutterBoxLayout, that makes layout children
get all the same size.

This is heavily inspired in the "homogeneous" attribute available in GtkBox,
but simplified as we don't have padding nor borders in box layout, only
spacing.

Also added to test-box-layout a key to set/unset homogeneous mode.

* Coding style fixes.
* Added proper test for homogeneous mode in box layout.
* Fix in homogeneous mode.

http://bugzilla.openedhand.com/show_bug.cgi?id=2034

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-25 09:41:54 +00:00
Emmanuele Bassi
382b38c0f7 test-paint-wrapper: Request ARGB visuals on GLX
If we are on GLX we have to request ARGB visuals, otherwise Clutter will
not do it by itself.
2010-03-10 00:25:26 +00:00
Neil Roberts
c3a942abde Add a conformance test for rectangle textures
The test creates a GL_TEXTURE_RECTANGLE_ARB texture using
cogl_texture_new_from_foreign and confirms that rendering it works
correctly. If the rectangle texture extension isn't available then
this test always succeeds.

http://bugzilla.openedhand.com/show_bug.cgi?id=2015
2010-03-04 14:52:12 +00:00
Emmanuele Bassi
9e4c008117 build: Include test-script-model.json
The Model conformance test for ClutterScript parsing requires the file
to be inside the dist.
2010-03-02 19:29:42 +00:00
Emmanuele Bassi
2d51432e52 build: Add test-animator-3.json to EXTRA_DIST 2010-03-02 19:29:42 +00:00
Emmanuele Bassi
2f68949962 conformance: Use g_assert_no_error() if available
GLib 2.20 has a nice g_assert() wrapper which will print out the GError
if it's not NULL.
2010-03-02 19:10:07 +00:00
Emmanuele Bassi
e550755f3d text-field: Cast GString->len to integer before printing
The compiler will warn on 64bit architectures when using %d for
printing a gsize field.

http://bugzilla.openedhand.com/show_bug.cgi?id=2019
2010-03-02 17:50:07 +00:00
Øyvind Kolås
09d8460a5c animator: s/clutter_animator_run/clutter_animator_start/
This is consistent with choice of words in clutter_timeline_start and
makes the API less surprising.
2010-03-02 17:03:03 +00:00
Emmanuele Bassi
aba6c5acc7 flow-layout: Provide a preferred size
The FlowLayout fails to provide a preferred size in case no sizing is
specified on one axis. It should, instead, have the preferred size of
the sum of its children, depending on the orientation property.

http://bugzilla.openedhand.com/show_bug.cgi?id=2013
2010-03-02 15:11:27 +00:00
Neil Roberts
c0a553163b cogl: Support any format in cogl_read_pixels
cogl_read_pixels() no longer asserts that the format passed in is
RGBA_8888 but instead accepts any format. The appropriate GL enums for
the format are passed to glReadPixels so OpenGL should be perform a
conversion if neccessary.

It currently assumes glReadPixels will always give us premultiplied
data. This will usually be correct because the result of the default
blending operations for Cogl ends up with premultiplied data in the
framebuffer. However it is possible for the framebuffer to be in
whatever format depending on what CoglMaterial is used to render to
it. Eventually we may want to add a way for an application to inform
Cogl that the framebuffer is not premultiplied in case it is being
used for some special purpose.

If the requested format is not premultiplied then Cogl will convert
it. The tests have been changed to read the data as premultiplied so
that they won't be affected by the conversion. Picking in Clutter has
been changed to use COGL_PIXEL_FORMAT_RGB_888 because it doesn't need
the alpha component. clutter_stage_read_pixels is left unchanged
because the application can't specify a format for that so it seems to
make most sense to store unpremultiplied values.

http://bugzilla.openedhand.com/show_bug.cgi?id=1959
2010-03-02 11:01:35 +00:00
Emmanuele Bassi
70d7bad98b conformance: Use g_test_verbose() for logging
Protect g_print() calls behind the g_test_verbose() check, to avoid
unwanted output during the conformance test run.
2010-02-25 23:15:59 +00:00
Bastian Winkler
96c31bbf0e model: Implement ClutterScriptable interface
Allow a ClutterModel to be constructed through the ClutterScript API.
Currently this allows a model to be generated like like this:

{
  "id" : "test-model",
  "type" : "ClutterListModel",
  "columns" : [
    [ "text-column", "gchararray" ],
    [ "int-column", "gint" ],
    [ "actor-column", "ClutterRectangle" ]
  ]
}

where 'columns' is an array containing arrays of column-name,
column-type pairs.

http://bugzilla.openedhand.com/show_bug.cgi?id=2007
2010-02-25 23:09:11 +00:00
Neil Roberts
31b5856d69 test-cogl-blend-strings: Add some more tests
The adds tests for the remaining layer combine functions, the 1 minus
value operator and the TEXTURE_N source. Note however that Cogl
currently fails when parsing a TEXTURE_N source so the test is
commented out.
2010-02-25 12:50:52 +00:00
Emmanuele Bassi
bd303d6efb conform: Verify parsing of multiple properties
The ClutterAnimator support for parsing multiple properties should be
verified in the conformance test suite.

http://bugzilla.openedhand.com/show_bug.cgi?id=2003
2010-02-24 16:43:17 +00:00
Emmanuele Bassi
3a9d842164 conformance: Show the Stage to test invariants
We need to make the Stage set the MAPPED flag on itself if we want to
verify the MAPPED state. That was always the case - it just worked
before because the Stage was shown at least once.
2010-02-24 12:25:48 +00:00
Neil Roberts
a726ef32aa test-cogl-vertex-buffer: Fix the maximum index number
It was passing the number of vertices to
cogl_vertex_buffer_draw_elements but instead it should take the
maximum index which would be the number of vertices minus one. This
was causing errors to be reported with the checks filterset of Bugle.
2010-02-17 14:38:45 +00:00
Emmanuele Bassi
fbcaf1e0b3 Improve LEAVE events for border actors
If an actor is lying on the border of the Stage it might miss the LEAVE
event when the pointer of a device leaves the Stage window. Since the
backend is unsetting the Stage back pointer on the InputDevice we can
queue the emission of a LEAVE event on the pointer actor as well.

http://bugzilla.moblin.org/show_bug.cgi?id=9677
2010-02-17 10:48:18 +00:00
Chris Lord
d42f928c43 [test-interactive] Add a stage sizing test
Add an interactive stage sizing test to test the interaction of
fullscreening/resizing/expanding/shrinking a visible stage.
2010-02-16 15:39:08 +00:00
Emmanuele Bassi
7a3eb452b8 conform: Do not resize the stage
Since all conformance tests share the same state we should not touch
stuff like the stage size; sharing is already fairly complex and adds a
lot of caveats on the implementation of a conformance test unit, and if
we make tests influence later ones then we might slip in bugs or false
negatives - thus defeating the whole point of a conformance test suite.
2010-02-16 12:19:15 +00:00
Emmanuele Bassi
4cadc73005 conform: Use a 640x480 stage in test-pick
Do not resize the stage to a smaller size: the default size is perfectly
fine.
2010-02-16 12:19:15 +00:00
Emmanuele Bassi
e65bb38720 conform: Use g_assert_cmpint() in cogl-readpixels test
The g_assert_cmpint() macro prints out not just the assertion condition
but also the assertion contents; this is useful to catch wrong values
without incrementing the verbosity of the test itself.
2010-02-16 12:01:13 +00:00
Emmanuele Bassi
0d428655e2 actor: Turn push/pop_internal into Actor methods
Since the "internal" state is global, it will leak onto actors that you
didn't intend for it to, because it applies not just to the actors you
create, but also to any actors *they* create. Eg, if you have a dialog
box class, you might push/pop_internal around creating its buttons, so
that those buttons get marked as internal to the dialog box. But
ctx->internal_child will still be set during the *button*'s constructor
as well, and so, eg, the label and icon inside the button actor will
*also* be marked as internal children, even if that isn't what the
button class wanted.

The least intrusive change at this point is to make push_internal() and
pop_internal() two methods of the Actor class, and take a ClutterActor
pointer as the argument - thus moving the locality of the internal_child
counter to the Actor itself.

http://bugzilla.openedhand.com/show_bug.cgi?id=1990
2010-02-15 16:09:26 +00:00
Emmanuele Bassi
fef82fae5c build: Enable experimental COGL API in tests/conform
Enable the experimental API when building the conformance test suite.
2010-02-15 11:58:55 +00:00
Emmanuele Bassi
032121ce17 build: Disable deprecated API in tests/conform
We should not be using deprecated API in the conformance test suite.
2010-02-15 11:57:48 +00:00
Emmanuele Bassi
c3354cb2c0 conform: Do not use deprecated API
There is no more type-specific ref/unref pairs: it is all under
CoglHandle now.
2010-02-15 11:56:34 +00:00
Neil Roberts
4be4f56bdf cogl-sub-texture: Optimise taking a sub texture of a sub texture
When creating a Cogl sub-texture, if the full texture is also a sub
texture it will now just offset the x and y and reference the full
texture instead. This avoids one level of indirection when rendering
the texture which reduces the chances of getting rounding errors in
the calculations.
2010-02-12 16:57:17 +00:00
Emmanuele Bassi
00c4bfc3c6 analysis: Interactive tests
Abort if test-behave was passed the wrong type of behaviour to test.
2010-02-12 14:57:56 +00:00
Emmanuele Bassi
46182233c0 analysis: Conformance tests
Initialize ClutterPathNote members to 0 using "{ 0, }".
2010-02-12 14:57:56 +00:00
Emmanuele Bassi
f54b29a0c0 test-text-field: Tone down the border
Use a low opacity for the text field border.
2010-02-10 15:45:54 +00:00
Emmanuele Bassi
2670fc5871 test-text-field: Use ActorBox methods for the border
Clamp to pixel and use get_size() when painting the border of the text
field.
2010-02-10 15:45:54 +00:00
Emmanuele Bassi
cccf23caa4 build: Always build conformance tests with debug symbols
Having the conformance test suite build without debug symbols doesn't
make any sense.
2010-02-09 13:24:13 +00:00
Robert Bragg
e46db37c03 conform: fix stack corruption in test-behaviours.c
The test was calling g_object_get to fetch the "opacity-start" property
(unsigned int) into a guint8 local variable. It's a bit of a mean trap
given that the getter function returns guint8 values so this also adds a
comment explaining what's going on.
2010-02-09 13:09:24 +00:00
Emmanuele Bassi
a139bf9c40 test-animator: Do not use mid-function blocks
The test_animator_properties unit is so small that declaring a
mid-function block for two variables is not that clever.
2010-02-08 17:56:35 +00:00
Damien Lespiau
c02dded0f6 cogl-buffer: Use TEXTURE as the only value for CoglBufferUsageHint
We should try to use more explicit defines than GL for our hints. For
now we only support using a CoglBuffer to generate textures.
2010-02-08 17:14:49 +00:00
Damien Lespiau
b5d5821304 tests: Add a test for CoglPixelBuffers
Exercise the whole public CoglBuffer / CoglPixelBuffer and
cogl_texture_new_from_buffer API.
2010-02-08 17:14:49 +00:00
Emmanuele Bassi
069ba6daf9 Merge branch 'animator-parser'
* animator-parser:
  docs: Describe the Animation definition syntax
  animator: Provide a ClutterScript parser
  animator: Allow retrieving type property type from a key
  script: Use a node when resolving an animation mode
2010-02-08 16:53:11 +00:00
Emmanuele Bassi
4dd11d6915 animator: Provide a ClutterScript parser
The whole point of having the Animator class is that the developer can
describe a complex animation using ClutterScript. Hence, ClutterAnimator
should hook into the Script machinery and parse a specific description
format for its keys.
2010-02-08 15:52:18 +00:00
Emmanuele Bassi
8ac27e6070 test-flow-layout: Remove unneeded Stage sizing
The bug with resizable stages getting a 1, 1 window on X11 has been
fixed by Chris.
2010-02-08 10:40:39 +00:00
Øyvind Kolås
4cc269a468 Add ClutterAnimator
ClutterAnimator is a class for managing the animation of multiple
properties of multiple actors over time with keyframing of values.

The Animator class is meant to be used to effectively describe
animations using the ClutterScript definition format, and to construct
complex implicit animations from the ground up.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-07 18:25:19 +00:00
Emmanuele Bassi
e55966d675 Deprecate clutter_util_next_p2()
The next_p2() function should have never been publicly exposed by
Clutter.
2010-02-06 10:49:33 +00:00
Emmanuele Bassi
dcdb97006b build: Add suppressions file to EXTRA_DIST 2010-02-06 10:49:33 +00:00
Neil Roberts
830f2402d4 Merge branch 'more-texture-backends'
This adds three new texture backends.

- CoglTexture2D: This is a trimmed down version of CoglTexture2DSliced
  which only supports a single texture and only works with the
  GL_TEXTURE_2D target. The code is a lot simpler so it has a less
  overheads than dealing with slices. Cogl will use this wherever
  possible.

- CoglSubTexture: This is used to get a CoglHandle to represent a
  subregion of another texture. The texture can be used as if it was a
  standalone texture but it does not need to copy the resources.

- CoglAtlasTexture: This collects RGB and RGBA textures into a single
  GL texture with the aim of reducing texture state changes and
  increasing batching. The backend will try to manage the atlas and
  may move the textures around to close gaps in the texture. By
  default all textures will be placed in the atlas.
2010-02-06 00:20:32 +00:00
Emmanuele Bassi
15c6fef7e3 tests: Add a Valgrind suppression file
When running tests under Valgrind it would be useful to pass a
suppression file for the known one-off allocations done by Clutter
and by its dependencies. This trims the output of Valgrind and
improves the ability to actually spot leaks.
2010-02-04 16:49:06 +00:00
Emmanuele Bassi
16a5911cff tests: Clean up the cairo-flowers interactive test 2010-02-03 15:05:37 +00:00
Kristian Høgsberg
5bec49aea9 Use ClutterTimeline in test-clutter-cairo-flowers.c
http://bugzilla.openedhand.com/show_bug.cgi?id=1969
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-02 19:19:06 +00:00
Emmanuele Bassi
12b004b0e7 tests: Add an initial Behaviour conformance suite
The coverage of the Behaviour sub-classes is currently abysmal. An
initial test suite for Behaviours should at least verify that the
accessors and the constructors are doing the right thing.

This initial test suite just verifies the BehaviourOpacity sub-class,
but it already bumps up the overall coverage by 2%.
2010-02-02 12:58:27 +00:00
Neil Roberts
145cc9d3df Merge remote branch 'master' into texture-debugging
Conflicts:
	clutter/cogl/cogl/cogl-context.h
2010-02-01 13:37:19 +00:00
Emmanuele Bassi
5f1c8a17e4 Merge branch 'device-manager'
* device-manager: (37 commits)
  x11: Re-enable XI1 extension keyboards
  x11: Always handle core device events before XI events
  docs: Documentation fixes for DeviceManager
  device-manager: Fix the signals definition
  docs: Add sections for InputDevice and DeviceManager
  docs: Add clutter_input_device_get_device_name()
  tests: Print out the device details on motion
  Always register core devices
  device: Remove unused is_default member
  win32: Experimental implementation of device support
  tests: Print the device name, as well as its Id
  x11: Fill out the :name property of the InputDevices
  device: Add the :name property to InputDevice
  x11: Store core devices on the X11 Backend singleton
  device: Unset the cursor actor when leaving the stage
  device: Add pointer actor getter
  x11: Discard the LeaveNotify for off-stage ButtonRelease
  device: Do not overwrite the stage for an InputDevice
  event: Off-stage button releases have a click count of 1
  event: Scroll events do not have click count
  ...
2010-02-01 11:26:56 +00:00
Emmanuele Bassi
5f5f6d825f build: Allow disabling the conformance test suite
When building Clutter for packaging on headless boxes it's pointless to
allow building the conformance test to be built (and run on 'make
check').
2010-02-01 10:40:34 +00:00
Damien Lespiau
afb30f4013 tests: blend-string: use g_assert_cmpint
It's very useful to see the actual number the reference value is
compared too when the test fails. GTest has g_assert_cmp$type()
functions for that, so make good use of them.
2010-01-26 17:25:10 +00:00
Damien Lespiau
de31cbf4f7 test-cogl-multitexture: use several materials with texture matrices
A small doubt has risen about the use of CoglTextureUnit in materials:
will texture matrices still work if we have several materials, each of
them having at texture on the same texture unit? The answer is yes!

test-cogl-multitexture has been extended to use 2 materials with about
the same setup except a little difference: the texture matrices for the
lightmaps rotate in opposite directions.

While at it, changed the rotation behaviour by an implicit animation
with a small additional bonus bling.
2010-01-26 16:59:50 +00:00
Emmanuele Bassi
d0f7debfba test-easing: Do not reconnect signals multiple times
The test should keep track of the last animation and avoid reconnecting
signals to the same instance in case the -r argument has been passed.
2010-01-22 21:44:28 +00:00
Emmanuele Bassi
8a4b647154 x11: Re-enable XI1 extension keyboards
The extension keyboard support in XInput 1.x is hopelessly broken.

Nevertheless, it's possible to use some bits of it, as we prefer the
core keyboard events to the XInput events, thus at least having proper
handling for X11 key events on the Stage window.
2010-01-20 19:40:58 +00:00
Emmanuele Bassi
1f5a7b61b7 tests: Print out the device details on motion
The test-device interactive test should print out the device name and id
when it detects a motion event.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
850dd5a38f tests: Print the device name, as well as its Id
The test-devices interactive test should display the device name along
with the id.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
68b47e3ed4 tests: Fix test-events output
• The enter/leave event line should take into account the case where
  the related field is set to NULL (meaning entering from off-stage
  and leaving the stage).

• The ButtonRelease line shows the click count but uses the button; the
  button *and* the click count should be displayed for both ButtonPress
  and ButtonRelease, to verify they match.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
75f05646fa tests: Clean up test-events
The output of test-events is a bit of a mess; this patch should clean
it up a little bit - at least enough for it to be useful again during
visual inspection.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
d5331bfb57 tests: Update the devices test
Use the DeviceManager API instead of the X11 specific API.
2010-01-20 00:38:08 +00:00
Neil Roberts
1ef40b8823 test-cogl-npot-texture: Use the COGL_TEXTURE_NO_ATLAS flag
If the texture is put in the atlas it won't be sliced whatever size it
is so it negates the test. We can avoid this with the NO_ATLAS flag.
2010-01-19 17:15:51 +00:00
Neil Roberts
ff1d9cf090 test-texture-fbo: Disconnect the paint handler for the stage
Otherwise the paint handler will still be run for the subsequent
tests. This ends up writing to the ‘state’ variable which used to be
on the stack so it will end up corrupting some stack variable. This
was causing test-cogl-premult to fail.
2010-01-18 12:42:46 +00:00
Neil Roberts
36f18e5ac5 cogl: Make CoglSubTexture only work for quad rendering
The sub texture backend doesn't work well as a completely general
texture backend because for example when rendering with cogl_polygon
it needs to be able to tranform arbitrary texture coordinates without
reference to the other coordintes. This can't be done when the texture
coordinates are a multiple of one because sometimes the coordinate
should represent the left or top edge and sometimes it should
represent the bottom or top edge. For example if the s coordinates are
0 and 1 then 1 represents the right edge but if they are 1 and 2 then
1 represents the left edge.

Instead the sub-textures are now documented not to support coordinates
outside the range [0,1]. The coordinates for the sub-region are now
represented as integers as this helps avoid rounding issues. The
region can no longer be a super-region of the texture as this
simplifies the code quite a lot.

There are two new texture virtual functions:

transform_quad_coords_to_gl - This transforms two pairs of coordinates
     representing a quad. It will return FALSE if the coordinates can
     not be transformed. The sub texture backend uses this to detect
     coordinates that require repeating which causes cogl-primitives
     to use manual repeating.

ensure_non_quad_rendering - This is used in cogl_polygon and
     cogl_vertex_buffer to inform the texture backend that
     transform_quad_to_gl is going to be used. The atlas backend
     migrates the texture out of the atlas when it hits this.
2010-01-18 09:22:04 +00:00
Neil Roberts
ead4399536 Merge branch 'master' into more-texture-backends 2010-01-15 12:15:46 +00:00
Neil Roberts
a70ebe4f52 tests: Add a simple conformance test for texture mipmaps
This adds a test which renders a texture into a 1x1 pixel quad with
and without filters that use mipmaps. The pixel without mipmaps will
be one of the colors from the texture and the one with will be the
average of all the pixels in the texture.
2010-01-15 12:05:19 +00:00
Emmanuele Bassi
c6ce9c3389 conform: Add operators tests for ClutterColor
The clutter_color_add() and clutter_color_subtract() functions are
lacking unit testing to catch eventual regressions.
2010-01-14 14:07:04 +00:00
Emmanuele Bassi
6e82d11daf units: Improve coverage of clutter_units_from_string()
Add a unit for an empty string as well as units for the missing unit
types like cm, mm and px.
2010-01-13 17:31:13 +00:00
Robert Bragg
8b950bdc87 journal: Fixes logging of multiple sets of texture coordinates
If a user supplied multiple groups of texture coordinates with
cogl_rectangle_with_multitexture_coords() then we would repeatedly log only
the first group in the journal.  This fixes that bug and adds a conformance
test to verify the fix.

Thanks to Gord Allott for reporting this bug.
2010-01-12 11:22:08 +00:00
Emmanuele Bassi
5c14538c14 Remove obsolete code from test-text
The test-text "fake scrolling" code stopped working somewhere between
0.8 and 0.9, with the new layout code. Instead of the ::cursor-event
signal it should use an approach similar to the Scrollable interface in
the Moblin User Experience toolkit.

Right now, it makes sense to ignore this code entirely.
2010-01-11 17:10:00 +00:00
Emmanuele Bassi
4207524e95 Remove trailing comma from test UI definition
The animation definition test has a trailing comma at the end of an
array item.
2010-01-05 11:02:39 +00:00
Emmanuele Bassi
3d350078a8 Merge branch 'animate-layout-manager' into ebassi-next
* animate-layout-manager:
  layout-manager: Document the animation support
  layout-manager: Rewind the timeline in begin_animation()
  box-layout: Remove the allocations hash table
  docs: Clean up the README file
  layout: Let begin_animation() return the Alpha
  box-layout: Add knobs for controlling animations
  box-layout: Animate layout properties
  layout: Add animation support to LayoutManager
  Add ActorBox animation methods
2009-12-23 10:38:02 +00:00
Emmanuele Bassi
a09ac0b27c Merge branch 'stage-use-alpha' into ebassi-next
* stage-use-alpha:
  tests: Use accessor methods for :use-alpha
  stage: Add accessors for :use-alpha
  tests: Allow setting the stage opacity in test-paint-wrapper
  stage: Premultiply the stage color
  stage: Composite the opacity with the alpha channel
  glx: Always request an ARGB visual
  stage: Add :use-alpha property
  materials: Get the right blend function for alpha
2009-12-20 17:39:12 +00:00
Emmanuele Bassi
b6bd8be6cb Merge branch 'internal-flag' into ebassi-next
* internal-flag:
  conform: Add test unit for the destruction of Containers
  actor: Add internal child flag
  Clean up whitespace, indentation and comments
2009-12-20 17:33:51 +00:00
Emmanuele Bassi
c7e8ddb7a6 conform: Add test unit for the destruction of Containers
Verify that internal children do not go through the remove()
implementation, and that non-internal children do.
2009-12-18 23:34:25 +00:00
Emmanuele Bassi
2e6397c391 box-layout: Add knobs for controlling animations
ClutterLayoutManager does not have any state associated with it, and
defers all the state to its sub-classes.

The BoxLayout is thus in charge of controlling:

  • whether or not animations should be used
  • the duration of the animation
  • the easing mode of the animation

By adding three new properties:

  • ClutterBoxLayout:use-animations
  • ClutterBoxLayout:easing-duration
  • ClutterBoxLayout:easing-mode

And their relative accessors pairs we can make BoxLayout decide whether
or not, and with which parameters, call the begin_animation() method of
ClutterLayoutManager.

The test-box-layout has been modified to reflect this new functionality,
by checking the key-press event for the 'a' key symbol to toggle the use
of animations.
2009-12-13 01:15:02 +00:00
Emmanuele Bassi
dc47550bc8 Merge branch 'size-cache' into ebassi-next
* size-cache:
  tests: Clean up the BoxLayout interactive test
  actor: Add debugging notes for size cache
  Add a cache of size requests
2009-12-09 23:32:18 +00:00
Emmanuele Bassi
34913378fb tests: Use accessor methods for :use-alpha
Instead of using g_object_set().
2009-12-09 17:17:33 +00:00
Emmanuele Bassi
3b075b6dc4 tests: Allow setting the stage opacity in test-paint-wrapper
This allows testing the Stage:use-alpha property and the blending done
by a compositor.
2009-12-09 01:46:52 +00:00
Emmanuele Bassi
b33b6287a1 tests: Clean up the BoxLayout interactive test 2009-12-04 17:39:04 +00:00
Emmanuele Bassi
9ccdf2eb02 box: Add relative packing methods
ClutterBox should provide some convenience functions to pack a new child
at a given position, either an absolute index or relative to a sibling.
2009-12-04 16:54:22 +00:00
Neil Roberts
27c4eb483d cogl: Add a conformance test for sub textures
This tests creating a sub texture from a larger texture using various
different texture coordinates. It also tries to read back the texture
data using cogl_texture_get_data.
2009-12-02 22:03:16 +00:00
Emmanuele Bassi
586750751a Merge branch 'text-direction'
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration
2009-12-01 14:55:19 +00:00
Emmanuele Bassi
7d842079ca conform: Add named object property unit for ClutterScript
We should exercise the resolution of the object properties containing a
string pointing to an object previously defined using ClutterScript.
2009-11-30 19:11:00 +00:00
Damien Lespiau
0ce5c7d350 gitignore: update gitignore files to match the latest cogl tests
Some cogl tests were renamed in c1247066 to have 'cogl' in their names.
It's a good excuse to merge .gitigore and tests/.gitignore.
2009-11-30 13:29:39 +01:00
Damien Lespiau
4f06d035a2 tests: fix argument parsing of test-texture-quality
This test did not open redhand.png as argc/argv should be handled
normally (argv[0] being the name of the exectutable).

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-11-30 12:53:54 +01:00
Damien Lespiau
e4180b2838 tests: give all the arguments to the wrapper
Some tests can be given extra arguments. The test-interactive dispatch
mechanism handles that but the small shell scripts around the wrapper
do not forward the arguments to the wrapper.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-11-30 12:53:26 +01:00
Robert Bragg
c12470666e tests: rename cogl conformance tests so they can be clearly identified
All Cogl conformance tests are now prefixed 'test-cogl-'
2009-11-27 00:28:39 +00:00
Robert Bragg
439f8c62b0 cogl: deprecate cogl_draw_buffer API and replace with a cogl_framebuffer API
cogl_push_draw_buffer, cogl_set_draw_buffer and cogl_pop_draw_buffer are now
deprecated and new code should use the new cogl_framebuffer_* API instead.

Code that previously did:
    cogl_push_draw_buffer ();
    cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, buffer);
    /* draw */
    cogl_pop_draw_buffer ();
should now be re-written as:
    cogl_push_framebuffer (buffer);
    /* draw */
    cogl_pop_framebuffer ();

As can be seen from the example above the rename has been used as an
opportunity to remove the redundant target argument from
cogl_set_draw_buffer; it now only takes one call to redirect to an offscreen
buffer, and finally the term framebuffer may be a bit more familiar to
anyone coming from an OpenGL background.
2009-11-26 19:33:14 +00:00
Neil Roberts
b869e87c86 test-npot-texture: Add some verbose notes
This just adds some verbose output stating whether Cogl thinks that
NPOT textures are supported.
2009-11-18 17:28:08 +00:00
Neil Roberts
8f1edcb6ed disable-npots: Don't allow the GL version to be 2.0
Cogl now assumes non-power-of-two textures are supported if the GL
version is >= 2.0 so the disable-npots utility should also change the
GL version.
2009-11-18 17:28:08 +00:00
Emmanuele Bassi
b69ee0989b tests: Add instructions to test-box-layout 2009-11-13 15:35:11 +00:00
Emmanuele Bassi
c8d5703788 tests: Add unit for Animation definitions
Verify that an Animation can be defined using ClutterScript.

No initial/final state of the animation, yet.
2009-11-13 15:01:17 +00:00
Emmanuele Bassi
95b55588ad tests: Print out parser errors if present
If the conformance test for the Script parser throws an error
and we've enabled verbosity then we should print out the error
message before aborting.
2009-11-13 15:01:17 +00:00
Emmanuele Bassi
482e4e8d11 tests: Display the index inside text-box-layout
Since the rectangles packed inside the BoxLayout interactive test
have random colors it's not easy to verify the ordering. By using
the CoglPango API to print out the index in the middle of each
rectangle.
2009-11-10 12:21:26 +00:00
Neil Roberts
2671c42589 Revert changes to test-cogl-primitives.c from 272e227109
These changes caused the test to try to load redhand.png but this no
longer works since the TESTS_DATADIR changes in 0b4899ef23. The only
use of the hand is commented out anyway so it looks like the changes
were intended for temporary debugging.
2009-11-09 18:19:42 +00:00
Joshua Lock
b9e519c3b2 tests: Remove a spurious #include
The test-backface-culling has what looks like a stray #include in which
stops the test compiling for backends without GdkPixbuf. Remove it.

http://bugzilla.openedhand.com/show_bug.cgi?id=1867
2009-11-06 11:49:21 +00:00
Emmanuele Bassi
f1ed8be066 conform: Add unit for properties holding objects
Exercise the definition of GObjects for properties defined using
GParamSpecObject.
2009-11-06 11:39:30 +00:00
Emmanuele Bassi
185107c6cf conformance: Add unit on the implicit alpha definition
Exercise the implicit alpha and timeline definition to catch
regressions in the ClutterScript parser code.
2009-11-06 11:39:30 +00:00
Robert Bragg
abae6013e1 Remove all internal use of deprecated cogl_clip_* API
cogl_clip_push, and cogl_clip_push_window_rect which are now deprecated were
used in various places internally so this just switches to using the
replacement functions.
2009-11-05 21:10:18 +00:00
Robert Bragg
272e227109 [cogl-clip] deprecate parts and cleanup the API
cogl_clip_push() which accepts a rectangle in model space shouldn't have
been defined to take x,y,width,height arguments because this isn't consistant
with other Cogl API dealing with model space rectangles.  If you are using a
coordinate system with the origin at the center and the y+ extending up,
then x,y,width,height isn't as natural as (x0,y0)(x1,y1). This API has
now been replace with cogl_clip_push_rectangle()

(As a general note: the Cogl API should only use the x,y,width,height style
when the appropriate coordinate space is defined by Cogl to have a top left
origin.  E.g.  window coordinates, or potentially texture coordinates)

cogl_clip_push_window_rect() shouldn't have been defined to take float
arguments since we only clip with integral pixel precision. We also
shouldn't have abbreviated "rectangle". This API has been replaced with
cogl_clip_push_window_rectangle()

cogl_clip_ensure() wasn't documented at all in Clutter 1.0 and probably
no one even knew it existed. This API isn't useful, and so it's now
deprecated. If no one complains we may remove the API altogether for
Clutter 1.2.

cogl_clip_stack_save() and cogl_clip_stack_restore() were originally added
to allow us to save/restore the clip when switching to/from offscreen
rendering.  Now that offscreen draw buffers are defined to own their clip
state and the state will be automatically saved and restored this API is now
redundant and so deprecated.
2009-11-05 21:10:17 +00:00
Emmanuele Bassi
0b4899ef23 tests: Clean up interactive test build
The build for interactive tests creates symbolic links for the data
under tests/data; it also uses symbolic links for creating "binaries"
for each interactive test. This is less than ideal, though.

Instead, the tests should build a path to the data files by using
a pre-processor define like TESTS_DATADIR; both g_build_filename() and
pre-processor string concatenation can be used to generate a valid
file name with the full path to the files.

The build system should also create wrapper scripts, just like we
do inside the conformance test suite, to be able to launch single
tests.
2009-11-05 17:47:26 +00:00
Emmanuele Bassi
95d78acb4c script: Allow parsing child properties
The ClutterScript parser needs to be extended to parse child properties
and apply them after an actor has been added to a container. In order to
distinguish child properties from regular GObject properties we can use
the "child::" prefix, e.g.:

  {
    "type" : "ClutterRectangle",
    "id" : "child-01",
    "child::has-focus" : true,
    ...
  }

Parsing child properties can be deferred to the ClutterScriptable
interface, just like regular properties.
2009-11-04 16:50:35 +00:00
Emmanuele Bassi
8ba13d6495 script: Clean up Color parsing rules
All the ClutterColor parsing rules should be coalesced inside
clutter_script_parse_color(): object, array and string notations
are the canonical ways of defining a ClutterColor inside a
ClutterScript definition. Having a single function in charge of
the parsing cleans up the code.
2009-11-04 15:21:03 +00:00
Emmanuele Bassi
d7cfa15851 conform: Add the beginnings of a ClutterScript test suite
ClutterScript is a very complicated piece of machinery, with a
parser that has custom variations on top of the basic JSON
format; it could also be extended in the future, so if we don't
want to introduce regressions or break existing ClutterScript
definitions, we'd better have a conformance test suite.
2009-11-04 11:50:45 +00:00
Emmanuele Bassi
7d891d9dd4 tests: Allow getting data files from the tests/data directory
The units under the conformance test suite should be able to use
external files. Linking the files in tests/conform like the
interactive tests do seems like a hack piled on top of a hack, so
instead we should provide a programmatic way for a conformance
test unit to get the full path of a file, regardless of where the
tests/data directory is.

We can use a define to get the full path of tests/data and then
a function using g_build_filename() to construct the path to the
file we want.
2009-11-04 11:47:09 +00:00
Robert Bragg
4258214e50 [test-fbo] greatly simplify the test
This test tried to do too much, and I can't remember the last time I saw this
test work.

It no longer tries to create a texture from an offscreen actor and it no
longer tries to use shaders.

It does though show that chaining of clutter_texture_new_from_actor now
works, and that animating the source actor is reflected in textures created
from it.

When run you should see three actors:
- on the left is the pristine source actor rotating around the y-axis
- in the middle is the first texture created from the source actor
- and on the right a texture created from the middle actor

Note: the somewhat strange bobbing of the middle and right textures is
actually correct given how it was decided long ago to map the transformed
(to screen space) allocation of the source actor to the texture.  When the
hand spins around the perspective projection of the top of the hand results
in the origin of the texture bobbing up to a higher stage position, but the
position of the textures is fixed.  This design also means we end up
reallocating our offscreen draw buffer every frame that the actors
transformed size changes, which isn't ideal.
2009-11-04 03:34:09 +00:00
Robert Bragg
ffb592de59 [tests] test-backface-culling: test culling with offscreen rendering
Since offscreen rendering is internally forced to be upside down Cogl
needs to reverse the glFrontFace winding order so as not to interfere
with the use of cogl_set_backface_culling_enabled()

This ensures we test that mechanism.
2009-11-04 03:34:09 +00:00
Robert Bragg
60b642f5d6 [tests] Adds test-cogl-readpixels.c for very basic cogl_read_pixels testing
Mostly this was written to verify that we don't flip the data read back from
an offscreen draw buffer.  (since all offscreen rendering is done upside
down)
2009-11-04 03:34:09 +00:00
Robert Bragg
2ff7f2d287 [tests] Adds test-cogl-offscreen to validate offscreen draw buffer
This adds a basic test to check that rendering a few colored rectangles
offscreen works and that the modelview gets restored when switching back to
the previous buffer.
2009-11-04 03:34:09 +00:00
Robert Bragg
369e68630d [tests] test-cogl-viewport tests semantics of over/under size viewports
Unlike OpenGL Cogl puts the origin of windows/viewports at the top left
instead of bottom left.  This test verifies that we correctly translate Cogl
viewports to OpenGL viewports for the awkward cases where the given viewport
has an offset and/or the viewport has a different size to the current draw
buffer.
2009-11-04 03:34:08 +00:00
Robert Bragg
bc24190b9a [test-texture-fbo] comment the colors defined in corner_colors
It helps to be able to quickly glance at the definition to see which
quadrant of the test actor should be which color, so when debugging a
problem and looking at the visual output you can easily verify if it's being
flipped upside down/left to right.
2009-11-04 03:34:08 +00:00
Neil Roberts
b41a81fb08 Add a conformance test for clutter_texture_new_from_actor
This contains four tests :-

 - A regular onscreen source with a clone next to it

 - An offscreen source with a clone. This is currently commented out
   because it no longer works.

 - An onscreen source with a rectangular clip and a clone.

 - An onscreen source with a clip from a path and a clone.

The sources are all a 2x2 grid of colors. Each clone is tested that it
either contains the color that should be at that grid position or that
the stage color is showing through if the source is clipped.
2009-11-04 03:34:08 +00:00
Emmanuele Bassi
5a63e8af8f tests: Use the right key symbol for adding children
The test-box-layout should be using CLUTTER_plus instead of a
literal '+'.
2009-10-26 15:10:20 +00:00
Emmanuele Bassi
00748f6656 tests: Print out the captured event type
The ::captured-event signal on the Stage is not printing out the
event type.
2009-10-26 11:42:16 +00:00
Emmanuele Bassi
673199b6e0 tests: Update test-script
Use explicit alpha definition and custom alpha functions.
2009-10-21 16:15:18 +01:00
Emmanuele Bassi
ba25571c8e Merge branch 'layout-manager'
* layout-manager: (50 commits)
  docs: Reword a link
  layout, docs: Add more documentation to LayoutManager
  layout, docs: Fix description of Bin properties
  layout, bin: Use ceilf() instead of casting to int
  layout, docs: Add long description for FlowLayout
  layout, box: Clean up
  layout, box: Write long description for Box
  layout, docs: Remove unused functions
  layout: Document BoxLayout
  layout: Add BoxLayout, a single line layout manager
  layout: Report the correct size of FlowLayout
  layout: Resizing the stage resizes the FlowLayout box
  layout: Use the get_request_mode() getter in BinLayout
  layout: Change the request-mode along with the orientation
  actor: Add set_request_mode() method
  [layout] Remove FlowLayout:wrap
  [layout] Rename BinLayout and FlowLayout interactive tests
  [layout] Skip invisible children in FlowLayout
  [layout] Clean up and document FlowLayout
  [layout] Snap children of FlowLayout to column/row
  ...
2009-10-19 11:45:15 +01:00
Robert Bragg
8790306629 [test-backface-culling] Check that inverted tex coords don't affect culling
The additional check draws another front facing rectangle but this time with
the texture coords flipped on the x axis.  The code that handles sliced
textures in cogl-primitives.c makes some suspicious changes to the geometry
when the texture coords are inverted.
2009-10-16 18:58:52 +01:00
Robert Bragg
43efab46bc Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.

Currently this is the structure I'm aiming for:
cogl/
    cogl/
	<put common source here>
	winsys/
	   cogl-glx.c
	   cogl-wgl.c
	driver/
	    gl/
	    gles/
	os/ ?
    utils/
	cogl-fixed
	cogl-matrix-stack?
        cogl-journal?
        cogl-primitives?
    pango/

The new winsys component is a starting point for migrating window system
code (i.e.  x11,glx,wgl,osx,egl etc) from Clutter to Cogl.

The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.

Overview of the planned structure:

* The winsys/ API is the API that binds OpenGL to a specific window system,
  be that X11 or win32 etc.  Example are glx, wgl and egl. Much of the logic
  under clutter/{glx,osx,win32 etc} should migrate here.

* Note there is also the idea of a winsys-base that may represent a window
  system for which there are multiple winsys APIs.  An example of this is
  x11, since glx and egl may both be used with x11.  (currently only Clutter
  has the idea of a winsys-base)

* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
  representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
  GLES 1.1 (fixed funciton) and 2.0 (fully shader based)

* Everything under cogl/ should fundamentally be supporting access to the
  GPU.  Essentially Cogl's most basic requirement is to provide a nice GPU
  Graphics API and drawing a line between this and the utility functionality
  we add to support Clutter should help keep this lean and maintainable.

* Code under utils/ as suggested builds on cogl/ adding more convenient
  APIs or mechanism to optimize special cases. Broadly speaking you can
  compare cogl/ to OpenGL and utils/ to GLU.

* clutter/pango will be moved to clutter/cogl/pango

How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"

Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps

As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
2009-10-16 18:58:50 +01:00
Emmanuele Bassi
83b4ec7a12 units: Cache the pixels value inside Units
When computing the pixels value of a ClutterUnits value we should
be caching the value to avoid recomputing for every call of
clutter_units_to_pixels(). We already have a flag telling us to
return the cached value, but we miss the mechanism to evict the
cache whenever the Backend settings affecting the conversion, that
is default font and resolution, change.

In order to implement the eviction we can use a "serial"; the
Backend will have an internal serial field which we retrieve and
put inside the ClutterUnits structure (we split one of the two
64 bit padding fields into two 32 bit fields to maintain ABI); every
time we call clutter_units_to_pixels() we compare the units serial
with that of the Backend; if they match and pixels_set is set to
TRUE then we just return the stored pixels value. If the serials
do not match then we unset the pixels_set flag and recompute the
pixels value.

We can verify this by adding a simple test unit checking that
by changing the resolution of ClutterBackend we get different
pixel values for 1 em.

http://bugzilla.openedhand.com/show_bug.cgi?id=1843
2009-10-16 15:25:37 +01:00
Emmanuele Bassi
2883728387 [text] Add pre-edit string to ClutterText
Input Methods require to be able to set a "pre-edit string", that is
a string that it's just displayed into the Text actor without being
committed to the actor's buffer. The string might require custom Pango
attributes, and an update of the cursor position.
2009-10-16 12:45:29 +01:00
Emmanuele Bassi
b526b76593 layout: Add BoxLayout, a single line layout manager
The BoxLayout layout manager implements a layout policy for arranging
children on a single line, either alongside the X axis or alongside the
Y axis.
2009-10-14 11:31:48 +01:00
Emmanuele Bassi
c4b2d4ce79 layout: Report the correct size of FlowLayout
FlowLayout should compute the correct height for the assigned width when
in horizontal flow, and the correct width for the assigned height when
in vertical flow. This means pre-computing the number of lines inside
the get_preferred_width() and get_preferred_height(). We can then cache
the computed column width and row height, cache them inside the layout
and then use them when allocating the children.
2009-10-14 11:31:35 +01:00
Emmanuele Bassi
6f19666b13 layout: Resizing the stage resizes the FlowLayout box
Add some user interaction to verify the dynamic reflowing.
2009-10-14 11:31:31 +01:00
Emmanuele Bassi
6d954ec074 [layout] Rename BinLayout and FlowLayout interactive tests
The BinLayout and FlowLayout interactive tests should be named more
explicitly.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
e5a074fd9e [layout] Add :homogeneous to FlowLayout 2009-10-14 11:31:30 +01:00
Emmanuele Bassi
5737cf869f [layout] Initial implementation of FlowLayout
FlowLayout is a layout manager that arranges its children in a
reflowing line; the orientation controls the major axis for the
layout: horizontal, for reflow on the Y axis, and vertical, for
reflow on the X axis.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
8b2088a917 [layout, tests] Use variants for child packing in Box
There are three potential variants to add a child inside a Box
with a BinLayout:

  - clutter_box_pack(), a variadic argument function which
    allows passing arbitrary LayoutMeta properties and values;

  - clutter_bin_layout_add(), which uses the backpointer to
    the container from the LayoutManager and sets the layout
    properties directly without GValue (de)marshalling

  - clutter_container_add_actor() and
    clutter_bin_layout_set_alignment(), similar to the
    clutter_bin_layout_add() function above, but split in two

The test-box interactive test should exercise all three variants.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
f58bdbad15 [layout] Rename Box::add to Box::pack
Since ClutterBox is a ClutterContainer we should avoid naming
collisions between methods.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
aaae60e178 [layout] Implement ClutterBox::add
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.

If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.

Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
9cccff504a [layout] Add layers to BinLayout
Each actor managed by a BinLayout policy should reside inside its
own "layer", with horizontal and vertical alignment. The :x-align
and :y-align properties of the BinLayout are the default alignment
policies, which are copied to each new "layer" when it is created.

The set_alignment() and get_alignment() methods of BinLayout can
be changed to operate on a specific "layer".

The whole machinery uses the new ChildMeta support inside the
LayoutManager base abstract class.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
a1853892ba [tests] Add a Box interactive test 2009-10-14 11:27:19 +01:00
Damien Lespiau
80b3a8d328 [units] Ensure we don't have ponies
The documentation states we should not parse ponies. Even with those
with exclamation marks.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 17:10:51 +01:00
Damien Lespiau
8605073edb [units] Add support for centimeters
The only tricky part of the patch is to remember that 1cm is 10mm.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 16:06:26 +01:00
Damien Lespiau
96859959bd [units] Be more strict in the grammar we are parsing
Current parsing of units has a number of shortcomings:
  * a number followed by trailing space (without any unit specified) was
    not recognized,
  * "5 emeralds" was parsed as 5em,
  * the way we parse the digits after the separator makes us lose
    precision for no good reason (5.0 is parsed as 5.00010014...f which
    makes g_assert_cmpfloat() fail)

Let's define a stricter grammar we can recognize and try to do so. The
description is in EBNF form, removing the optional <> which is a pain
when having to write DocBook, and using '' for the terminal symbols.

Last step, add more ClutterUnits unit test to get a better coverage of
the grammar we want to parse.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 16:06:26 +01:00
Thomas Wood
c7d50083ec [color] allow alpha to be omitted when converting to color from string
Parse #rgb and #rrggbb in addition to forms with the alpha channel
specified. This allows conversion of colour strings from documents such as
CSS where the alpha channel is not specified when using '#' notation.

This patch also adds the relevant conformance test.
2009-10-07 12:56:01 +01:00
Damien Lespiau
a799f6ccec Fix string parsing when no unit is given
The check should really be on the character pointed by str. Added the
corresponding test case.
2009-10-05 13:08:16 +01:00
Emmanuele Bassi
72243081b5 Merge branch 'stage-window-object'
* stage-window-object:
  [x11] Fix Stage user-initiated resize
  [x11] Remove a useless forced paint
  [stage] Rework the Stage implementation class
2009-10-05 12:37:08 +01:00
Emmanuele Bassi
111512a2a0 [x11] Fix Stage user-initiated resize
The user-initiated resize is conflicting with the allocated size. This
happens because we change the size of the stage's X Window behind the
back of the size allocation machinery.

Instead, we should change the size of the actor whenever we receive a
ConfigureNotify event to reflect the new size of the actor.
2009-10-05 12:24:19 +01:00
Robert Bragg
4293920a11 [tests] Remove test-entry.c since we don't have a ClutterEntry any more
Removes an unused interactive unit test for the old ClutterEntry actor we
used to have.
2009-09-22 11:30:36 +01:00
Emmanuele Bassi
ecfa0c4f92 [build] Split out the custom silent rules
The silent rules we use for custom targets should be moved into a
separate Makefile.am that gets included from all the others.
2009-09-16 17:47:59 +01:00
Robert Bragg
94e60c393b [test-cogl-multitexture] Print an error if textures can't be loaded
I just wasted a silly amount time trying to bisect an apparently broken
cogl-test-multitexture until I realized it was just silently failing to load
any textures.
2009-09-16 17:20:03 +01:00
Emmanuele Bassi
561f5868e8 [tests] Add preferred size conformance test unit
This unit verifies that an Actor class will invoke the get_preferred_*
virtual functions unless the caching is in effect; it also verifies
that the cached values are correctly evicted.
2009-09-15 11:27:50 +01:00