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

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