[gnome-builder] libide/tweaks: give test program access to languages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: give test program access to languages
- Date: Sun, 31 Jul 2022 12:10:50 +0000 (UTC)
commit 8562a84f4d8c283473170c565358e7381bf4f064
Author: Christian Hergert <chergert redhat com>
Date: Sun Jul 31 05:10:45 2022 -0700
libide/tweaks: give test program access to languages
We want to have a GListModel of languages in here so that we can more
easily test things that will be using list models to generate items, such
as subpages.
src/libide/tweaks/tests/meson.build | 2 +-
src/libide/tweaks/tests/test-tweaks.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/tweaks/tests/meson.build b/src/libide/tweaks/tests/meson.build
index f7d8ea0ae..a99012f74 100644
--- a/src/libide/tweaks/tests/meson.build
+++ b/src/libide/tweaks/tests/meson.build
@@ -1,5 +1,5 @@
test_tweaks = executable('test-tweaks', 'test-tweaks.c',
- dependencies: [libide_tweaks_dep],
+ dependencies: [libide_tweaks_dep, libgtksource_dep],
)
test_tweaks_runs = [
diff --git a/src/libide/tweaks/tests/test-tweaks.c b/src/libide/tweaks/tests/test-tweaks.c
index 190ddeb47..cf45b967a 100644
--- a/src/libide/tweaks/tests/test-tweaks.c
+++ b/src/libide/tweaks/tests/test-tweaks.c
@@ -20,6 +20,8 @@
#include <unistd.h>
+#include <gtksourceview/gtksource.h>
+
#include <libide-tweaks.h>
#include "ide-tweaks-init.h"
@@ -41,6 +43,7 @@ main (int argc,
{ NULL }
};
+ gtk_source_init ();
_ide_tweaks_init ();
context = g_option_context_new ("- test tweaks ui merging");
@@ -55,6 +58,24 @@ main (int argc,
tweaks = ide_tweaks_new ();
string = g_string_new (NULL);
+ /* Test with languages exposed */
+ {
+ GtkSourceLanguageManager *lm = gtk_source_language_manager_get_default ();
+ const char * const *ids = gtk_source_language_manager_get_language_ids (lm);
+ const char * const *allowed = IDE_STRV_INIT ("c", "chdr", "css", "xml");
+ g_autoptr(GListStore) languages = NULL;
+
+ languages = g_list_store_new (GTK_SOURCE_TYPE_LANGUAGE);
+
+ for (guint i = 0; ids[i]; i++)
+ {
+ if (g_strv_contains (allowed, ids[i]))
+ g_list_store_append (languages, gtk_source_language_manager_get_language (lm, ids[i]));
+ }
+
+ ide_tweaks_expose_object (tweaks, "GtkSourceLanguages", G_OBJECT (languages));
+ }
+
for (guint i = 1; i < argc; i++)
{
const char *path = argv[i];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]