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

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