reftests: Make animation-direction test more reliable
This test was failing in continuous, where the tests are running in a VM with disabled animations. Make the test adapt to that situation by changing the reference ui on the fly if we find that animations are disabled.
This commit is contained in:
		| @ -506,6 +506,7 @@ libreftest_la_SOURCES =			\ | ||||
| 	statusbar-remove-all.c		\ | ||||
| 	textview-border-windows.c	\ | ||||
| 	textview-tags.c			\ | ||||
| 	label-attributes.c		\ | ||||
| 	$(NULL) | ||||
|  | ||||
| -include $(top_srcdir)/git.mk | ||||
|  | ||||
| @ -15,6 +15,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -29,6 +30,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -43,6 +45,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -57,6 +60,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -71,6 +75,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -85,6 +90,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -99,6 +105,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -113,6 +120,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -127,6 +135,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -141,6 +150,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -155,6 +165,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -169,6 +180,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -183,6 +195,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -197,6 +210,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -211,6 +225,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -225,6 +240,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -239,6 +255,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffff00000000"/> | ||||
|             </attributes> | ||||
| @ -253,6 +270,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -267,6 +285,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -281,6 +300,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -295,6 +315,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -309,6 +330,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -323,6 +345,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -337,6 +360,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -351,6 +375,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -365,6 +390,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -379,6 +405,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -393,6 +420,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -407,6 +435,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -421,6 +450,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -435,6 +465,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
| @ -449,6 +480,7 @@ | ||||
|             <property name="visible">True</property> | ||||
|             <property name="can_focus">False</property> | ||||
|             <property name="label" translatable="yes">XXX</property> | ||||
|             <signal name="map" handler="reftest:strip_attributes_if_no_animation"/> | ||||
|             <attributes> | ||||
|               <attribute name="foreground" value="#ffffffff0000"/> | ||||
|             </attributes> | ||||
|  | ||||
							
								
								
									
										46
									
								
								testsuite/reftests/label-attributes.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								testsuite/reftests/label-attributes.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | ||||
| /* | ||||
|  * Copyright (C) 2016 Red Hat Inc. | ||||
|  * | ||||
|  * Author: | ||||
|  *      Matthias Clasen <mclasen@redhat.com> | ||||
|  * | ||||
|  * This library is free software; you can redistribute it and/or | ||||
|  * modify it under the terms of the GNU Library General Public | ||||
|  * License as published by the Free Software Foundation; either | ||||
|  * version 2 of the License, or (at your option) any later version. | ||||
|  * | ||||
|  * This library is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | ||||
|  * Library General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU Library General Public | ||||
|  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
| #include <gtk/gtk.h> | ||||
|  | ||||
| #include "gtk-reftest.h" | ||||
|  | ||||
| static gboolean | ||||
| unblock (gpointer data) | ||||
| { | ||||
|   reftest_uninhibit_snapshot (); | ||||
|   return G_SOURCE_REMOVE; | ||||
| } | ||||
|  | ||||
| G_MODULE_EXPORT void | ||||
| strip_attributes_if_no_animation (GtkWidget *widget) | ||||
| { | ||||
|   gboolean enabled; | ||||
|  | ||||
|   g_object_get (gtk_widget_get_settings (widget), "gtk-enable-animations", &enabled, NULL); | ||||
|   if (enabled) | ||||
|     return; | ||||
|  | ||||
|   reftest_inhibit_snapshot (); | ||||
|   gtk_label_set_attributes (GTK_LABEL (widget), NULL); | ||||
|   g_timeout_add (500, unblock, NULL); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Matthias Clasen
					Matthias Clasen