Blame SOURCES/0020-testsuite-xml-translations.patch

562801
From 819abbfc939d7a2e5f674fd6b77c3fef655d24da Mon Sep 17 00:00:00 2001
562801
From: Jakub Filak <jfilak@redhat.com>
562801
Date: Fri, 7 Feb 2014 16:19:20 +0100
562801
Subject: [LIBREPORT PATCH 20/24] testsuite: xml translations
562801
562801
Related to rhbz#1063320
562801
562801
Signed-off-by: Jakub Filak <jfilak@redhat.com>
562801
---
562801
 tests/Makefile.am                       |  3 +-
562801
 tests/conf/event_test_definition.xml    | 32 ++++++++++++++++++
562801
 tests/conf/workflow_test_definition.xml | 13 +++++++
562801
 tests/testsuite.at                      |  1 +
562801
 tests/xml_definition.at                 | 60 +++++++++++++++++++++++++++++++++
562801
 5 files changed, 108 insertions(+), 1 deletion(-)
562801
 create mode 100644 tests/conf/event_test_definition.xml
562801
 create mode 100644 tests/conf/workflow_test_definition.xml
562801
 create mode 100644 tests/xml_definition.at
562801
562801
diff --git a/tests/Makefile.am b/tests/Makefile.am
562801
index e8af4de..8ec40e1 100644
562801
--- a/tests/Makefile.am
562801
+++ b/tests/Makefile.am
562801
@@ -37,7 +37,8 @@ TESTSUITE_AT = \
562801
   configuration_files.at \
562801
   reported_to.at \
562801
   make_description.at \
562801
-  libreport_types.at
562801
+  libreport_types.at \
562801
+  xml_definition.at
562801
 
562801
 EXTRA_DIST += $(TESTSUITE_AT)
562801
 TESTSUITE = $(srcdir)/testsuite
562801
diff --git a/tests/conf/event_test_definition.xml b/tests/conf/event_test_definition.xml
562801
new file mode 100644
562801
index 0000000..e12648a
562801
--- /dev/null
562801
+++ b/tests/conf/event_test_definition.xml
562801
@@ -0,0 +1,32 @@
562801
+
562801
+<event>
562801
+    <name>Bugzilla</name>
562801
+    <name xml:lang="zh_CN">screen name</name>
562801
+    <name xml:lang="zh_TW">bad screen name</name>
562801
+
562801
+    <description>Report to Bugzilla bug tracker</description>
562801
+    <description xml:lang="zh_CN">description</description>
562801
+    <description xml:lang="zh_TW">bad description</description>
562801
+
562801
+    <long-description>Report to Bugzilla bug tracker in long description</long-description>
562801
+    <long-description xml:lang="zh_CN">long description</long-description>
562801
+    <long-description xml:lang="zh_TW">bad long description</long-description>
562801
+
562801
+    <options>
562801
+        <option type="text" name="Bugzilla_BugzillaURL">
562801
+            <label>Bugzilla URL</label>
562801
+            <label xml:lang="zh_CN">label</label>
562801
+            <label xml:lang="zh_TW">bad label</label>
562801
+
562801
+            
562801
+            <description>Address of Bugzilla server</description>
562801
+            <description xml:lang="zh_CN">bad description</description>
562801
+            <description xml:lang="zh_TW">description</description>
562801
+            -->
562801
+
562801
+            <note-html>Bugzilla HTML note</note-html>
562801
+            <note-html xml:lang="zh_CN">note_html</note-html>
562801
+            <note-html xml:lang="zh_TW">bad note_html</note-html>
562801
+        </option>
562801
+    </options>
562801
+</event>
562801
diff --git a/tests/conf/workflow_test_definition.xml b/tests/conf/workflow_test_definition.xml
562801
new file mode 100644
562801
index 0000000..1666c1c
562801
--- /dev/null
562801
+++ b/tests/conf/workflow_test_definition.xml
562801
@@ -0,0 +1,13 @@
562801
+
562801
+<workflow>
562801
+    <name>Report to Red Hat Customer Portal</name>
562801
+    <name xml:lang="zh_CN">screen name</name>
562801
+    <name xml:lang="zh_TW">bad screen name</name>
562801
+    <description>Process the C/C++ crash using the Red Hat infrastructure</description>
562801
+    <description xml:lang="zh_CN">description</description>
562801
+    <description xml:lang="zh_TW">bad description</description>
562801
+
562801
+    <events>
562801
+        <event>collect_*</event>
562801
+    </events>
562801
+</workflow>
562801
diff --git a/tests/testsuite.at b/tests/testsuite.at
562801
index 1faccfb..97b2442 100644
562801
--- a/tests/testsuite.at
562801
+++ b/tests/testsuite.at
562801
@@ -12,3 +12,4 @@ m4_include([configuration_files.at])
562801
 m4_include([reported_to.at])
562801
 m4_include([make_description.at])
562801
 m4_include([libreport_types.at])
562801
+m4_include([xml_definition.at])
562801
diff --git a/tests/xml_definition.at b/tests/xml_definition.at
562801
new file mode 100644
562801
index 0000000..e9cef49
562801
--- /dev/null
562801
+++ b/tests/xml_definition.at
562801
@@ -0,0 +1,60 @@
562801
+# -*- Autotest -*-
562801
+
562801
+AT_BANNER([XML definitions])
562801
+
562801
+## ------------------------ ##
562801
+## region_specific_language ##
562801
+## ------------------------ ##
562801
+
562801
+AT_TESTFUN([region_specific_language],
562801
+[[
562801
+#include "internal_libreport.h"
562801
+#include <locale.h>
562801
+#include <stdlib.h>
562801
+#include <stdio.h>
562801
+#include <assert.h>
562801
+
562801
+int main(void)
562801
+{
562801
+    g_verbose = 3;
562801
+
562801
+    setlocale(LC_ALL, "zh_CN");
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
+    return EXIT_SUCCESS;
562801
+}
562801
+]])
562801
-- 
562801
1.8.3.1
562801