Commit Graph

404 Commits

Author SHA1 Message Date
Emmanuele Bassi
e259b2f30d Avoid O(n²) walking of string arrays
"Yo, we heard you like traversing NULL-terminated arrays to operate on
them, so we called g_strv_length() as the for condition, so you can
iterate the array while iterating the array."

Instead of making famed rapper and television producer Xzibit proud, we
should avoid calling g_strv_length() on an array while looping on the
array, to avoid quadratic complexity.

We do this in various places that deal with arrays of strings that we
cannot really guess are short enough not to matter — e.g. the list of
CSS selectors in the inspector, or the required authentication
information for printing.
2015-07-16 16:19:55 +01:00
Paolo Borelli
a19331f231 label: add support for CSS letter-spacing property
Support letter-spacing CSS property on GtkLabel.
Reftest is included.
2015-07-06 00:04:05 +02:00
Benjamin Otte
cd3f24d579 cssvalue: Change color transitions to run premultiplied
Previously, the unpremultiplied values from the GdkRGBA were taken. Now
we premultiply the color values as specified by the CSS specs.
This is only relevant when transitioning with translucent colors.

An example is the halfway transition between transparent (0, 0, 0, 0)
and white (1, 1, 1, 1). Previously, all 4 values where transitioned
separately and the result was semi-transparent gray (0.5, 0.5, 0.5,
0.5).
By depending on the alpha value, the result is now semi-transparent
white (1, 1, 1, 0.5) which is what one would naively expect.

New reftest: color-transition
2015-06-26 21:12:50 +02:00
Matthias Clasen
68aa48cc44 Fix up expected results of a11y tests
These changed due to th extra box that GtkAssistant now
inserts for each page.
2015-06-23 17:08:14 -04:00
Cosimo Cecchi
131abe28a4 reftests: fix style class syntax in CSS file
Fixes reftests.

https://bugzilla.gnome.org/show_bug.cgi?id=750605
2015-06-12 08:55:23 -07:00
Cosimo Cecchi
0093b156d7 testsuite: add a test for non-square symbolic icons
To verify the previous fix.

https://bugzilla.gnome.org/show_bug.cgi?id=750605
2015-06-12 08:55:23 -07:00
Benjamin Otte
d921a4fe84 testsuite: Add deprecation guards 2015-05-28 16:53:53 +02:00
Matthias Clasen
43ba6a492e Dist the gtk-builder-tool test script 2015-05-26 14:58:15 -04:00
Cosimo Cecchi
cfbd862aae tests: wait for draw before fetching tree view style
On some slower machines (e.g. an ARM OBS builder), this test is failing
with a race condition where we're trying to fetch the style before it's
applied.

https://bugzilla.gnome.org/show_bug.cgi?id=749593
2015-05-24 12:08:33 -07:00
Matthias Clasen
fb51f447a2 Fix a11y tests
The output of the about dialog test is affected by the keynav
fixes.
2015-05-12 07:44:21 -04:00
Matthias Clasen
dedfcd7d58 Quiet the bitmask test
Don't spew so many 0s and 1s.
2015-05-12 07:40:47 -04:00
Sjoerd Simons
9a7e69a990 notify test: Don't test object relying on dbus connections
Don't test types that rely on a pre-existing dbus session bus.

https://bugzilla.gnome.org/show_bug.cgi?id=749009
2015-05-07 22:37:55 -04:00
Matthias Clasen
fb8294f5e4 gtk-builder-tool: Run the tests installed too 2015-05-02 17:39:06 -04:00
Matthias Clasen
d22f351e28 gtk-builder-tool: Add some tests 2015-05-02 17:39:06 -04:00
Matthias Clasen
f06cd304bd Adjust tests 2015-04-30 06:19:10 -04:00
Matthias Clasen
5271106250 Test the new error conditions 2015-04-29 15:20:51 -04:00
Matthias Clasen
90352f1979 GtkInfoBar: Add a test for 'invalid ID' 2015-04-27 23:09:35 -04:00
Matthias Clasen
cd19f3bf0b GtkDialog: Add a test for 'invalid ID' 2015-04-27 23:09:35 -04:00
Matthias Clasen
86ca248c99 GtkContainer: Add a test for 'invalid ID'
...and add all the container tests to Makefile.am
2015-04-27 23:09:30 -04:00
Matthias Clasen
7969204e7a Adjust affected tests 2015-04-27 19:21:45 -04:00
Matthias Clasen
a84c15fef0 Fix the build
There was one too many dialog test cases in the Makefile.

https://bugzilla.gnome.org/show_bug.cgi?id=748509
2015-04-27 06:15:28 -04:00
Matthias Clasen
3c23a2e32b Adjust builder tests
Some errors are now returned as markup errors instead of builder
errors. Adjust the tests for this.
2015-04-27 01:15:25 -04:00
Matthias Clasen
d955c6e7e5 Adjust existing tests 2015-04-27 01:15:24 -04:00
Matthias Clasen
8ae4a82ae4 Add tests for the infobar builder parser 2015-04-27 01:15:23 -04:00
Matthias Clasen
cff5e0d15b Add tests for the GtkFileFilter builder parser 2015-04-27 01:15:23 -04:00
Matthias Clasen
95ea81d6d1 Add tests for the GtkDialog builder parser 2015-04-27 01:15:23 -04:00
Matthias Clasen
f11fedb719 Add tests for GtkLevelBar builder parser 2015-04-27 01:15:23 -04:00
Matthias Clasen
66ce0b6509 Add tests for GtkContainer builder parser 2015-04-27 01:15:22 -04:00
Matthias Clasen
e973d49a11 Add tests for the GtkScale builder parser
These tests check various error conditions in GtkScale
custom tags.
2015-04-27 01:15:22 -04:00
Matthias Clasen
d416f352ad Add tests for the GtkCellLayout builder parser
These tests check various error conditions in GtkCellLayout
custom tags.
2015-04-27 01:15:22 -04:00
Matthias Clasen
2c807335c4 Add tests for the GtkLabel builder parser
These tests check various error conditions in GtkLabel
custom tags.
2015-04-27 01:15:22 -04:00
Matthias Clasen
40bb2a1616 reftests: Add a way to compare different runs
gtk-reftest already had an --output=DIR option to tell it where
to save all the resulting images. Now you can combine this with
the --compare-with=DIR option in a second run to make gtk-reftest
compare the .out.png files from the first run with the .out.png
files of the current run, instead of producing .ref.png files.

The intended use for this is to verify that changes do not affect
the generated output.
2015-03-20 16:42:04 -04:00
Benjamin Otte
ec57c6c10b csspathnode: Handle context going away
Sometimes path nodes can survive longer than the style context that
created them. Don't crash in those cases.

Fixes startup of mutter.

Testcase included.

https://bugzilla.gnome.org/show_bug.cgi?id=746407
2015-03-18 18:24:45 +01:00
Benjamin Otte
6c00eba7fb testsuite: Add another random stylecontext test 2015-03-18 15:23:31 +01:00
Benjamin Otte
2670ae4436 reftests: Add a reftest for box sibling ordering 2015-03-18 15:23:31 +01:00
Benjamin Otte
2d013a739a reftests: Fix test on HighContrast theme
We are testing -gtk-icon-style and assume the theme doesn't touch it.
But HighContrast forces symbolic icons. And that breaks the reference
images.

So explicitly set "requested" for everything.
2015-03-16 15:44:42 +01:00
Matthias Clasen
98730f71f9 testsuite: Set some environment variables
These were set manually in some tests, but not consistently.
2015-03-13 17:51:42 -04:00
Matthias Clasen
b756fd42a0 testsuite: Drop test bus
It seems to be buggy in ways that make the test fail
with a critical when the test bus is brought down.
At the same time, drop manual settings of environment
variables that we can set globally.
2015-03-13 17:51:32 -04:00
Matthias Clasen
8615a52ca3 Add some reftests related to textview tags
This test shows that a) tags override the text view style and
b) tags override each other in the expected way.
2015-03-11 22:04:29 -04:00
Philip Withnall
52858f709c gtktreeselection: Fix an abort on selecting an invalid range
gtk_tree_selection_real_modify_range() has a g_return_if_fail() if the
start or end paths passed to it do not correspond to real tree nodes.
However, GtkTreePaths inherently do not have to be valid, so it should
be acceptable to call gtk_tree_selection_select_range() with
non-existent paths. Replace the g_return_if_fail() by a silent return,
and add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2015-03-11 11:24:29 +00:00
Matthias Clasen
ec567e5fad Add a test for builder-constructed file filters 2015-03-08 09:12:21 -04:00
Benjamin Otte
40f2af665d gdkcairo: Bail if surface is in error
Don't try to paint onto an error surface. This happens for example when
gdk_cairo_set_source_pixbuf() is called with a pixbuf that is too big
for Cairo to handle.

Spotted by Christian Boxdörfer
2015-02-25 01:55:28 +01:00
Benjamin Otte
0ab48fcc42 css: Fix _gtk_bitmask_subtract()
We were doing the wrong thing *and* writing uninitialized memory while
doing so. BAD.

Also added tests exposing these.

https://bugzilla.redhat.com/show_bug.cgi?id=1185585
2015-02-25 01:55:28 +01:00
Benjamin Otte
7eecb16404 treeview: Don't create an overly large pixel cache
GPUs generally have problems when you create a 35000px wide surface.
Luckily X catches this and sends a BadAlloc. Which GTK immediately
abort()s on.

Testcase included.

https://bugzilla.redhat.com/show_bug.cgi?id=1163579
2015-02-05 18:57:29 +01:00
Benjamin Otte
edec64cda3 stylecontext: Don't crah when invalidate() is called on saved context
We need to invalidate the root node, not the current one.
Fixes crashes on startup of eclipse.

Testcase included.

https://bugzilla.redhat.com/show_bug.cgi?id=1185828
2015-02-04 21:20:29 +01:00
Benjamin Otte
7e5ac3a58d roundedbox: Treat path segments differently
If a side of the box is 0px wide, make the corners owned by the adjacent
sides. This avoids spilling over of unwanted colors from the 0-width
side into the corner.

New test for this case is included.
2015-01-22 16:25:54 +01:00
Benjamin Otte
f313a8235b reftests: Fix border-style-none reftest
Unset all CSS; Adwaita was messing up things.
2015-01-20 01:15:04 +01:00
Benjamin Otte
ad199e4cf9 stylecontext: Use correct parent style for lookups
After 3a337156d1 style lookups still used
the parent context's style as the parent style, even though after a
gtk_style_context_save() the root style of the style context is the
proper parent.

Testcase attached.
2015-01-07 14:26:48 +01:00
Ting-Wei Lan
ef57ac6bf1 reftests: Fix typo
It causes build failure on MinGW.

https://bugzilla.gnome.org/show_bug.cgi?id=741827
2014-12-22 11:14:17 +08:00
Benjamin Otte
7b6c68adc6 testsuite: Fix test that was committed in a broken state
1) Use font-size instead of color
This makes it easier to compare reference and test because the values
don't change.

2) Actually sort the reference properly
This unbreaks the test.
2014-12-01 04:05:44 +01:00