[gnome-software] trivial: Add a self test for the my-language kudo
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Add a self test for the my-language kudo
- Date: Sun, 17 Apr 2016 10:38:46 +0000 (UTC)
commit 61775536bcd36230fd67849e85880ec31b9264a4
Author: Richard Hughes <richard hughsie com>
Date: Sun Apr 17 09:50:56 2016 +0100
trivial: Add a self test for the my-language kudo
src/gs-plugin-loader.c | 22 ++++++++++++++--------
src/gs-self-test.c | 13 +++++++++++--
src/plugins/gs-plugin-appstream.c | 2 +-
3 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 1f39ec9..4784ee6 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3450,7 +3450,6 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
const gchar *tmp;
- gchar *match;
gchar **projects;
guint i;
@@ -3468,13 +3467,20 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
SOUP_TYPE_CONTENT_DECODER);
/* get the locale without the various UTF-8 suffixes */
- priv->locale = g_strdup (setlocale (LC_MESSAGES, NULL));
- match = g_strstr_len (priv->locale, -1, ".UTF-8");
- if (match != NULL)
- *match = '\0';
- match = g_strstr_len (priv->locale, -1, ".utf8");
- if (match != NULL)
- *match = '\0';
+ tmp = g_getenv ("GS_SELF_TEST_LOCALE");
+ if (tmp != NULL) {
+ g_debug ("using self test locale of %s", tmp);
+ priv->locale = g_strdup (tmp);
+ } else {
+ gchar *match;
+ priv->locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+ match = g_strstr_len (priv->locale, -1, ".UTF-8");
+ if (match != NULL)
+ *match = '\0';
+ match = g_strstr_len (priv->locale, -1, ".utf8");
+ if (match != NULL)
+ *match = '\0';
+ }
g_mutex_init (&priv->pending_apps_mutex);
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 2ba9d5d..2f5655c 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -270,6 +270,7 @@ gs_plugin_loader_installed_func (GsPluginLoader *plugin_loader)
GsApp *app;
GsApp *addon;
GPtrArray *addons;
+ guint64 kudos;
g_autofree gchar *menu_path = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GsAppList) list = NULL;
@@ -298,6 +299,10 @@ gs_plugin_loader_installed_func (GsPluginLoader *plugin_loader)
g_assert (gs_app_has_quirk (app, AS_APP_QUIRK_PROVENANCE));
g_assert (gs_app_get_license_is_free (app));
+ /* check kudos */
+ kudos = gs_app_get_kudos (app);
+ g_assert (kudos & GS_APP_KUDO_MY_LANGUAGE);
+
/* check categories */
g_assert (gs_app_has_category (app, "Audio"));
g_assert (gs_app_has_category (app, "Player"));
@@ -386,6 +391,7 @@ main (int argc, char **argv)
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
/* set all the things required as a dummy test harness */
+ g_setenv ("GS_SELF_TEST_LOCALE", "en_GB", TRUE);
g_setenv ("GS_SELF_TEST_DUMMY_ENABLE", "1", TRUE);
g_setenv ("GS_SELF_TEST_PROVENANCE_SOURCES", "london*,boston", TRUE);
@@ -400,9 +406,12 @@ main (int argc, char **argv)
" <pkgname>zeus</pkgname>\n"
" <icon type=\"stock\">drive-harddisk</icon>\n"
" <categories>\n"
- " <category>AudioVideo</category>\n"
- " <category>Player</category>\n"
+ " <category>AudioVideo</category>\n"
+ " <category>Player</category>\n"
" </categories>\n"
+ " <languages>\n"
+ " <lang percentage=\"100\">en_GB</lang>\n"
+ " </languages>\n"
" </component>\n"
" <component type=\"desktop\">\n"
" <id>mate-spell.desktop</id>\n"
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 71056c4..7689cc3 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -172,7 +172,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
/* only when in self test */
tmp = g_getenv ("GS_SELF_TEST_APPSTREAM_XML");
if (tmp != NULL) {
- g_debug ("Using self test data of %s", tmp);
+ g_debug ("using self test data of %s", tmp);
if (!as_store_from_xml (plugin->priv->store, tmp, NULL, error))
return FALSE;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]