Commit Graph

8 Commits

Author SHA1 Message Date
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
cc83986eb8 reftests: Make test runner always use image surfaces
See comment in code for why.
2012-02-02 03:14:01 +01:00
Matthias Clasen
585a6652d5 Use G_SOURCE_CONTINUE/REMOVE
Now that GLib provides these macros, we should use them
to make the code more readable.
2012-01-30 19:12:27 -05:00
Benjamin Otte
66f0544238 reftests: Ensure we got a draw event before quitting the main loop 2011-05-05 17:33:04 +02:00
Benjamin Otte
3f4f900242 reftests: Add a hack to make toplevels work in various WMs
If we have a toplevel, and not a popup window, do wait an additional
0.5s to give the WM/server enough time to actually create the window.

This is a hack and there should be a better solution. But it works.

Please use POPUP windows for tests unless the test must use toplevel
windows.
2011-05-05 17:33:04 +02:00
Benjamin Otte
5c026f32e9 reftests: Plug a leak 2011-05-05 17:33:04 +02:00
Benjamin Otte
d0451d6fa4 reftests: Add a --output option to the test runner
This argument specifies where to dump images instead of /tmp. It's not
hooked up to the test runner, so that one will continue to dump into
/tmp.
2011-05-03 15:40:49 +02:00
Benjamin Otte
363dbb6039 reftests: Add
Add a new test runner supposed to do a lot of generic tests. Run it like
this:

./gtk-reftest [OPTIONS] TESTFILE [TESTFILES...]

where FILE is a GtkBuilder ui file to run.

For a general test named "test", you want to have the following files:
1) test.ui
2) test.ref.ui
3) test.css (optional)
The test will then check that test.ui and test.ref.ui are rendered
identically with the provided css.

In detail, for every provided TESTFILE the test runner will:
1) Add the css to the default screen
2) Load the test.ui file and the test.ref.ui file
3) Grab the first GtkWindow subclass widget
4) gtk_widget_show() it and take a snapshot image of its contents into
   a cairo surface.
5) Compare the two images to be bitwise identical. If they are not, a
   diff image will be created hilighting the differences.
6) Save the images as png files to the output directory named:
   - test.out.png (rendering of test.ui)
   - test.ref.png (rendering of test.ref.ui)
   - test.diff.png (optional, differences from step 5)
7) Fail the test if the two images are not bitwise identical

Credit for the idea of reftests goes to Mozilla and in particular David
Baron. For a larger introduction of why reftests are useful, see
http://weblogs.mozillazine.org/roc/archives/2008/12/reftests.html
2011-05-03 15:40:48 +02:00