mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-20 21:19:24 +00:00
Merge pull request #302 from ZoiteChat/theme-gtk3-tests-revert
Revert previous fixes merged to master without forcing.
This commit is contained in:
@@ -74,7 +74,6 @@ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/net.zoite
|
||||
xwfb-run -- /usr/bin/meson test -C %{_vpath_builddir} --num-processes %{_smp_build_ncpus} --print-errorlogs \
|
||||
"Theme Manager Dispatch Routing Tests" \
|
||||
"Validate net.zoite.Zoitechat.desktop" \
|
||||
"Theme GTK3 Settings Tests" \
|
||||
"Validate translations" \
|
||||
"Fishlim Tests"
|
||||
|
||||
|
||||
@@ -227,21 +227,6 @@ test('Theme Access Routing Tests', theme_access_tests,
|
||||
timeout: 120,
|
||||
)
|
||||
|
||||
theme_gtk3_settings_tests = executable('theme_gtk3_settings_tests',
|
||||
[
|
||||
'theme/tests/test-theme-gtk3-settings.c',
|
||||
'theme/theme-gtk3.c',
|
||||
],
|
||||
include_directories: [config_h_include],
|
||||
dependencies: [gtk_dep],
|
||||
)
|
||||
|
||||
test('Theme GTK3 Settings Tests', theme_gtk3_settings_tests,
|
||||
protocol: 'tap',
|
||||
timeout: 120,
|
||||
)
|
||||
|
||||
|
||||
theme_preferences_gtk3_populate_tests = executable('theme_preferences_gtk3_populate_tests',
|
||||
'theme/tests/test-theme-preferences-gtk3-populate.c',
|
||||
include_directories: [config_h_include],
|
||||
|
||||
@@ -34,18 +34,12 @@ struct session *lastact_sess;
|
||||
struct zoitechatprefs prefs;
|
||||
|
||||
static gboolean gtk_available;
|
||||
static gboolean gtk_has_default_seat;
|
||||
static char *temp_root;
|
||||
static char *xdg_data_home;
|
||||
static char *themes_root;
|
||||
static char *theme_parent_root;
|
||||
static char *theme_child_root;
|
||||
static char *theme_switch_root;
|
||||
|
||||
static const char *theme_parent_name = "zoitechat-test-parent";
|
||||
static const char *theme_child_name = "zoitechat-test-child";
|
||||
static const char *theme_switch_name = "zoitechat-test-switch";
|
||||
|
||||
gboolean
|
||||
theme_policy_system_prefers_dark (void)
|
||||
{
|
||||
@@ -187,20 +181,6 @@ zoitechat_gtk3_theme_build_inheritance_chain (const char *theme_root)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
test_display_has_default_seat (void)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
if (!GDK_IS_DISPLAY (display))
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
return GDK_IS_SEAT (seat);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_bool_setting (const char *name)
|
||||
{
|
||||
@@ -235,16 +215,12 @@ setup_themes (void)
|
||||
temp_root = g_dir_make_tmp ("zoitechat-theme-gtk3-settings-XXXXXX", NULL);
|
||||
g_assert_nonnull (temp_root);
|
||||
xdg_data_home = g_build_filename (temp_root, "data", NULL);
|
||||
themes_root = g_build_filename (xdg_data_home, "themes", NULL);
|
||||
g_assert_cmpint (g_mkdir_with_parents (themes_root, 0700), ==, 0);
|
||||
g_assert_cmpint (g_mkdir_with_parents (xdg_data_home, 0700), ==, 0);
|
||||
g_setenv ("XDG_DATA_HOME", xdg_data_home, TRUE);
|
||||
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
|
||||
g_setenv ("NO_AT_BRIDGE", "1", TRUE);
|
||||
g_unsetenv ("GTK_THEME");
|
||||
|
||||
theme_parent_root = g_build_filename (themes_root, theme_parent_name, NULL);
|
||||
theme_child_root = g_build_filename (themes_root, theme_child_name, NULL);
|
||||
theme_switch_root = g_build_filename (themes_root, theme_switch_name, NULL);
|
||||
theme_parent_root = g_build_filename (temp_root, "parent", NULL);
|
||||
theme_child_root = g_build_filename (temp_root, "child", NULL);
|
||||
theme_switch_root = g_build_filename (temp_root, "switch", NULL);
|
||||
g_assert_cmpint (g_mkdir_with_parents (theme_parent_root, 0700), ==, 0);
|
||||
g_assert_cmpint (g_mkdir_with_parents (theme_child_root, 0700), ==, 0);
|
||||
g_assert_cmpint (g_mkdir_with_parents (theme_switch_root, 0700), ==, 0);
|
||||
@@ -272,13 +248,13 @@ setup_themes (void)
|
||||
"gtk-cursor-blink-time=444\n");
|
||||
|
||||
path = g_build_filename (theme_parent_root, "index.theme", NULL);
|
||||
write_file (path, "[Desktop Entry]\nName=zoitechat-test-parent\n");
|
||||
write_file (path, "[Desktop Entry]\nName=parent\n");
|
||||
g_free (path);
|
||||
path = g_build_filename (theme_child_root, "index.theme", NULL);
|
||||
write_file (path, "[Desktop Entry]\nName=zoitechat-test-child\nInherits=zoitechat-test-parent\n");
|
||||
write_file (path, "[Desktop Entry]\nName=child\nInherits=parent\n");
|
||||
g_free (path);
|
||||
path = g_build_filename (theme_switch_root, "index.theme", NULL);
|
||||
write_file (path, "[Desktop Entry]\nName=zoitechat-test-switch\n");
|
||||
write_file (path, "[Desktop Entry]\nName=switch\n");
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
@@ -290,13 +266,11 @@ teardown_themes (void)
|
||||
g_free (theme_parent_root);
|
||||
g_free (theme_child_root);
|
||||
g_free (theme_switch_root);
|
||||
g_free (themes_root);
|
||||
g_free (xdg_data_home);
|
||||
g_free (temp_root);
|
||||
theme_parent_root = NULL;
|
||||
theme_child_root = NULL;
|
||||
theme_switch_root = NULL;
|
||||
themes_root = NULL;
|
||||
xdg_data_home = NULL;
|
||||
temp_root = NULL;
|
||||
}
|
||||
@@ -377,7 +351,6 @@ main (int argc, char **argv)
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
setup_themes ();
|
||||
gtk_available = gtk_init_check (&argc, &argv);
|
||||
gtk_has_default_seat = gtk_available && test_display_has_default_seat ();
|
||||
|
||||
g_test_add_func ("/theme/gtk3/settings_layer_precedence", test_settings_layer_precedence);
|
||||
g_test_add_func ("/theme/gtk3/settings_restored_on_disable_and_switch", test_settings_restored_on_disable_and_switch);
|
||||
@@ -386,8 +359,6 @@ main (int argc, char **argv)
|
||||
|
||||
if (!gtk_available)
|
||||
g_test_message ("Skipping GTK3 settings tests because GTK initialization failed");
|
||||
else if (!gtk_has_default_seat)
|
||||
g_test_message ("Skipping gtk-theme-name assertions because GTK display has no default GdkSeat");
|
||||
|
||||
rc = g_test_run ();
|
||||
theme_gtk3_disable ();
|
||||
|
||||
@@ -151,12 +151,8 @@ settings_rescan_icon_theme (void)
|
||||
static void
|
||||
theme_gtk3_reset_widgets (void)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
|
||||
if (!theme_gtk3_display_has_default_seat ())
|
||||
return;
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
if (screen)
|
||||
gtk_style_context_reset_widgets (screen);
|
||||
}
|
||||
@@ -434,9 +430,6 @@ settings_apply_theme_name (const char *theme_root)
|
||||
if (!theme_root)
|
||||
return;
|
||||
|
||||
if (!theme_gtk3_display_has_default_seat ())
|
||||
return;
|
||||
|
||||
settings = gtk_settings_get_default ();
|
||||
if (!settings || !settings_default_seat_available ())
|
||||
return;
|
||||
@@ -767,12 +760,9 @@ settings_apply_from_file (const char *theme_root, const char *css_dir)
|
||||
static void
|
||||
theme_gtk3_remove_provider (void)
|
||||
{
|
||||
GdkScreen *screen = NULL;
|
||||
GdkScreen *screen = gdk_screen_get_default ();
|
||||
guint i;
|
||||
|
||||
if (theme_gtk3_display_has_default_seat ())
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
if (screen && theme_gtk3_providers_variant)
|
||||
{
|
||||
for (i = 0; i < theme_gtk3_providers_variant->len; i++)
|
||||
@@ -827,10 +817,7 @@ load_css_with_variant (ZoitechatGtk3Theme *theme, ThemeGtk3Variant variant, GErr
|
||||
theme_gtk3_providers_base = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
theme_gtk3_providers_variant = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
screen = NULL;
|
||||
if (theme_gtk3_display_has_default_seat ())
|
||||
screen = gdk_screen_get_default ();
|
||||
|
||||
screen = gdk_screen_get_default ();
|
||||
for (i = 0; i < chain->len; i++)
|
||||
{
|
||||
const char *theme_root = g_ptr_array_index (chain, i);
|
||||
|
||||
Reference in New Issue
Block a user