Commit Graph

537 Commits

Author SHA1 Message Date
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
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