Blame SOURCES/0021-testsuite-complex-testing-of-xml-locales.patch

562801
From 9fb7abeeedc68878f70d2e15c191f13b9f0750b1 Mon Sep 17 00:00:00 2001
562801
From: Jakub Filak <jfilak@redhat.com>
562801
Date: Sat, 8 Feb 2014 09:14:59 +0100
562801
Subject: [LIBREPORT PATCH 21/24] testsuite: complex testing of xml locales
562801
562801
Related to rhbz#1063320
562801
562801
Signed-off-by: Jakub Filak <jfilak@redhat.com>
562801
---
562801
 tests/xml_definition.at | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
562801
 1 file changed, 79 insertions(+)
562801
562801
diff --git a/tests/xml_definition.at b/tests/xml_definition.at
562801
index e9cef49..d3032c9 100644
562801
--- a/tests/xml_definition.at
562801
+++ b/tests/xml_definition.at
562801
@@ -55,6 +55,85 @@ int main(void)
562801
         free_workflow(workflow);
562801
     }
562801
 
562801
+    setlocale(LC_ALL, "zh_CN.utf8");
562801
+
562801
+    {
562801
+        event_config_t *event_config = new_event_config("event_test_definition");
562801
+        load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
562801
+        assert(strcmp("screen name", ec_get_screen_name(event_config)) == 0);
562801
+        assert(strcmp("description", ec_get_description(event_config)) == 0);
562801
+        assert(strcmp("long description", ec_get_long_desc(event_config)) == 0);
562801
+
562801
+        assert(event_config->options != NULL || !"At least one event option was loaded");
562801
+
562801
+        /* typeof(event_config->options) == (GList *) */
562801
+        event_option_t *event_option = (event_option_t *)event_config->options->data;
562801
+        assert(strcmp("label", event_option->eo_label) == 0);
562801
+        assert(strcmp("note_html", event_option->eo_note_html) == 0);
562801
+
562801
+        /* Option description is not supported yet
562801
+        assert(strcmp("description", event_option->eo_description) == 0);
562801
+        */
562801
+
562801
+        free_event_config(event_config);
562801
+    }
562801
+
562801
+    {
562801
+        workflow_t *workflow = new_workflow("workflow_test_definition");
562801
+        load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
562801
+
562801
+        assert(strcmp("screen name", wf_get_screen_name(workflow)) == 0);
562801
+        assert(strcmp("description", wf_get_description(workflow)) == 0);
562801
+
562801
+        /* Long description is not supported yet
562801
+        assert(strcmp("long description", wf_get_long_desc(workflow)) == 0);
562801
+         */
562801
+
562801
+        free_workflow(workflow);
562801
+    }
562801
+
562801
+    /*
562801
+       XML definitions does not contain strings for zh_HK but there are strings
562801
+       for zh_CN and followed by zh_TW. libreport should you string for zh_TW
562801
+       and these strings are prefixed with "bad " string.
562801
+     */
562801
+    setlocale(LC_ALL, "zh_HK");
562801
+
562801
+    {
562801
+        event_config_t *event_config = new_event_config("event_test_definition");
562801
+        load_event_description_from_file(event_config, "../../conf/event_test_definition.xml");
562801
+        assert(strcmp("bad screen name", ec_get_screen_name(event_config)) == 0);
562801
+        assert(strcmp("bad description", ec_get_description(event_config)) == 0);
562801
+        assert(strcmp("bad long description", ec_get_long_desc(event_config)) == 0);
562801
+
562801
+        assert(event_config->options != NULL || !"At least one event option was loaded");
562801
+
562801
+        /* typeof(event_config->options) == (GList *) */
562801
+        event_option_t *event_option = (event_option_t *)event_config->options->data;
562801
+        assert(strcmp("bad label", event_option->eo_label) == 0);
562801
+        assert(strcmp("bad note_html", event_option->eo_note_html) == 0);
562801
+
562801
+        /* Option description is not supported yet
562801
+        assert(strcmp("description", event_option->eo_description) == 0);
562801
+        */
562801
+
562801
+        free_event_config(event_config);
562801
+    }
562801
+
562801
+    {
562801
+        workflow_t *workflow = new_workflow("workflow_test_definition");
562801
+        load_workflow_description_from_file(workflow, "../../conf/workflow_test_definition.xml");
562801
+
562801
+        assert(strcmp("bad screen name", wf_get_screen_name(workflow)) == 0);
562801
+        assert(strcmp("bad description", wf_get_description(workflow)) == 0);
562801
+
562801
+        /* Long description is not supported yet
562801
+        assert(strcmp("bad long description", wf_get_long_desc(workflow)) == 0);
562801
+         */
562801
+
562801
+        free_workflow(workflow);
562801
+    }
562801
+
562801
     return EXIT_SUCCESS;
562801
 }
562801
 ]])
562801
-- 
562801
1.8.3.1
562801