diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-12-11 18:48:06 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-12-13 17:18:48 +0100 |
commit | ac8c5ef7f57505dbd68d9094c0c3e6de247478b7 (patch) | |
tree | c0e5d8879420a2aabdeff709e40ffc0fecebe11e /test | |
parent | ecf74a19ec03381b8e63522898fa276890c3e658 (diff) |
test-isodetect: Add test for osinfo_media_get_languages
By dropping a .lng file similar to:
[general]
l10n-language=fr_FR;en_EN;
it's possible to specify which languages a given media is supposed
to support. test-isodetect will then check that the languages for this
media in the OsinfoDb match the expected ones.
Diffstat (limited to 'test')
43 files changed, 152 insertions, 0 deletions
diff --git a/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x64_dvd_u_676956.iso.lng b/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x64_dvd_u_676956.iso.lng new file mode 100644 index 0000000..6051601 --- /dev/null +++ b/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x64_dvd_u_676956.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=cs_CZ diff --git a/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x86_dvd_u_677077.iso.lng b/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x86_dvd_u_677077.iso.lng new file mode 100644 index 0000000..6051601 --- /dev/null +++ b/test/isodata/windows/win7/cs_windows_7_professional_with_sp1_x86_dvd_u_677077.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=cs_CZ diff --git a/test/isodata/windows/win7/en_windows_7_enterprise_n_x64_dvd_x16-11943.iso.lng b/test/isodata/windows/win7/en_windows_7_enterprise_n_x64_dvd_x16-11943.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_enterprise_n_x64_dvd_x16-11943.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_enterprise_n_x86_dvd_x16-11935.iso.lng b/test/isodata/windows/win7/en_windows_7_enterprise_n_x86_dvd_x16-11935.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_enterprise_n_x86_dvd_x16-11935.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_enterprise_x64_dvd_x15-70749.iso.lng b/test/isodata/windows/win7/en_windows_7_enterprise_x64_dvd_x15-70749.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_enterprise_x64_dvd_x15-70749.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_enterprise_x86_dvd_x15-70745.iso.lng b/test/isodata/windows/win7/en_windows_7_enterprise_x86_dvd_x15-70745.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_enterprise_x86_dvd_x15-70745.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_professional_n_with_sp1_x86_dvd_u_677328.iso.lng b/test/isodata/windows/win7/en_windows_7_professional_n_with_sp1_x86_dvd_u_677328.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_professional_n_with_sp1_x86_dvd_u_677328.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso.lng b/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x86_dvd_u_677056.iso.lng b/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x86_dvd_u_677056.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_professional_with_sp1_x86_dvd_u_677056.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_ultimate_n_with_sp1_x86_dvd_u_677597.iso.lng b/test/isodata/windows/win7/en_windows_7_ultimate_n_with_sp1_x86_dvd_u_677597.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_ultimate_n_with_sp1_x86_dvd_u_677597.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_ultimate_x64_dvd_x15-65922.iso.lng b/test/isodata/windows/win7/en_windows_7_ultimate_x64_dvd_x15-65922.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_ultimate_x64_dvd_x15-65922.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/en_windows_7_ultimate_x86_dvd_x15-65921.iso.lng b/test/isodata/windows/win7/en_windows_7_ultimate_x86_dvd_x15-65921.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win7/en_windows_7_ultimate_x86_dvd_x15-65921.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x64_dvd_u_677808.iso.lng b/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x64_dvd_u_677808.iso.lng new file mode 100644 index 0000000..6d482fb --- /dev/null +++ b/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x64_dvd_u_677808.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=fi_FI diff --git a/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x86_dvd_u_677759.iso.lng b/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x86_dvd_u_677759.iso.lng new file mode 100644 index 0000000..6d482fb --- /dev/null +++ b/test/isodata/windows/win7/fi_windows_7_professional_with_sp1_vl_build_x86_dvd_u_677759.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=fi_FI diff --git a/test/isodata/windows/win7/fr_windows_7_home_premium_n_with_sp1_x64_dvd_u_676833.iso.lng b/test/isodata/windows/win7/fr_windows_7_home_premium_n_with_sp1_x64_dvd_u_676833.iso.lng new file mode 100644 index 0000000..e4519a7 --- /dev/null +++ b/test/isodata/windows/win7/fr_windows_7_home_premium_n_with_sp1_x64_dvd_u_676833.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=fr_FR diff --git a/test/isodata/windows/win7/ru_windows_7_enterprise_with_sp1_x64_dvd_u_677671.iso.lng b/test/isodata/windows/win7/ru_windows_7_enterprise_with_sp1_x64_dvd_u_677671.iso.lng new file mode 100644 index 0000000..08940d5 --- /dev/null +++ b/test/isodata/windows/win7/ru_windows_7_enterprise_with_sp1_x64_dvd_u_677671.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=ru_RU diff --git a/test/isodata/windows/win7/ru_windows_7_ultimate_with_sp1_x86_dvd_u_677463.iso.lng b/test/isodata/windows/win7/ru_windows_7_ultimate_with_sp1_x86_dvd_u_677463.iso.lng new file mode 100644 index 0000000..08940d5 --- /dev/null +++ b/test/isodata/windows/win7/ru_windows_7_ultimate_with_sp1_x86_dvd_u_677463.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=ru_RU diff --git a/test/isodata/windows/win8/Windows8-ConsumerPreview-32bit-English.iso.lng b/test/isodata/windows/win8/Windows8-ConsumerPreview-32bit-English.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/Windows8-ConsumerPreview-32bit-English.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/Windows8-ConsumerPreview-64bit-English.iso.lng b/test/isodata/windows/win8/Windows8-ConsumerPreview-64bit-English.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/Windows8-ConsumerPreview-64bit-English.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/de_windows_8_enterprise_n_x64_dvd_917975.iso.lng b/test/isodata/windows/win8/de_windows_8_enterprise_n_x64_dvd_917975.iso.lng new file mode 100644 index 0000000..ac695c0 --- /dev/null +++ b/test/isodata/windows/win8/de_windows_8_enterprise_n_x64_dvd_917975.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=de_DE diff --git a/test/isodata/windows/win8/en-gb_windows_8_x86_dvd_915479.iso.lng b/test/isodata/windows/win8/en-gb_windows_8_x86_dvd_915479.iso.lng new file mode 100644 index 0000000..4964c4d --- /dev/null +++ b/test/isodata/windows/win8/en-gb_windows_8_x86_dvd_915479.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_GB diff --git a/test/isodata/windows/win8/en_windows_8_debug_checked_build_x64_dvd_917558.iso.lng b/test/isodata/windows/win8/en_windows_8_debug_checked_build_x64_dvd_917558.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_debug_checked_build_x64_dvd_917558.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_debug_checked_build_x86_dvd_917560.iso.lng b/test/isodata/windows/win8/en_windows_8_debug_checked_build_x86_dvd_917560.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_debug_checked_build_x86_dvd_917560.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x64_dvd_917527.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x64_dvd_917527.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x64_dvd_917527.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x86_dvd_917529.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x86_dvd_917529.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_debug_checked_build_x86_dvd_917529.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x64_dvd_917531.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x64_dvd_917531.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x64_dvd_917531.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x86_dvd_917534.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x86_dvd_917534.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_n_debug_checked_build_x86_dvd_917534.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_n_x64_dvd_918052.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_n_x64_dvd_918052.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_n_x64_dvd_918052.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_n_x86_dvd_918707.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_n_x86_dvd_918707.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_n_x86_dvd_918707.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_x64_dvd_917522.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_x64_dvd_917522.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_x64_dvd_917522.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_enterprise_x86_dvd_917587.iso.lng b/test/isodata/windows/win8/en_windows_8_enterprise_x86_dvd_917587.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_enterprise_x86_dvd_917587.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x64_dvd_917562.iso.lng b/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x64_dvd_917562.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x64_dvd_917562.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x86_dvd_917564.iso.lng b/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x86_dvd_917564.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_n_debug_checked_build_x86_dvd_917564.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_n_x64_dvd_916091.iso.lng b/test/isodata/windows/win8/en_windows_8_n_x64_dvd_916091.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_n_x64_dvd_916091.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_n_x86_dvd_916097.iso.lng b/test/isodata/windows/win8/en_windows_8_n_x86_dvd_916097.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_n_x86_dvd_916097.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_pro_n_vl_x64_dvd_918677.iso.lng b/test/isodata/windows/win8/en_windows_8_pro_n_vl_x64_dvd_918677.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_pro_n_vl_x64_dvd_918677.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_pro_n_vl_x86_dvd_918877.iso.lng b/test/isodata/windows/win8/en_windows_8_pro_n_vl_x86_dvd_918877.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_pro_n_vl_x86_dvd_918877.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_pro_vl_x64_dvd_917699.iso.lng b/test/isodata/windows/win8/en_windows_8_pro_vl_x64_dvd_917699.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_pro_vl_x64_dvd_917699.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_pro_vl_x86_dvd_917830.iso.lng b/test/isodata/windows/win8/en_windows_8_pro_vl_x86_dvd_917830.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_pro_vl_x86_dvd_917830.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_x64_dvd_915440.iso.lng b/test/isodata/windows/win8/en_windows_8_x64_dvd_915440.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_x64_dvd_915440.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/en_windows_8_x86_dvd_915417.iso.lng b/test/isodata/windows/win8/en_windows_8_x86_dvd_915417.iso.lng new file mode 100644 index 0000000..e46008a --- /dev/null +++ b/test/isodata/windows/win8/en_windows_8_x86_dvd_915417.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=en_US diff --git a/test/isodata/windows/win8/fr_windows_8_x86_dvd_915420.iso.lng b/test/isodata/windows/win8/fr_windows_8_x86_dvd_915420.iso.lng new file mode 100644 index 0000000..e4519a7 --- /dev/null +++ b/test/isodata/windows/win8/fr_windows_8_x86_dvd_915420.iso.lng @@ -0,0 +1,2 @@ +[general] +l10n-language=fr_FR diff --git a/test/test-isodetect.c b/test/test-isodetect.c index f627300..a3460ff 100644 --- a/test/test-isodetect.c +++ b/test/test-isodetect.c @@ -29,6 +29,7 @@ struct ISOInfo { gchar *shortid; gchar *filename; OsinfoMedia *media; + GHashTable *langs; }; static void free_iso(struct ISOInfo *info) @@ -40,9 +41,50 @@ static void free_iso(struct ISOInfo *info) g_free(info->shortid); if (info->media) g_object_unref(info->media); + if (info->langs) + g_hash_table_unref(info->langs); g_free(info); } +static gboolean load_langs(GFile *file, struct ISOInfo *info, GError **error) +{ + char *path; + GKeyFile *lang_file; + GStrv langs; + GStrv it; + + path = g_file_get_path(file); + if (path == NULL) + return FALSE; + if (!g_str_has_suffix(path, ".txt")) { + g_free(path); + return FALSE; + } + strcpy(&path[strlen(path) - sizeof(".txt") + 1], ".lng"); + lang_file = g_key_file_new(); + if (!g_key_file_load_from_file(lang_file, path, G_KEY_FILE_NONE, NULL)) { + g_key_file_free(lang_file); + g_free(path); + return FALSE; + } + langs = g_key_file_get_string_list(lang_file, "general", "l10n-language", + NULL, NULL); + if (langs == NULL) { + g_key_file_free(lang_file); + g_free(path); + return FALSE; + } + + for (it = langs; (it != NULL) && (*it != NULL); it++) { + g_hash_table_add(info->langs, g_strdup(*it)); + } + + g_strfreev(langs); + g_key_file_free(lang_file); + g_free(path); + + return TRUE; +} static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar *name, GError **error) { @@ -60,6 +102,7 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar * info->filename = g_strdup(name); info->shortid = g_strdup(shortid); + info->langs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); if (strstr(name, "amd64") || strstr(name, "x64") || strstr(name, "x86_64") || @@ -111,6 +154,8 @@ static struct ISOInfo *load_iso(GFile *file, const gchar *shortid, const gchar * if (*error) goto error; + load_langs(file, info, error); + cleanup: if (fis) g_object_unref(fis); @@ -231,6 +276,28 @@ static GList *load_isos(const gchar *vendor, GError **error) } +static void test_langs(struct ISOInfo *info) +{ + GList *langs; + GList *it; + + /* exit early if there was no associated .lng file */ + if (g_hash_table_size(info->langs) == 0) + return; + + langs = osinfo_media_get_languages(info->media); + + for (it = langs; it != NULL; it = it->next) { + fail_unless(g_hash_table_contains(info->langs, it->data), + "%s not a known language for ISO %s", + it->data, info->filename); + g_hash_table_remove(info->langs, it->data); + } + fail_unless(g_hash_table_size(info->langs) == 0, + "some languages were not identified on ISO %s", + info->filename); +} + static void test_one(const gchar *vendor) { OsinfoLoader *loader = osinfo_loader_new(); @@ -264,6 +331,7 @@ static void test_one(const gchar *vendor) "ISO %s matched OS %s instead of expected %s", info->filename, shortid, info->shortid); g_object_unref(G_OBJECT(os)); + test_langs(info); tmp = tmp->next; } |