| 1 |
gtk-reftest is a new test runner supposed to do a lot of generic tests. |
| 2 |
Run it like this: |
| 3 |
|
| 4 |
./gtk-reftest [OPTIONS] TESTFILE [TESTFILES...] |
| 5 |
|
| 6 |
where FILE is a GtkBuilder ui file to run. |
| 7 |
|
| 8 |
For a general test named "test", you want to have the following files: |
| 9 |
1) test.ui |
| 10 |
2) test.ref.ui |
| 11 |
3) test.css (optional) |
| 12 |
The test will then check that test.ui and test.ref.ui are rendered |
| 13 |
identically with the provided css. |
| 14 |
|
| 15 |
In detail, for every provided TESTFILE the test runner will: |
| 16 |
1) Add the css to the default screen |
| 17 |
2) Load the test.ui file and the test.ref.ui file |
| 18 |
3) Grab the first GtkWindow subclass widget |
| 19 |
4) gtk_widget_show() it and take a snapshot image of its contents into |
| 20 |
a cairo surface. |
| 21 |
5) Compare the two images to be bitwise identical. If they are not, a |
| 22 |
diff image will be created hilighting the differences. |
| 23 |
6) Save the images as png files to the output directory named: |
| 24 |
- test.out.png (rendering of test.ui) |
| 25 |
- test.ref.png (rendering of test.ref.ui) |
| 26 |
- test.diff.png (optional, differences from step 5) |
| 27 |
7) Fail the test if the two images are not bitwise identical |
| 28 |
|
| 29 |
Credit for the idea of reftests goes to Mozilla and in particular David |
| 30 |
Baron. For a larger introduction of why reftests are useful, see |
| 31 |
http://weblogs.mozillazine.org/roc/archives/2008/12/reftests.html |